owfs-2.8p15/0000775000175000017500000000000011756315507007704 500000000000000owfs-2.8p15/COPYING0000664000175000017500000004311011651552637010657 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. owfs-2.8p15/COPYING.LIB0000664000175000017500000006130311651552637011270 00000000000000 GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] 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 Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the 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 a program 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. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. 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, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library 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 compile 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) 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. c) 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. d) 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 source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. 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 to 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 Library 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 Appendix: 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. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! owfs-2.8p15/INSTALL0000664000175000017500000002354011651552637010662 00000000000000$Id: INSTALL,v 1.6 2010/05/08 14:21:23 alfille Exp $ This package uses the standard UNIX installation methods, with scripts that tailor the code to your environment. Usually you'll use the QUICK INSTALL and can ignore all the rest. QUICK INSTALL: (From a source code release) -------------------------------------------------------------------- 1. Download and unpack owfs (you can find it on sourceforge: http://www.sf.net/projects/owfs ) 2. cd owfs # move into the directory 3. ./configure 4. sudo make install 5. Run. Several choices: A. Filesystem using FUSE /opt/owfs/bin/owfs -d /dev/ttyS1 -m /mnt/1wire where /dev/ttyS1 is the serial port of your interface and /mnt/1wire is the directory to mount B. Webserver /opt/owfs/bin/owhttpd -u -p 4444 Where -u is the USB bus master (DS9490) -p 4444 is an arbitrary post Fire up your web browser and look at URL localhost:4444 6. There might be an issue with access permissions to the hardware. Easiest test: /opt/owfs/bin/owhttpd --fake=10 -p 4444 and look at URL http://localhost:4444 to see a simulated 1-wire network. INSTALL from development code (CVS) --------------------------------------------------------------------- 1. Get the source code from the server: A. Type at the command line: cvs -d:pserver:anonymous@owfs.cvs.sourceforge.net:/cvsroot/owfs login cvs -z3 -d:pserver:anonymous@owfs.cvs.sourceforge.net:/cvsroot/owfs co owfs B. You can also follow the instructions here: http://sourceforge.net/scm/?type=cvs&group_id=85502 (which say the same thing) C. Later update to a newer versiion by entering the owfs directory and typing cvs update -dR 2. Run bootstrap (this is a nuisance). A. Try to see if you're lucky: in the owfs directory type ./bootstrap B. If you get errors, the problem is probably the libtool version, so cp /usr/bin/libtool owfs/src/scripts/install/install.sh (the second pathname is a relative path into the owfs directory). then follow A above. 3. Now you can go to step 3 of QUICKINSTALL above. More complete instructions: (Not owfs-specific) --------------------------------------------------------------------- Basic Installation ================== These are generic installation instructions. 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, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). 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 at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' 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. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. 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. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure 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 must use a version of `make' that supports the `VPATH' variable, such as 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 `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have 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' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' 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' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM 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 host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. 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. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--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. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. owfs-2.8p15/acinclude.m40000664000175000017500000000076211665162022012011 00000000000000# aclocal macros specific to OWFS dnl dnl Check to see if the c compiler supports nested functions dnl AC_DEFUN([OW_CHECK_NESTED_FUNCTIONS], [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING(if compiler supports nested functions) AC_TRY_RUN([ f(void (*nested)()) { (*nested)(); } main() { int a = 0; void nested() { a = 1; } f(nested); if(a != 1) exit(1); exit(0); } ], [AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no) CFLAGS="$CFLAGS -DNO_NESTED_FUNCTIONS" ) ]) owfs-2.8p15/TODO0000664000175000017500000000000011651552637010303 00000000000000owfs-2.8p15/NEWS0000664000175000017500000000142411651552637010325 00000000000000$Id: NEWS,v 1.6 2007/12/11 02:01:50 alfille Exp $ Most everything can be found on the website: http://www.owfs.org Basically we support several languages: perl, python, php, tcl We support most of the 1-wire chips: memmory, temperature, voltage, switches (Actually Thermacron support is unfinished, as is DS1922, DS1923, Java iButtons and SHA encryption is unsupported. All other 1-wire slaves are supported). We support serial, i2c, ethernet and USB adapters (as well as a separate backend: owserver). We support multiple adapters and clients. We have caching, simultaneous conversion, multithreading. We have clients for the owserver that are light weight, platform independent, for the shell, perl, python, Visual Basic, Java, ... We have monitoring programs: owmon and owtap owfs-2.8p15/configure0000775000175000017500000225540711756250032011541 00000000000000#! /bin/sh # From configure.ac Id: configure.ac. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_default_prefix=/opt/owfs # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS POW_LIB OW_SHOW_TRAFFIC OW_ALLOC_DEBUG OW_THERMOCOUPLE OW_TAI8570 OW_DEBUG OW_PARPORT OW_ZERO OW_USB OW_CACHE OW_W1 OW_HA7 OW_I2C OW_MT OW_DARWIN OW_CYGWIN ENABLE_PARPORT_FALSE ENABLE_PARPORT_TRUE ENABLE_PARPORT ENABLE_USB_FALSE ENABLE_USB_TRUE ENABLE_USB LIBUSB_LIBS LIBUSB_CFLAGS LIBUSB_CONFIG ENABLE_ZERO_FALSE ENABLE_ZERO_TRUE ENABLE_ZERO ENABLE_CACHE_FALSE ENABLE_CACHE_TRUE ENABLE_CACHE ENABLE_OWFS_FALSE ENABLE_OWFS_TRUE ENABLE_OWFS FUSE_INCLUDES FUSE_FLAGS FUSE_LIBS fuse_lib_path fuse_include_path OSLIBS LD_EXTRALIBS ENABLE_PROFILING_FALSE ENABLE_PROFILING_TRUE ENABLE_PROFILING EXTRACFLAGS DATADIR BINDIR LIBDIR ENABLE_OWTCL_FALSE ENABLE_OWTCL_TRUE ENABLE_OWTCL OWTCL_INSTALL_PATH TCL_PACKAGE_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_LIB_SPEC TCL_LD_SEARCH_FLAGS TCL_COMPAT_OBJS TCL_LD_FLAGS TCL_LIBS TCL_DEFS TCL_CFLAGS TCL_EXEC_PREFIX TCL_PREFIX TCL_SHLIB_SUFFIX TCL_SHLIB_LD_LIBS TCL_SHLIB_LD TCL_SHLIB_CFLAGS TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_VERSION ENABLE_PYTHON_FALSE ENABLE_PYTHON_TRUE ENABLE_PYTHON ENABLE_OWPYTHON_FALSE ENABLE_OWPYTHON_TRUE ENABLE_OWPYTHON PYTHONDYNAMICLINKING PYSITEDIR PYVERSION PYLIB PYLDFLAGS PYCFLAGS PYTHON PYTHONCONFIG ENABLE_PHP_FALSE ENABLE_PHP_TRUE ENABLE_PHP ENABLE_OWPHP_FALSE ENABLE_OWPHP_TRUE ENABLE_OWPHP PHPLIBDIR PHPEXT PHPINC PHPCONFIG PHP ENABLE_PERL_FALSE ENABLE_PERL_TRUE ENABLE_PERL ENABLE_OWPERL_FALSE ENABLE_OWPERL_TRUE ENABLE_OWPERL PERL5CCFLAGS PERL5NAME PERL5DIR PERL5LIB PERL5DYNAMICLINKING PERL5EXT PERL ENABLE_SWIG_FALSE ENABLE_SWIG_TRUE ENABLE_SWIG ENABLE_OWCAPI_FALSE ENABLE_OWCAPI_TRUE ENABLE_OWCAPI ENABLE_OWMON_FALSE ENABLE_OWMON_TRUE ENABLE_OWMON ENABLE_TRAFFIC_FALSE ENABLE_TRAFFIC_TRUE ENABLE_TRAFFIC ENABLE_OWMALLOC_FALSE ENABLE_OWMALLOC_TRUE ENABLE_OWMALLOC ENABLE_OWTAP_FALSE ENABLE_OWTAP_TRUE ENABLE_OWTAP ENABLE_OWNET_FALSE ENABLE_OWNET_TRUE ENABLE_OWNET ENABLE_OWEXTERNAL_FALSE ENABLE_OWEXTERNAL_TRUE ENABLE_OWEXTERNAL ENABLE_OWSERVER_FALSE ENABLE_OWSERVER_TRUE ENABLE_OWSERVER ENABLE_OWFTPD_FALSE ENABLE_OWFTPD_TRUE ENABLE_OWFTPD ENABLE_OWHTTPD_FALSE ENABLE_OWHTTPD_TRUE ENABLE_OWHTTPD ENABLE_W1_FALSE ENABLE_W1_TRUE ENABLE_W1 ENABLE_HA7_FALSE ENABLE_HA7_TRUE ENABLE_HA7 ENABLE_I2C_FALSE ENABLE_I2C_TRUE ENABLE_I2C ENABLE_MT_FALSE ENABLE_MT_TRUE ENABLE_MT PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config ENABLE_THERMOCOUPLE_FALSE ENABLE_THERMOCOUPLE_TRUE ENABLE_THERMOCOUPLE ENABLE_TAI8570_FALSE ENABLE_TAI8570_TRUE ENABLE_TAI8570 ENABLE_OWNETLIB_FALSE ENABLE_OWNETLIB_TRUE ENABLE_OWNETLIB ENABLE_OWLIB_FALSE ENABLE_OWLIB_TRUE ENABLE_OWLIB ENABLE_OWSHELL_FALSE ENABLE_OWSHELL_TRUE ENABLE_OWSHELL ENABLE_DEBUG_FALSE ENABLE_DEBUG_TRUE ENABLE_DEBUG OWFSROOT LIBPOSTFIX PIC_FLAGS HAVE_CYGWIN_FALSE HAVE_CYGWIN_TRUE HAVE_CYGWIN HAVE_DARWIN_FALSE HAVE_DARWIN_TRUE HAVE_DARWIN HAVE_DEBIAN_FALSE HAVE_DEBIAN_TRUE HAVE_DEBIAN LIBTOOL_DEPS OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL LN_S OBJDUMP DLLTOOL AS CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC SWIG RPMBUILD RPM RM TEST ECHO am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build PACKAGE VERSION LT_RELEASE LT_AGE LT_REVISION LT_CURRENT OWFS_BINARY_AGE OWFS_INTERFACE_AGE VERSION_PATCHLEVEL VERSION_MINOR VERSION_MAJOR target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_debian enable_debug enable_owshell enable_owlib enable_ownetlib enable_tai8570 enable_thermocouple enable_mt enable_i2c enable_ha7 enable_w1 enable_owhttpd enable_owftpd enable_owserver enable_owexternal enable_ownet enable_owtap enable_owmalloc enable_owtraffic enable_owmon enable_owcapi enable_swig enable_owperl with_perl5 enable_owphp with_php with_phpconfig enable_owpython with_python with_pythonconfig enable_owtcl with_tcl enable_profiling with_fuseinclude with_fuselib enable_owfs enable_cache enable_zero with_libusb_config enable_usb enable_parport ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-debian Enable debian-system (default false) --enable-debug Enable debug-output (default true) --enable-owshell Enable owshell support (default true) --enable-owlib Enable owlib support (default true) --enable-ownetlib Enable ownetlib support (default true) --enable-tai8570 Enable tai8570 barometer support (default true) --enable-thermocouple Enable thermocouple support (default true) --enable-mt Enable multithreading support (default true) --enable-i2c Enable i2c (DS2482-x00) support (default true) --enable-ha7 Enable ha7 support (default true) --enable-w1 Enable w1 support (default true) --enable-owhttpd Enable owhttpd module (default true) --enable-owftpd Enable owftpd module (default true) --enable-owserver Enable owserver module (default true) --enable-owexternal Enable owexternal module (default true) --enable-ownet Enable ownet module (default true) --enable-owtap Enable owtap module (default true) --enable-owmalloc Enable owmalloc checking (default false) --enable-owtraffic Enable bus traffic reports (default false) --enable-owmon Enable owmon module (default true) --enable-owcapi Enable owcapi module (default true) --enable-swig Enable swig (default auto) --enable-owperl Enable owperl module (default true) --enable-owphp Enable owphp module (default true) --enable-owpython Enable owpython module (default true) --enable-owtcl Enable owtcl module (default true) --enable-profiling Enable profiling (default false) --enable-owfs Enable owfs module (default auto) --enable-cache Enable caching (default true) --enable-zero Enable zeroconf/bonjour (default true) --enable-usb Enable 1-Wire usb DS2490 support (default auto) --enable-parport Enable 1-Wire parallel port DS1410E support (default auto) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-perl5 Set location of Perl executable --with-php Set location of Php executable --with-phpconfig Set location of php-config executable --with-python Set location of Python executable --with-pythonconfig Set location of python-config executable --with-tcl directory containing tcl configuration (tclConfig.sh) --with-fuseinclude=DIR FUSE-include from [/usr/local/include] --with-fuselib=DIR FUSE-lib from [/usr/local/lib] --with-libusb-config=PATH Specify full path to libusb-config Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Making releases: # VERSION_PATCHLEVEL += 1; # OWFS_INTERFACE_AGE += 1; # OWFS_BINARY_AGE += 1; # if any functions have been added, set OWFS_INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set OWFS_BINARY_AGE _and_ OWFS_INTERFACE_AGE to 0. # (In our case it's better to always keep AGE to 0, since nobody else will use our library) VERSION_MAJOR=2 VERSION_MINOR=8 VERSION_PATCHLEVEL=15 OWFS_INTERFACE_AGE=0 OWFS_BINARY_AGE=0 LT_CURRENT=`expr $VERSION_PATCHLEVEL - $OWFS_INTERFACE_AGE` LT_REVISION=$OWFS_INTERFACE_AGE LT_AGE=`expr $OWFS_BINARY_AGE - $OWFS_INTERFACE_AGE` LT_RELEASE=$VERSION_MAJOR.$VERSION_MINOR VERSION="${VERSION_MAJOR}.${VERSION_MINOR}p${VERSION_PATCHLEVEL}" PACKAGE="owfs" { $as_echo "$as_me:${as_lineno-$LINENO}: result: Configuring ${PACKAGE}-${VERSION}" >&5 $as_echo "Configuring ${PACKAGE}-${VERSION}" >&6; } ac_aux_dir= for ac_dir in src/scripts/install "$srcdir"/src/scripts/install; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in src/scripts/install \"$srcdir\"/src/scripts/install" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. #added based on libtoolize warning output # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=${PACKAGE} VERSION=${VERSION} cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Process config.h.in ac_config_headers="$ac_config_headers src/include/config.h" # Extract the first word of "echo", so it can be a program name with args. set dummy echo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ECHO+:} false; then : $as_echo_n "(cached) " >&6 else case $ECHO in [\\/]* | ?:[\\/]*) ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ECHO="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ECHO=$ac_cv_path_ECHO if test -n "$ECHO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5 $as_echo "$ECHO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "test", so it can be a program name with args. set dummy test; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_TEST+:} false; then : $as_echo_n "(cached) " >&6 else case $TEST in [\\/]* | ?:[\\/]*) ac_cv_path_TEST="$TEST" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_TEST="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi TEST=$ac_cv_path_TEST if test -n "$TEST"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST" >&5 $as_echo "$TEST" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_RM+:} false; then : $as_echo_n "(cached) " >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 $as_echo "$RM" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "rpm", so it can be a program name with args. set dummy rpm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_RPM+:} false; then : $as_echo_n "(cached) " >&6 else case $RPM in [\\/]* | ?:[\\/]*) ac_cv_path_RPM="$RPM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RPM="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RPM=$ac_cv_path_RPM if test -n "$RPM"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPM" >&5 $as_echo "$RPM" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "rpmbuild", so it can be a program name with args. set dummy rpmbuild; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_RPMBUILD+:} false; then : $as_echo_n "(cached) " >&6 else case $RPMBUILD in [\\/]* | ?:[\\/]*) ac_cv_path_RPMBUILD="$RPMBUILD" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RPMBUILD="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RPMBUILD=$ac_cv_path_RPMBUILD if test -n "$RPMBUILD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPMBUILD" >&5 $as_echo "$RPMBUILD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SWIG+:} false; then : $as_echo_n "(cached) " >&6 else case $SWIG in [\\/]* | ?:[\\/]*) ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi SWIG=$ac_cv_path_SWIG if test -n "$SWIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 $as_echo "$SWIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check for additional programs # We don't need c++ right now. #AC_PROG_CXX ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Modern libtool prefers LT_INIT over AC_PROG_RABLIB #AC_PROG_RANLIB case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\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/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done enable_dlopen=yes # Supposedly this helps OS X compiling $as_echo "#define _DARWIN_C_SOURCE 1" >>confdefs.h HAVE_DEBIAN="false" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if debian-system is used" >&5 $as_echo_n "checking if debian-system is used... " >&6; } # Check whether --enable-debian was given. if test "${enable_debian+set}" = set; then : enableval=$enable_debian; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes" ; then HAVE_DEBIAN="true" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 $as_echo "no (default)" >&6; } fi if test "${HAVE_DEBIAN}" = "true"; then HAVE_DEBIAN_TRUE= HAVE_DEBIAN_FALSE='#' else HAVE_DEBIAN_TRUE='#' HAVE_DEBIAN_FALSE= fi HAVE_DARWIN="false" HAVE_CYGWIN="false" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special host" >&5 $as_echo_n "checking for special host... " >&6; } case "$host" in *-*-cygwin*) HAVE_CYGWIN="true" CFLAGS="$CFLAGS -mwin32 -g" { $as_echo "$as_me:${as_lineno-$LINENO}: result: Cygwin" >&5 $as_echo "Cygwin" >&6; } ;; *-darwin*) HAVE_DARWIN="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5 $as_echo "Darwin" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Other host" >&5 $as_echo "Other host" >&6; } ;; esac if test "${HAVE_DARWIN}" = "true"; then HAVE_DARWIN_TRUE= HAVE_DARWIN_FALSE='#' else HAVE_DARWIN_TRUE='#' HAVE_DARWIN_FALSE= fi if test "${HAVE_CYGWIN}" = "true"; then HAVE_CYGWIN_TRUE= HAVE_CYGWIN_FALSE='#' else HAVE_CYGWIN_TRUE='#' HAVE_CYGWIN_FALSE= fi PIC_FLAGS="" if test "$lt_prog_compiler_pic_works" = yes; then PIC_FLAGS="$lt_prog_compiler_pic" fi # Make sure tclConfig.sh is found under /usr/lib64/ # Should perhaps support cross-compiling to other cpu-type too? LIBPOSTFIX= case "${host_os}" in *linux* ) case "${host_cpu}" in powerpc64 | s390x | x86_64 ) LIBPOSTFIX="64" CFLAGS="$CFLAGS -m64" ;; esac ;; esac if test "$cross_compiling" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports nested functions" >&5 $as_echo_n "checking if compiler supports nested functions... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ f(void (*nested)()) { (*nested)(); } main() { int a = 0; void nested() { a = 1; } f(nested); if(a != 1) exit(1); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$CFLAGS -DNO_NESTED_FUNCTIONS" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi OWFSROOT="`pwd`" # Checks for header files. ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in asm/types.h arpa/inet.h sys/ioctl.h sys/mkdev.h sys/socket.h sys/time.h sys/times.h sys/types.h sys/uio.h feature_tests.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/file.h syslog.h termios.h unistd.h limits.h stdint.h features.h getopt.h resolv.h semaphore.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in linux/limits.h linux/types.h netdb.h dlfcn.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Test if debugging out enabled ENABLE_DEBUG="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if debug-output is enabled" >&5 $as_echo_n "checking if debug-output is enabled... " >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_DEBUG="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_DEBUG}" = "true"; then ENABLE_DEBUG_TRUE= ENABLE_DEBUG_FALSE='#' else ENABLE_DEBUG_TRUE='#' ENABLE_DEBUG_FALSE= fi # Test if OWSHELL should be supported ENABLE_OWSHELL="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OWSHELL support is enabled" >&5 $as_echo_n "checking if OWSHELL support is enabled... " >&6; } # Check whether --enable-owshell was given. if test "${enable_owshell+set}" = set; then : enableval=$enable_owshell; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_OWSHELL="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWSHELL}" = "true"; then ENABLE_OWSHELL_TRUE= ENABLE_OWSHELL_FALSE='#' else ENABLE_OWSHELL_TRUE='#' ENABLE_OWSHELL_FALSE= fi # Test if OWLIB should be supported ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OWLIB support is enabled" >&5 $as_echo_n "checking if OWLIB support is enabled... " >&6; } # Check whether --enable-owlib was given. if test "${enable_owlib+set}" = set; then : enableval=$enable_owlib; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_OWLIB="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWLIB}" = "true"; then ENABLE_OWLIB_TRUE= ENABLE_OWLIB_FALSE='#' else ENABLE_OWLIB_TRUE='#' ENABLE_OWLIB_FALSE= fi # Test if OWNETLIB should be supported ENABLE_OWNETLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OWNETLIB support is enabled" >&5 $as_echo_n "checking if OWNETLIB support is enabled... " >&6; } # Check whether --enable-ownetlib was given. if test "${enable_ownetlib+set}" = set; then : enableval=$enable_ownetlib; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_OWNETLIB="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWNETLIB}" = "true"; then ENABLE_OWNETLIB_TRUE= ENABLE_OWNETLIB_FALSE='#' else ENABLE_OWNETLIB_TRUE='#' ENABLE_OWNETLIB_FALSE= fi # Test if TAI8570 barometer should be supported ENABLE_TAI8570="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if TAI8570 barometer support is enabled" >&5 $as_echo_n "checking if TAI8570 barometer support is enabled... " >&6; } # Check whether --enable-tai8570 was given. if test "${enable_tai8570+set}" = set; then : enableval=$enable_tai8570; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_TAI8570="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_TAI8570}" = "true"; then ENABLE_TAI8570_TRUE= ENABLE_TAI8570_FALSE='#' else ENABLE_TAI8570_TRUE='#' ENABLE_TAI8570_FALSE= fi # Test if thermocouples should be supported ENABLE_THERMOCOUPLE="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if thermocouple support is enabled" >&5 $as_echo_n "checking if thermocouple support is enabled... " >&6; } # Check whether --enable-thermocouple was given. if test "${enable_thermocouple+set}" = set; then : enableval=$enable_thermocouple; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_THERMOCOUPLE="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_THERMOCOUPLE}" = "true"; then ENABLE_THERMOCOUPLE_TRUE= ENABLE_THERMOCOUPLE_FALSE='#' else ENABLE_THERMOCOUPLE_TRUE='#' ENABLE_THERMOCOUPLE_FALSE= fi # Check for threading ENABLE_MT="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if multithreading is enabled" >&5 $as_echo_n "checking if multithreading is enabled... " >&6; } # Check whether --enable-mt was given. if test "${enable_mt+set}" = set; then : enableval=$enable_mt; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_MT="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_MT}" = "true" ; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_acx_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 $as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else acx_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$acx_pthread_ok" = "yes"; then #CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # can't set pthread flags for all compilations, since owshell doesn't need it. if test "$cross_compiling" = yes; then # We need to link libow.so with -lpthread on some cross-platforms # since owtcl.so doesn't work otherwise. -pthread is not enough if test x"$PTHREAD_LIBS" = x -a "x$PTHREAD_CFLAGS" = "x-pthread"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: add -lpthread to PTHREAD_LIBS" >&5 $as_echo "add -lpthread to PTHREAD_LIBS" >&6; } PTHREAD_LIBS="-lpthread" fi fi ENABLE_MT="true" else ENABLE_MT="false" PTHREAD_CFLAGS="" PTHREAD_LIBS="" PTHREAD_CC="" fi fi if test "${ENABLE_MT}" = "true"; then ENABLE_MT_TRUE= ENABLE_MT_FALSE='#' else ENABLE_MT_TRUE='#' ENABLE_MT_FALSE= fi # Check for i2c support ENABLE_I2C="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if i2c(DS2482-x00) is enabled" >&5 $as_echo_n "checking if i2c(DS2482-x00) is enabled... " >&6; } # Check whether --enable-i2c was given. if test "${enable_i2c+set}" = set; then : enableval=$enable_i2c; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_I2C="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_I2C}" = "true"; then ENABLE_I2C_TRUE= ENABLE_I2C_FALSE='#' else ENABLE_I2C_TRUE='#' ENABLE_I2C_FALSE= fi # Check for HA7Net ENABLE_HA7="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if HA7Net is enabled" >&5 $as_echo_n "checking if HA7Net is enabled... " >&6; } # Check whether --enable-ha7 was given. if test "${enable_ha7+set}" = set; then : enableval=$enable_ha7; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_HA7="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_HA7}" = "true"; then ENABLE_HA7_TRUE= ENABLE_HA7_FALSE='#' else ENABLE_HA7_TRUE='#' ENABLE_HA7_FALSE= fi # Check for W1 (linux kernel module) ENABLE_W1="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if W1 is enabled" >&5 $as_echo_n "checking if W1 is enabled... " >&6; } # Check whether --enable-w1 was given. if test "${enable_w1+set}" = set; then : enableval=$enable_w1; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_W1="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_W1}" = "true"; then ENABLE_W1_TRUE= ENABLE_W1_FALSE='#' else ENABLE_W1_TRUE='#' ENABLE_W1_FALSE= fi # Check if the modules are enabled #Check owhttpd ENABLE_OWHTTPD="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owhttpd is enabled" >&5 $as_echo_n "checking if owhttpd is enabled... " >&6; } # Check whether --enable-owhttpd was given. if test "${enable_owhttpd+set}" = set; then : enableval=$enable_owhttpd; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWHTTPD="false" else ENABLE_OWLIB="true" fi else ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWHTTPD}" = "true"; then ENABLE_OWHTTPD_TRUE= ENABLE_OWHTTPD_FALSE='#' else ENABLE_OWHTTPD_TRUE='#' ENABLE_OWHTTPD_FALSE= fi #Check owftpd ENABLE_OWFTPD="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owftpd is enabled" >&5 $as_echo_n "checking if owftpd is enabled... " >&6; } # Check whether --enable-owftpd was given. if test "${enable_owftpd+set}" = set; then : enableval=$enable_owftpd; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWFTPD="false" else # if test ! "${ENABLE_MT}" = "true" ; then # AC_MSG_ERROR([owftpd needs multithreading]) # fi ENABLE_OWLIB="true" fi else if test "${ENABLE_MT}" = "true" ; then ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } else ENABLE_OWFTPD="false" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (multithreading needed)" >&5 $as_echo "no (multithreading needed)" >&6; } fi fi if test "${ENABLE_OWFTPD}" = "true"; then ENABLE_OWFTPD_TRUE= ENABLE_OWFTPD_FALSE='#' else ENABLE_OWFTPD_TRUE='#' ENABLE_OWFTPD_FALSE= fi #Check owserver { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owserver is enabled" >&5 $as_echo_n "checking if owserver is enabled... " >&6; } ENABLE_OWSERVER="true" # Check whether --enable-owserver was given. if test "${enable_owserver+set}" = set; then : enableval=$enable_owserver; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWSERVER="false" else ENABLE_OWLIB="true" fi else ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWSERVER}" = "true"; then ENABLE_OWSERVER_TRUE= ENABLE_OWSERVER_FALSE='#' else ENABLE_OWSERVER_TRUE='#' ENABLE_OWSERVER_FALSE= fi #Check owexternal { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owexternal is enabled" >&5 $as_echo_n "checking if owexternal is enabled... " >&6; } ENABLE_OWEXTERNAL="true" # Check whether --enable-owexternal was given. if test "${enable_owexternal+set}" = set; then : enableval=$enable_owexternal; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWEXTERNAL="false" else ENABLE_OWLIB="true" fi else ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWEXTERNAL}" = "true"; then ENABLE_OWEXTERNAL_TRUE= ENABLE_OWEXTERNAL_FALSE='#' else ENABLE_OWEXTERNAL_TRUE='#' ENABLE_OWEXTERNAL_FALSE= fi #Check ownet ENABLE_OWNET="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ownet is enabled" >&5 $as_echo_n "checking if ownet is enabled... " >&6; } # Check whether --enable-ownet was given. if test "${enable_ownet+set}" = set; then : enableval=$enable_ownet; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWNET="false" else ENABLE_OWLIB="true" fi else ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWNET}" = "true"; then ENABLE_OWNET_TRUE= ENABLE_OWNET_FALSE='#' else ENABLE_OWNET_TRUE='#' ENABLE_OWNET_FALSE= fi #Check owtap ENABLE_OWTAP="true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owtap is enabled" >&5 $as_echo_n "checking if owtap is enabled... " >&6; } # Check whether --enable-owtap was given. if test "${enable_owtap+set}" = set; then : enableval=$enable_owtap; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWTAP="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWTAP}" = "true"; then ENABLE_OWTAP_TRUE= ENABLE_OWTAP_FALSE='#' else ENABLE_OWTAP_TRUE='#' ENABLE_OWTAP_FALSE= fi #Check owmalloc (special memory allocation routines) ENABLE_OWMALLOC="false" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owmalloc is enabled" >&5 $as_echo_n "checking if owmalloc is enabled... " >&6; } # Check whether --enable-owmalloc was given. if test "${enable_owmalloc+set}" = set; then : enableval=$enable_owmalloc; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes" ; then ENABLE_OWMALLOC="true" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 $as_echo "no (default)" >&6; } fi if test "${ENABLE_OWMALLOC}" = "true"; then ENABLE_OWMALLOC_TRUE= ENABLE_OWMALLOC_FALSE='#' else ENABLE_OWMALLOC_TRUE='#' ENABLE_OWMALLOC_FALSE= fi #Check for all bus traffic being reported ENABLE_TRAFFIC="false" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if bus traffic reports is enabled" >&5 $as_echo_n "checking if bus traffic reports is enabled... " >&6; } # Check whether --enable-owtraffic was given. if test "${enable_owtraffic+set}" = set; then : enableval=$enable_owtraffic; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes" ; then ENABLE_TRAFFIC="true" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 $as_echo "no (default)" >&6; } fi if test "${ENABLE_TRAFFIC}" = "true"; then ENABLE_TRAFFIC_TRUE= ENABLE_TRAFFIC_FALSE='#' else ENABLE_TRAFFIC_TRUE='#' ENABLE_TRAFFIC_FALSE= fi #Check owmon { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owmon is enabled" >&5 $as_echo_n "checking if owmon is enabled... " >&6; } ENABLE_OWMON="true" # Check whether --enable-owmon was given. if test "${enable_owmon+set}" = set; then : enableval=$enable_owmon; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWMON="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWMON}" = "true"; then ENABLE_OWMON_TRUE= ENABLE_OWMON_FALSE='#' else ENABLE_OWMON_TRUE='#' ENABLE_OWMON_FALSE= fi #Check owcapi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owcapi is enabled" >&5 $as_echo_n "checking if owcapi is enabled... " >&6; } ENABLE_OWCAPI="true" # Check whether --enable-owcapi was given. if test "${enable_owcapi+set}" = set; then : enableval=$enable_owcapi; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWCAPI="false" else ENABLE_OWLIB="true" fi else ENABLE_OWLIB="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWCAPI}" = "true"; then ENABLE_OWCAPI_TRUE= ENABLE_OWCAPI_FALSE='#' else ENABLE_OWCAPI_TRUE='#' ENABLE_OWCAPI_FALSE= fi #Check swig { $as_echo "$as_me:${as_lineno-$LINENO}: checking if swig is enabled" >&5 $as_echo_n "checking if swig is enabled... " >&6; } if test -z "$SWIG" ; then ENABLE_SWIG="false" else ENABLE_SWIG="auto" fi # Check whether --enable-swig was given. if test "${enable_swig+set}" = set; then : enableval=$enable_swig; if test "$enableval" = "no"; then ENABLE_SWIG="false" SWIG="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else if test -z "$SWIG"; then as_fn_error $? "Swig is not found and could not be enabled" "$LINENO" 5 fi ENABLE_OWLIB="true" ENABLE_SWIG="true" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto (default)" >&5 $as_echo "auto (default)" >&6; } fi if test "${HAVE_CYGWIN}" = "true"; then if test ! "$ENABLE_SWIG" = "true"; then ENABLE_SWIG="false" SWIG="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: (Disable swig by default in Cygwin)" >&5 $as_echo "(Disable swig by default in Cygwin)" >&6; } fi else if test "$ENABLE_SWIG" = "auto"; then ENABLE_SWIG="true" fi fi if test "${ENABLE_SWIG}" = "true"; then ENABLE_SWIG_TRUE= ENABLE_SWIG_FALSE='#' else ENABLE_SWIG_TRUE='#' ENABLE_SWIG_FALSE= fi #Check owperl { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owperl is enabled" >&5 $as_echo_n "checking if owperl is enabled... " >&6; } ENABLE_OWPERL="true" # Check whether --enable-owperl was given. if test "${enable_owperl+set}" = set; then : enableval=$enable_owperl; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_OWPERL="false" else if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&5 $as_echo "$as_me: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPERL is disabled because swig is not found" >&5 $as_echo "$as_me: WARNING: OWPERL is disabled because swig is not found" >&2;} ENABLE_OWPERL="false" fi fi else if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (swig disabled)" >&5 $as_echo "no (swig disabled)" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi fi PERL="" if test "${ENABLE_OWPERL}" = "true"; then #---------------------------------------------------------------- # Look for Perl5 # $Id: perl5.m4,v 1.6 2008/09/28 07:31:01 d1mag Exp $ #---------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Looking for location of Perl executable" >&5 $as_echo "Looking for location of Perl executable" >&6; } PERLBIN= # Check whether --with-perl5 was given. if test "${with_perl5+set}" = set; then : withval=$with_perl5; PERLBIN="$withval" else PERLBIN=yes fi # First, check for "--without-perl5" or "--with-perl5=no". if test x"${PERLBIN}" = xno -o x"${with_alllang}" = xno ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Perl5" >&5 $as_echo "$as_me: Disabling Perl5" >&6;} else # First figure out what the name of Perl5 is if test "x$PERLBIN" = xyes; then for ac_prog in perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PERL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PERL="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PERL=$ac_cv_prog_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PERL" && break done else PERL="$PERLBIN" fi # This could probably be simplified as for all platforms and all versions of Perl the following apparently should be run to get the compilation options: # perl -MExtUtils::Embed -e ccopts { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 header files" >&5 $as_echo_n "checking for Perl5 header files... " >&6; } if test -n "$PERL"; then PERL=`(which $PERL) 2>/dev/null` # Make it possible to force a directory during cross-compilation if test -z "$PERL5DIR"; then PERL5DIR=`($PERL -e 'use Config; print $Config{archlib}, "\n";') 2>/dev/null` fi if test -n "$PERL5DIR"; then dirs="$PERL5DIR $PERL5DIR/CORE" PERL5EXT=none for i in $dirs; do if test -r $i/perl.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i" >&5 $as_echo "$i" >&6; } PERL5EXT="$i" break; fi done if test "$PERL5EXT" = none; then PERL5EXT="$PERL5DIR/CORE" { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not locate perl.h...using $PERL5EXT" >&5 $as_echo "could not locate perl.h...using $PERL5EXT" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 library" >&5 $as_echo_n "checking for Perl5 library... " >&6; } PERL5NAME=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_, "\n"') 2>/dev/null` if test "$PERL5NAME" = "" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5NAME" >&5 $as_echo "$PERL5NAME" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 compiler options" >&5 $as_echo_n "checking for Perl5 compiler options... " >&6; } PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-I/$ISYSTEM/") 2>/dev/null` if test "$PERL5CCFLAGS" = "" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5CCFLAGS" >&5 $as_echo "$PERL5CCFLAGS" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to determine perl5 configuration" >&5 $as_echo "unable to determine perl5 configuration" >&6; } PERL5EXT=$PERL5DIR fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not figure out how to run perl5" >&5 $as_echo "could not figure out how to run perl5" >&6; } fi # Cygwin (Windows) needs the library for dynamic linking case $host in *-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5NAME";; *)PERL5DYNAMICLINKING="";; esac fi if test -z "${PERL}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find perl binary." >&5 $as_echo "$as_me: WARNING: Cannot find perl binary." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPERL is disabled because perl binary is not found" >&5 $as_echo "$as_me: WARNING: OWPERL is disabled because perl binary is not found" >&2;} ENABLE_OWPERL="false" else if test -z "${PERL5NAME}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find perl library. Install perl-devel package." >&5 $as_echo "$as_me: WARNING: Cannot find perl library. Install perl-devel package." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPERL is disabled because perl library is not found" >&5 $as_echo "$as_me: WARNING: OWPERL is disabled because perl library is not found" >&2;} ENABLE_OWPERL="false" fi fi fi if test "${ENABLE_OWPERL}" = "true"; then ENABLE_OWPERL_TRUE= ENABLE_OWPERL_FALSE='#' else ENABLE_OWPERL_TRUE='#' ENABLE_OWPERL_FALSE= fi if test -z "$PERL" ; then ENABLE_PERL="false" else ENABLE_PERL="true" fi if test "${ENABLE_PERL}" = "true"; then ENABLE_PERL_TRUE= ENABLE_PERL_FALSE='#' else ENABLE_PERL_TRUE='#' ENABLE_PERL_FALSE= fi #Check owphp { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owphp is enabled" >&5 $as_echo_n "checking if owphp is enabled... " >&6; } ENABLE_OWPHP="true" # Check whether --enable-owphp was given. if test "${enable_owphp+set}" = set; then : enableval=$enable_owphp; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "no" ; then ENABLE_OWPHP="false" fi if test "$enableval" = "yes" ; then ENABLE_OWPHP="true" fi if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&5 $as_echo "$as_me: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPHP is disabled because swig is not found" >&5 $as_echo "$as_me: WARNING: OWPHP is disabled because swig is not found" >&2;} ENABLE_OWPHP="false" fi else if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (swig disabled)" >&5 $as_echo "no (swig disabled)" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi fi PHP="" if test "${ENABLE_OWPHP}" = "true" ; then #------------------------------------------------------------------------- # Look for Php5 or Php4 #------------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Looking for location of Php executable" >&5 $as_echo "Looking for location of Php executable" >&6; } PHP4BIN= #AC_ARG_WITH(php4, AS_HELP_STRING([--without-php4], [Disable PHP4]) #AS_HELP_STRING([--with-php4=path], [Set location of PHP4 executable]),[ PHP4BIN="$withval"], [PHP4BIN=yes]) # Check whether --with-php was given. if test "${with_php+set}" = set; then : withval=$with_php; PHPBIN="$withval" else PHPBIN=yes fi # Check whether --with-phpconfig was given. if test "${with_phpconfig+set}" = set; then : withval=$with_phpconfig; PHPCONFIGBIN="$withval" else PHPCONFIGBIN=yes fi # First, check for "--without-php" or "--with-php=no". if test x"${PHPBIN}" = xno -o x"${with_alllang}" = xno ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling PHP" >&5 $as_echo "$as_me: Disabling PHP" >&6;} else if test "x$PHPBIN" = xyes; then for ac_prog in php php5 php4 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PHP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PHP"; then ac_cv_prog_PHP="$PHP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PHP="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PHP=$ac_cv_prog_PHP if test -n "$PHP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHP" >&5 $as_echo "$PHP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PHP" && break done else PHP="$PHPBIN" fi if test "x$PHPCONFIGBIN" = xyes; then for ac_prog in php-config php5-config php-config5 php4-config php-config4 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PHPCONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PHPCONFIG"; then ac_cv_prog_PHPCONFIG="$PHPCONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PHPCONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PHPCONFIG=$ac_cv_prog_PHPCONFIG if test -n "$PHPCONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHPCONFIG" >&5 $as_echo "$PHPCONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PHPCONFIG" && break done else PHPCONFIG="$PHPCONFIGBIN" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PHP header files" >&5 $as_echo_n "checking for PHP header files... " >&6; } PHPINC="`$PHPCONFIG --includes 2>/dev/null`" if test "$PHPINC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHPINC" >&5 $as_echo "$PHPINC" >&6; } else dirs="/usr/include/php /usr/local/include/php /usr/include/php5 /usr/local/include/php5 /usr/include/php4 /usr/local/include/php4 /usr/local/apache/php" for i in $dirs; do echo $i if test -r $i/main/php_config.h -o -r $i/main/php_version.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i is found" >&5 $as_echo "$i is found" >&6; } PHPEXT="$i" PHPINC="-I$PHPEXT -I$PHPEXT/main -I$PHPEXT/TSRM -I$PHPEXT/Zend" break; fi done fi if test -z "$PHPINC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PHP extension-dir" >&5 $as_echo_n "checking for PHP extension-dir... " >&6; } PHPLIBDIR="`$PHPCONFIG --extension-dir 2>/dev/null`" if test ! -z "$PHPLIBDIR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHPLIBDIR" >&5 $as_echo "$PHPLIBDIR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi fi if test -z "${PHP}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find php binary. Install php or php5 package" >&5 $as_echo "$as_me: WARNING: Cannot find php binary. Install php or php5 package" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPHP is disabled because php binary is not found" >&5 $as_echo "$as_me: WARNING: OWPHP is disabled because php binary is not found" >&2;} ENABLE_OWPHP="false" else if test -z "${PHPCONFIG}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find php-config binary. Install php-devel or php5-dev package" >&5 $as_echo "$as_me: WARNING: Cannot find php-config binary. Install php-devel or php5-dev package" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: include and library paths will be guessed" >&5 $as_echo "$as_me: WARNING: include and library paths will be guessed" >&2;} fi if test -z "${PHPINC}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find php include-file. Install php-devel or php5-dev package" >&5 $as_echo "$as_me: WARNING: Cannot find php include-file. Install php-devel or php5-dev package" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPHP is disabled because php include-file is not found" >&5 $as_echo "$as_me: WARNING: OWPHP is disabled because php include-file is not found" >&2;} ENABLE_OWPHP="false" else if test -z "${PHPLIBDIR}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find php extension-dir. Install php-devel or php5-dev package" >&5 $as_echo "$as_me: WARNING: Cannot find php extension-dir. Install php-devel or php5-dev package" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPHP is disabled because php extension-dir is not found" >&5 $as_echo "$as_me: WARNING: OWPHP is disabled because php extension-dir is not found" >&2;} ENABLE_OWPHP="false" fi fi fi fi if test "${ENABLE_OWPHP}" = "true"; then ENABLE_OWPHP_TRUE= ENABLE_OWPHP_FALSE='#' else ENABLE_OWPHP_TRUE='#' ENABLE_OWPHP_FALSE= fi if test -z "$PHP" ; then ENABLE_PHP="false" else ENABLE_PHP="true" fi if test "${ENABLE_PHP}" = "true"; then ENABLE_PHP_TRUE= ENABLE_PHP_FALSE='#' else ENABLE_PHP_TRUE='#' ENABLE_PHP_FALSE= fi #Check owpython { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owpython is enabled" >&5 $as_echo_n "checking if owpython is enabled... " >&6; } ENABLE_OWPYTHON="true" # Check whether --enable-owpython was given. if test "${enable_owpython+set}" = set; then : enableval=$enable_owpython; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "no" ; then ENABLE_OWPYTHON="false" fi if test "$enableval" = "yes" ; then ENABLE_OWPYTHON="true" if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&5 $as_echo "$as_me: WARNING: Cannot find swig program. Look for it at http://www.swig.org or use CPAN" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPYTHON is disabled because swig is not found" >&5 $as_echo "$as_me: WARNING: OWPYTHON is disabled because swig is not found" >&2;} ENABLE_OWPYTHON="false" fi fi else if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (swig disabled)" >&5 $as_echo "no (swig disabled)" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi fi PYTHON="" if test "${ENABLE_OWPYTHON}" = "true" ; then #------------------------------------------------------------------------ # SC_PATH_PYTHONCONFIG -- # # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-pythonconfig=... # --with-python=... # # Defines the following vars: # #------------------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Looking for location of Python executable" >&5 $as_echo "Looking for location of Python executable" >&6; } #---------------------------------------------------------------- # Look for Python #---------------------------------------------------------------- PYCFLAGS= PYLDFLAGS= PYLIB= PYVERSION= PYSITEDIR= # Check whether --with-python was given. if test "${with_python+set}" = set; then : withval=$with_python; PYBIN="$withval" else PYBIN=yes fi # Check whether --with-pythonconfig was given. if test "${with_pythonconfig+set}" = set; then : withval=$with_pythonconfig; PYTHONCONFIGBIN="$withval" else PYTHONCONFIGBIN=yes fi if test "x$PYTHONCONFIGBIN" = xyes; then for ac_prog in python-config python2.5-config python2.4-config python2.3-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PYTHONCONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PYTHONCONFIG"; then ac_cv_prog_PYTHONCONFIG="$PYTHONCONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHONCONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHONCONFIG=$ac_cv_prog_PYTHONCONFIG if test -n "$PYTHONCONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONCONFIG" >&5 $as_echo "$PYTHONCONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PYTHONCONFIG" && break done else PYTHONCONFIG="$PYTHONCONFIGBIN" fi # First, check for "--without-python" or "--with-python=no". if test x"${PYBIN}" = xno -o x"${with_alllang}" = xno ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Python" >&5 $as_echo "$as_me: Disabling Python" >&6;} else # First figure out the name of the Python executable if test "x$PYBIN" = xyes; then for ac_prog in python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PYTHON" && break done else PYTHON="$PYBIN" fi if test ! -z "$PYTHONCONFIG"; then # python-config available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python cflags" >&5 $as_echo_n "checking for Python cflags... " >&6; } PYTHONCFLAGS="`$PYTHONCONFIG --cflags 2>/dev/null`" if test -z "$PYTHONCFLAGS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONCFLAGS" >&5 $as_echo "$PYTHONCFLAGS" >&6; } fi PYCFLAGS=$PYTHONCFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python ldflags" >&5 $as_echo_n "checking for Python ldflags... " >&6; } PYTHONLDFLAGS="`$PYTHONCONFIG --ldflags 2>/dev/null`" if test -z "$PYTHONLDFLAGS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONLDFLAGS" >&5 $as_echo "$PYTHONLDFLAGS" >&6; } fi PYLDFLAGS=$PYTHONLDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python libs" >&5 $as_echo_n "checking for Python libs... " >&6; } PYTHONLIBS="`$PYTHONCONFIG --libs 2>/dev/null`" if test -z "$PYTHONLIBS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONLIBS" >&5 $as_echo "$PYTHONLIBS" >&6; } fi PYLIB="$PYTHONLIBS" # Need to do this hack since autoconf replaces __file__ with the name of the configure file filehack="file__" PYVERSION=`($PYTHON -c "import string,operator,os.path; print operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1)")` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYVERSION" >&5 $as_echo "$PYVERSION" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python exec-prefix" >&5 $as_echo_n "checking for Python exec-prefix... " >&6; } PYTHONEPREFIX="`$PYTHONCONFIG --exec-prefix 2>/dev/null`" if test -z "$PYTHONEPREFIX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONEPREFIX" >&5 $as_echo "$PYTHONEPREFIX" >&6; } fi PYEPREFIX="$PYTHONEPREFIX" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-dir" >&5 $as_echo_n "checking for Python site-dir... " >&6; } #This seem to be the site-packages dir where files are installed. PYSITEDIR=`($PYTHON -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1)") 2>/dev/null` if test -z "$PYSITEDIR"; then # I'm not really sure if it should be installed at /usr/lib64... if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages" else if test -d "$PYEPREFIX/lib/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib/$PYVERSION/site-packages" fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYSITEDIR" >&5 $as_echo "$PYSITEDIR" >&6; } else # python-config not available. if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python prefix" >&5 $as_echo_n "checking for Python prefix... " >&6; } PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYPREFIX" >&5 $as_echo "$PYPREFIX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python exec-prefix" >&5 $as_echo_n "checking for Python exec-prefix... " >&6; } PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYEPREFIX" >&5 $as_echo "$PYEPREFIX" >&6; } # Note: I could not think of a standard way to get the version string from different versions. # This trick pulls it out of the file location for a standard library file. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python version" >&5 $as_echo_n "checking for Python version... " >&6; } # Need to do this hack since autoconf replaces __file__ with the name of the configure file filehack="file__" PYVERSION=`($PYTHON -c "import string,operator,os.path; print operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1)")` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYVERSION" >&5 $as_echo "$PYVERSION" >&6; } # Find the directory for libraries this is necessary to deal with # platforms that can have apps built for multiple archs: e.g. x86_64 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python lib dir" >&5 $as_echo_n "checking for Python lib dir... " >&6; } PYLIBDIR=`($PYTHON -c "import sys; print sys.lib") 2>/dev/null` if test -z "$PYLIBDIR"; then # older versions don't have sys.lib so the best we can do is assume lib #PYLIBDIR="lib$LIBPOSTFIX" if test -r $PYPREFIX/include/$PYVERSION/Python.h; then if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/config"; then PYLIBDIR="lib$LIBPOSTFIX" else if test -d "$PYEPREFIX/lib/$PYVERSION/config"; then # for some reason a 64bit system could have libs installed at lib PYLIBDIR="lib" else # I doubt this will work PYLIBDIR="lib$LIBPOSTFIX" fi fi else # probably very old installation... PYLIBDIR="lib" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLIBDIR" >&5 $as_echo "$PYLIBDIR" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-dir" >&5 $as_echo_n "checking for Python site-dir... " >&6; } PYSITEDIR=`($PYTHON -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1)") 2>/dev/null` if test -z "$PYSITEDIR"; then # I'm not really sure if it should be installed at /usr/lib64... if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages" else if test -d "$PYEPREFIX/lib/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib/$PYVERSION/site-packages" fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYSITEDIR" >&5 $as_echo "$PYSITEDIR" >&6; } # Set the include directory { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python header files" >&5 $as_echo_n "checking for Python header files... " >&6; } if test -r $PYPREFIX/include/$PYVERSION/Python.h; then PYCFLAGS="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/$PYLIBDIR/$PYVERSION/config" fi if test -z "$PYCFLAGS"; then if test -r $PYPREFIX/include/Py/Python.h; then PYCFLAGS="-I$PYPREFIX/include/Py -I$PYEPREFIX/$PYLIBDIR/python/lib" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYCFLAGS" >&5 $as_echo "$PYCFLAGS" >&6; } # Set the library directory blindly. This probably won't work with older versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library" >&5 $as_echo_n "checking for Python library... " >&6; } dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR" for i in $dirs; do if test -d $PYEPREFIX/$PYLIBDIR/$i; then PYLIB="$PYEPREFIX/$PYLIBDIR/$i" break fi done if test -z "$PYLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 $as_echo "Not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLIB" >&5 $as_echo "$PYLIB" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python LDFLAGS" >&5 $as_echo_n "checking for Python LDFLAGS... " >&6; } # Check for really old versions if test -r $PYLIB/libPython.a; then PYLINK="-lModules -lPython -lObjects -lParser" else if test ! -r $PYLIB/lib$PYVERSION.so -a -r $PYLIB/lib$PYVERSION.a ; then # python2.2 on FC1 need this PYLINK="$PYLIB/lib$PYVERSION.a" else PYLINK="-l$PYVERSION" fi fi PYLDFLAGS="$PYLINK" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLDFLAGS" >&5 $as_echo "$PYLDFLAGS" >&6; } fi fi # Cygwin (Windows) needs the library for dynamic linking case $host in *-*-cygwin* | *-*-mingw*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK" DEFS="-DUSE_DL_IMPORT $DEFS" PYCFLAGS="$PYCFLAGS" ;; *)PYTHONDYNAMICLINKING="";; esac fi if test -z "${PYTHON}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find python binary. Install python package." >&5 $as_echo "$as_me: WARNING: Cannot find python binary. Install python package." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPYTHON is disabled because python binary is not found" >&5 $as_echo "$as_me: WARNING: OWPYTHON is disabled because python binary is not found" >&2;} ENABLE_OWPYTHON="false" else if test -z "${PYLDFLAGS}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find python library. Install python-devel package." >&5 $as_echo "$as_me: WARNING: Cannot find python library. Install python-devel package." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPYTHON is disabled because python library is not found" >&5 $as_echo "$as_me: WARNING: OWPYTHON is disabled because python library is not found" >&2;} ENABLE_OWPYTHON="false" else if test -z "${PYCFLAGS}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find python include-file. Install python-devel package." >&5 $as_echo "$as_me: WARNING: Cannot find python include-file. Install python-devel package." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWPYTHON is disabled because python include-file is not found" >&5 $as_echo "$as_me: WARNING: OWPYTHON is disabled because python include-file is not found" >&2;} ENABLE_OWPYTHON="false" fi fi fi fi if test "${ENABLE_OWPYTHON}" = "true"; then ENABLE_OWPYTHON_TRUE= ENABLE_OWPYTHON_FALSE='#' else ENABLE_OWPYTHON_TRUE='#' ENABLE_OWPYTHON_FALSE= fi if test -z "$PYTHON" ; then ENABLE_PYTHON="false" else ENABLE_PYTHON="true" fi if test "${ENABLE_PYTHON}" = "true"; then ENABLE_PYTHON_TRUE= ENABLE_PYTHON_FALSE='#' else ENABLE_PYTHON_TRUE='#' ENABLE_PYTHON_FALSE= fi #Check owtcl { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owtcl is enabled" >&5 $as_echo_n "checking if owtcl is enabled... " >&6; } ENABLE_OWTCL="true" # Check whether --enable-owtcl was given. if test "${enable_owtcl+set}" = set; then : enableval=$enable_owtcl; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "no" ; then ENABLE_OWTCL="false" fi if test "$enableval" = "yes" ; then ENABLE_OWTCL="true" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_OWTCL}" = "true" ; then #------------------------------------------------------------------------ # SC_PATH_TCLCONFIG -- # # Locate the tclConfig.sh file and perform a sanity check on # the Tcl compile flags # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the directory containing # the tclConfig.sh file #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_PATH_TKCONFIG -- # # Locate the tkConfig.sh file # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tk=... # # Defines the following vars: # TK_BIN_DIR Full path to the directory containing # the tkConfig.sh file #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_LOAD_TCLCONFIG -- # # Load the tclConfig.sh file # # Arguments: # # Requires the following vars to be set: # TCL_BIN_DIR # # Results: # # Subst the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_LOAD_TKCONFIG -- # # Load the tkConfig.sh file # # Arguments: # # Requires the following vars to be set: # TK_BIN_DIR # # Results: # # Sets the following vars that should be in tkConfig.sh: # TK_BIN_DIR #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_ENABLE_SHARED -- # # Allows the building of shared libraries # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-shared=yes|no # # Defines the following vars: # STATIC_BUILD Used for building import/export libraries # on Windows. # # Sets the following vars: # SHARED_BUILD Value of 1 or 0 #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_ENABLE_FRAMEWORK -- # # Allows the building of shared libraries into frameworks # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-framework=yes|no # # Sets the following vars: # FRAMEWORK_BUILD Value of 1 or 0 #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_ENABLE_THREADS -- # # Specify if thread support should be enabled. TCL_THREADS is # checked so that if you are compiling an extension against a # threaded core, your extension must be compiled threaded as well. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-threads # # Sets the following vars: # THREADS_LIBS Thread library(s) # # Defines the following vars: # TCL_THREADS # _REENTRANT # _THREAD_SAFE # #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # # Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging # can also be enabled. # # Arguments: # none # # Requires the following vars to be set in the Makefile: # CFLAGS_DEBUG # CFLAGS_OPTIMIZE # LDFLAGS_DEBUG # LDFLAGS_OPTIMIZE # # Results: # # Adds the following arguments to configure: # --enable-symbols # # Defines the following vars: # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true # Sets to $(CFLAGS_OPTIMIZE) if false # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true # Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Debug library extension # #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_ENABLE_LANGINFO -- # # Allows use of modern nl_langinfo check for better l10n. # This is only relevant for Unix. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-langinfo=yes|no (default is yes) # # Defines the following vars: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. # #------------------------------------------------------------------------ #-------------------------------------------------------------------- # SC_CONFIG_MANPAGES # # Decide whether to use symlinks for linking the manpages, # whether to compress the manpages after installation, and # whether to add a package name suffix to the installed # manpages to avoidfile name clashes. # If compression is enabled also find out what file name suffix # the given compression program is using. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-man-symlinks # --enable-man-compression=PROG # --enable-man-suffix[=STRING] # # Defines the following variable: # # MAN_FLAGS - The apropriate flags for installManPage # according to the user's selection. # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_CONFIG_CFLAGS # # Try to determine the proper flags to pass to the compiler # for building shared libraries and other such nonsense. # # Arguments: # none # # Results: # # Defines and substitutes the following vars: # # DL_OBJS - Name of the object file that implements dynamic # loading for Tcl on this system. # DL_LIBS - Library file(s) to include in tclsh and other base # applications in order for the "load" command to work. # LDFLAGS - Flags to pass to the compiler when linking object # files into an executable application binary such # as tclsh. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. Could # be the same as CC_SEARCH_FLAGS if ${CC} is used to link. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. # MAKE_LIB - Command to execute to build the a library; # differs when building shared or static. # MAKE_STUB_LIB - # Command to execute to build a stub library. # INSTALL_LIB - Command to execute to install a library; # differs when building shared or static. # INSTALL_STUB_LIB - # Command to execute to install a stub library. # STLIB_LD - Base command to use for combining object files # into a static library. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components # of a shared library (may request position-independent # code, among other things). # SHLIB_LD - Base command to use for combining object files # into a shared library. # SHLIB_LD_FLAGS -Flags to pass when building a shared library. This # differes from the SHLIB_CFLAGS as it is not used # when building object files or executables. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build # shared libraries. The value of the symbol is # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on # SunOS 4.x, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the # tclConfig.sh, since they are only used for the build # of Tcl and Tk. # Examples: MacOS X records the library version and # compatibility version in the shared library. But # of course the Tcl version of this is only used for Tcl. # LIB_SUFFIX - Specifies everything that comes after the "libfoo" # in a static or shared library name, using the $VERSION variable # to put the version in the right place. This is used # by platforms that need non-standard library names. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs # to have a version after the .so, and ${VERSION}.a # on AIX, since a shared library needs to have # a .a extension whereas shared objects for loadable # extensions have a .so extension. Defaults to # ${VERSION}${SHLIB_SUFFIX}. # TCL_NEEDS_EXP_FILE - # 1 means that an export file is needed to link to a # shared library. # TCL_EXP_FILE - The name of the installed export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # TCL_BUILD_EXP_FILE - # The name of the built export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # CFLAGS_DEBUG - # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_SERIAL_PORT # # Determine which interface to use to talk to the serial port. # Note that #include lines must begin in leftmost column for # some compilers to recognize them as preprocessor directives, # and some build environments have stdin not pointing at a # pseudo-terminal (usually /dev/null instead.) # # Arguments: # none # # Results: # # Defines only one of the following vars: # HAVE_SYS_MODEM_H # USE_TERMIOS # USE_TERMIO # USE_SGTTY # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_MISSING_POSIX_HEADERS # # Supply substitutes for missing POSIX header files. Special # notes: # - stdlib.h doesn't define strtol, strtoul, or # strtod insome versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # # Arguments: # none # # Results: # # Defines some of the following vars: # NO_DIRENT_H # NO_ERRNO_H # NO_VALUES_H # HAVE_LIMITS_H or NO_LIMITS_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_UNISTD_H # HAVE_SYS_PARAM_H # # HAVE_STRING_H ? # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_PATH_X # # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. # # Arguments: # none # # Results: # # Sets the the following vars: # XINCLUDES # XLIBSW # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_BLOCKING_STYLE # # The statements below check for systems where POSIX-style # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. # On these systems (mostly older ones), use the old BSD-style # FIONBIO approach instead. # # Arguments: # none # # Results: # # Defines some of the following vars: # HAVE_SYS_IOCTL_H # HAVE_SYS_FILIO_H # USE_FIONBIO # O_NONBLOCK # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_TIME_HANLDER # # Checks how the system deals with time.h, what time structures # are used on the system, and what fields the structures have. # # Arguments: # none # # Results: # # Defines some of the following vars: # USE_DELTA_FOR_TZ # HAVE_TM_GMTOFF # HAVE_TM_TZADJ # HAVE_TIMEZONE_VAR # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_BUGGY_STRTOD # # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. # Also, on Compaq's Tru64 Unix 5.0, # strtod(" ") returns 0.0 instead of a failure to convert. # # Arguments: # none # # Results: # # Might defines some of the following vars: # strtod (=fixstrtod) # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. # -lnsl) are dealt with here. # # Arguments: # Requires the following vars to be set in the Makefile: # DL_LIBS # LIBS # MATH_LIBS # # Results: # # Subst's the following var: # TCL_LIBS # MATH_LIBS # # Might append to the following vars: # LIBS # # Might define the following vars: # HAVE_NET_ERRNO_H # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. # # Arguments: # None # # Results: # # Might define the following vars: # _ISOC99_SOURCE # _LARGEFILE64_SOURCE # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # SC_TCL_64BIT_FLAGS # # Check for what is defined in the way of 64-bit features. # # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE # HAVE_STRUCT_DIRENT64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Looking for tclConfig.sh" >&5 $as_echo "Looking for tclConfig.sh" >&6; } # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; with_tclconfig=${withval} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 $as_echo_n "checking for Tcl configuration... " >&6; } if ${ac_cv_c_tclconfig+:} false; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d ${libdir} 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib${LIBPOSTFIX} 2>/dev/null` \ ../../tcl \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[8-9].[0-9]* 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -dr /usr/lib/tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr /usr/lib/tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr /usr/lib/tcl[8-9].[0-9]* 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then # TCL_BIN_DIR="# no Tcl configs found" TCL_BIN_DIR="" { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find Tcl configuration definitions" >&5 $as_echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} # exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 $as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; } fi fi if test -z "$TCL_BIN_DIR" -o ! -f "$TCL_BIN_DIR/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWTCL is disabled because tclConfig.sh is not found" >&5 $as_echo "$as_me: WARNING: OWTCL is disabled because tclConfig.sh is not found" >&2;} ENABLE_OWTCL="false" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 $as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; } if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 $as_echo "loading" >&6; } . $TCL_BIN_DIR/tclConfig.sh else { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5 $as_echo "file not found" >&6; } fi # # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. # if test -f $TCL_BIN_DIR/Makefile ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" # guess that tcl will install the files under the first path in # TCL_PACKAGE_PATH. TCL_BIN_DIR is usually correct, but this # might contain staging_dir prefix when cross-compiling. OWTCL_INSTALL_PATH="`echo ${TCL_PACKAGE_PATH} | cut -d' ' -f1`" # Debian Hack: do not install in /usr/local/lib/tcltk # OWTCL_INSTALL_PATH="/usr/lib/tcltk" fi fi if test "${ENABLE_OWTCL}" = "true"; then ENABLE_OWTCL_TRUE= ENABLE_OWTCL_FALSE='#' else ENABLE_OWTCL_TRUE='#' ENABLE_OWTCL_FALSE= fi EXP_VAR=LIBDIR FROM_VAR=$libdir prefix_save=$prefix exec_prefix_save=$exec_prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done full_var=$new_full_var LIBDIR="$full_var" prefix=$prefix_save exec_prefix=$exec_prefix_save EXP_VAR=BINDIR FROM_VAR=$bindir prefix_save=$prefix exec_prefix_save=$exec_prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done full_var=$new_full_var BINDIR="$full_var" prefix=$prefix_save exec_prefix=$exec_prefix_save EXP_VAR=DATADIR FROM_VAR=$datadir prefix_save=$prefix exec_prefix_save=$exec_prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done full_var=$new_full_var DATADIR="$full_var" prefix=$prefix_save exec_prefix=$exec_prefix_save EXTRACFLAGS="-D_FILE_OFFSET_BITS=64" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cflag _XOPEN_SOURCE is required" >&5 $as_echo_n "checking if cflag _XOPEN_SOURCE is required... " >&6; } case "${host_cpu}-${host_os}" in *-aix* | *solaris* | *-osf* | *-hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500" EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=500" { $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_XOPEN_SOURCE=500" >&5 $as_echo "-D_XOPEN_SOURCE=500" >&6; } ;; *-darwin* | *-netbsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; *-freebsd* | *) # have to add this to support pthread_rwlock_t CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500" EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=500" { $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_XOPEN_SOURCE=500" >&5 $as_echo "-D_XOPEN_SOURCE=500" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cflag _BSD_SOURCE is required" >&5 $as_echo_n "checking if cflag _BSD_SOURCE is required... " >&6; } case "${host_cpu}-${host_os}" in *-netbsd*) CFLAGS="$CFLAGS -D_NETBSD_SOURCE=1" EXTRACFLAGS="$EXTRACFLAGS -D_NETBSD_SOURCE=1" { $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_NETBSD_SOURCE=1" >&5 $as_echo "-D_NETBSD_SOURCE=1" >&6; } ;; *) # have to add -D_BSD_SOURCE=1 to support major() in sys/sysmacros.h # have to add -D_ISOC99_SOURCE=1 to support lrint() in bits/mathcalls.h # have to add -D_POSIX_C_SOURCE=200112L for sem_timedwait # have to add -D_POSIX_C_SOURCE=199309L for clock_gettime() CFLAGS="$CFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" EXTRACFLAGS="$EXTRACFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" { $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" >&5 $as_echo "-D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" >&6; } ;; esac # should perhaps add _GNU_SOURCE=1 instead of the two defines above... # That would define _BSD_SOURCE, _SVID_SOURCE, _LARGEFILE64_SOURCE, # _XOPEN_SOURCE=600, _POSIX_C_SOURCE, _POSIX_SOURCE, _ISOC99_SOURCE # Check if extra libs are needed. Should perhaps test if they are available too # instead of hardcoding the libraries. EXTRALIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if extra libs are required" >&5 $as_echo_n "checking if extra libs are required... " >&6; } case "${host_cpu}-${host_os}" in *-darwin*) # This will actually be duplicates if libusb is used. OSLIBS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation" EXTRALIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OSLIBS}" >&5 $as_echo "${OSLIBS}" >&6; } ;; *-solaris*) OSLIBS="" EXTRALIBS=" -lsocket -lnsl " LIBS="$LIBS -lsocket -lnsl" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${EXTRALIBS}" >&5 $as_echo "${EXTRALIBS}" >&6; } ;; *) OSLIBS="" EXTRALIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${EXTRALIBS}" >&5 $as_echo "${EXTRALIBS}" >&6; } ;; esac #Check for profiling { $as_echo "$as_me:${as_lineno-$LINENO}: checking if profiling is enabled" >&5 $as_echo_n "checking if profiling is enabled... " >&6; } ENABLE_PROFILING="false" # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then : enableval=$enable_profiling; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes" ; then ENABLE_PROFILING=true EXTRALIBS="$EXTRALIBS -pg" EXTRACFLAGS="$EXTRACFLAGS -pg" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 $as_echo "no (default)" >&6; } fi if test "${ENABLE_PROFILING}" = "true"; then ENABLE_PROFILING_TRUE= ENABLE_PROFILING_FALSE='#' else ENABLE_PROFILING_TRUE='#' ENABLE_PROFILING_FALSE= fi EXP_VAR=LD_EXTRALIBS FROM_VAR=$EXTRALIBS prefix_save=$prefix exec_prefix_save=$exec_prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done full_var=$new_full_var LD_EXTRALIBS="$full_var" prefix=$prefix_save exec_prefix=$exec_prefix_save { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: LD_EXTRALIBS=${LD_EXTRALIBS} OSLIBS=${OSLIBS}" >&5 $as_echo "$as_me: WARNING: LD_EXTRALIBS=${LD_EXTRALIBS} OSLIBS=${OSLIBS}" >&2;} # Check whether --with-fuseinclude was given. if test "${with_fuseinclude+set}" = set; then : withval=$with_fuseinclude; fuse_include_path=$withval else fuse_include_path='/usr/local/include' fi # Check whether --with-fuselib was given. if test "${with_fuselib+set}" = set; then : withval=$with_fuselib; fuse_lib_path=$withval else fuse_lib_path='/usr/local/lib' fi #Check owfs { $as_echo "$as_me:${as_lineno-$LINENO}: checking if owfs is enabled" >&5 $as_echo_n "checking if owfs is enabled... " >&6; } ENABLE_OWFS="auto" # Check whether --enable-owfs was given. if test "${enable_owfs+set}" = set; then : enableval=$enable_owfs; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes" ; then ENABLE_OWFS="true" fi if test "$enableval" = "no" ; then ENABLE_OWFS="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto (default)" >&5 $as_echo "auto (default)" >&6; } fi # We need fuse only if OWFS is enabled if test "${ENABLE_OWFS}" != "false" ; then save_LD_EXTRALIBS="$LD_EXTRALIBS" save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" FUSE_FLAGS="-DFUSE_USE_VERSION=26" FUSE_INCLUDES="-I${fuse_include_path}" FUSE_LIBS="-L${fuse_lib_path}" LD_EXTRALIBS="$save_LD_EXTRALIBS " CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64 $FUSE_FLAGS $FUSE_INCLUDES" LDFLAGS="$save_LDFLAGS $FUSE_LIBS" ac_fn_c_check_header_mongrel "$LINENO" "fuse.h" "ac_cv_header_fuse_h" "$ac_includes_default" if test "x$ac_cv_header_fuse_h" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find fuse.h - Add the search path with --with-fuseinclude" >&5 $as_echo "$as_me: WARNING: Can't find fuse.h - Add the search path with --with-fuseinclude" >&2;} FUSE_FLAGS="" FUSE_INCLUDES="" FUSE_LIBS="" LD_EXTRALIBS="$save_LD_EXTRALIBS" CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64" LDFLAGS="$save_LDFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Install FUSE-2.2 or later to enable owfs - download it from http://fuse.sourceforge.net/" >&5 $as_echo "$as_me: WARNING: Install FUSE-2.2 or later to enable owfs - download it from http://fuse.sourceforge.net/" >&2;} if test "${ENABLE_OWFS}" = "auto"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWFS is disabled because fuse.h is not found." >&5 $as_echo "$as_me: WARNING: OWFS is disabled because fuse.h is not found." >&2;} ENABLE_OWFS="false" else as_fn_error $? "Configure without --enable-owfs to detect fuse automatically." "$LINENO" 5 fi fi if test "${ENABLE_OWFS}" != "false"; then save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$LIBS $PTHREAD_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fuse_main in -lfuse" >&5 $as_echo_n "checking for fuse_main in -lfuse... " >&6; } if ${ac_cv_lib_fuse_fuse_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfuse $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fuse_main (); int main () { return fuse_main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_fuse_fuse_main=yes else ac_cv_lib_fuse_fuse_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fuse_fuse_main" >&5 $as_echo "$ac_cv_lib_fuse_fuse_main" >&6; } if test "x$ac_cv_lib_fuse_fuse_main" = xyes; then : FUSE_LIBS="$FUSE_LIBS -lfuse" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find libfuse.a - add the search path with --with-fuselib" >&5 $as_echo "$as_me: WARNING: Can't find libfuse.a - add the search path with --with-fuselib" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Running ldconfig or adding \"/usr/local/lib\" to /etc/ld.so.conf might also solve the problem, otherwise re-install fuse." >&5 $as_echo "$as_me: WARNING: Running ldconfig or adding \"/usr/local/lib\" to /etc/ld.so.conf might also solve the problem, otherwise re-install fuse." >&2;} if test "${ENABLE_OWFS}" = "auto"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWFS is disabled because libfuse.a is not found." >&5 $as_echo "$as_me: WARNING: OWFS is disabled because libfuse.a is not found." >&2;} ENABLE_OWFS="false" else as_fn_error $? "Can't enable OWFS" "$LINENO" 5 fi fi CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" fi if test "${ENABLE_OWFS}" != "false"; then # check for a supported FUSE_MAJOR_VERSION. { $as_echo "$as_me:${as_lineno-$LINENO}: checking For supported FUSE API version" >&5 $as_echo_n "checking For supported FUSE API version... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef FUSE_MAJOR_VERSION #error "FUSE_MAJOR_VERSION not defined" #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: OWFS is disabled since fuse.h is too old" >&5 $as_echo "$as_me: WARNING: OWFS is disabled since fuse.h is too old" >&2;} if test "${ENABLE_OWFS}" = "true"; then as_fn_error $? "You have to install fuse first (fuse-2.2 or later recommended) - download it from http://fuse.sourceforge.net/" "$LINENO" 5 else ENABLE_OWFS="false" fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # Use newest FUSE API if version is newer than 2.2 if test "${ENABLE_OWFS}" != "false"; then # check for a supported FUSE_MAJOR_VERSION. { $as_echo "$as_me:${as_lineno-$LINENO}: checking For FUSE version " >&5 $as_echo_n "checking For FUSE version ... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef FUSE_VERSION #ifndef FUSE_MAJOR_VERSION #define FUSE_VERSION 11 #else /* FUSE_MAJOR_VERSION */ #undef FUSE_MAKE_VERSION #define FUSE_MAKE_VERSION(maj,min) ((maj) * 10 + (min)) #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION,FUSE_MINOR_VERSION) #endif /* FUSE_MAJOR_VERSION */ #endif /* FUSE_VERSION */ #if (FUSE_VERSION >= 22) /* Fuse > 2.2 is ok */ #else #error "Fuse < 2.2" #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: 2.2 or later" >&5 $as_echo "2.2 or later" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: <2.2" >&5 $as_echo "<2.2" >&6; } FUSE_FLAGS="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LD_EXTRALIBS="$save_LD_EXTRALIBS" if test "${ENABLE_OWFS}" != "false"; then ENABLE_OWLIB="true" ENABLE_OWFS="true" fi else ENABLE_OWFS="false" fi if test "${ENABLE_OWFS}" = "true"; then ENABLE_OWFS_TRUE= ENABLE_OWFS_FALSE='#' else ENABLE_OWFS_TRUE='#' ENABLE_OWFS_FALSE= fi # Check if the cache is enabled. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if caching is enabled" >&5 $as_echo_n "checking if caching is enabled... " >&6; } ENABLE_CACHE="true" # Check whether --enable-cache was given. if test "${enable_cache+set}" = set; then : enableval=$enable_cache; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_CACHE=false fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_CACHE}" = "true"; then ENABLE_CACHE_TRUE= ENABLE_CACHE_FALSE='#' else ENABLE_CACHE_TRUE='#' ENABLE_CACHE_FALSE= fi # Check if the zeroconf/bonjour is enabled. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if zeroconf/bonjour is enabled" >&5 $as_echo_n "checking if zeroconf/bonjour is enabled... " >&6; } ENABLE_ZERO="true" # Check whether --enable-zero was given. if test "${enable_zero+set}" = set; then : enableval=$enable_zero; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test ! "$enableval" = "yes" ; then ENABLE_ZERO=false fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi if test "${ENABLE_ZERO}" = "true"; then ENABLE_ZERO_TRUE= ENABLE_ZERO_FALSE='#' else ENABLE_ZERO_TRUE='#' ENABLE_ZERO_FALSE= fi LIBUSB_CFLAGS="" LIBUSB_LIBS="" if test "$cross_compiling" != yes; then for ac_prog in libusb-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIBUSB_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIBUSB_CONFIG"; then ac_cv_prog_LIBUSB_CONFIG="$LIBUSB_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIBUSB_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIBUSB_CONFIG=$ac_cv_prog_LIBUSB_CONFIG if test -n "$LIBUSB_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBUSB_CONFIG" >&5 $as_echo "$LIBUSB_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LIBUSB_CONFIG" && break done else LIBUSB_CONFIG="" fi # Check whether --with-libusb-config was given. if test "${with_libusb_config+set}" = set; then : withval=$with_libusb_config; fi if test "X$with_libusb_config" != "X" ; then LIBUSB_CONFIG=$with_libusb_config fi if test "$cross_compiling" != yes; then if test "X$LIBUSB_CONFIG" == "X" ; then dirs="/usr/bin /usr/local/bin /opt/local/bin" for i in $dirs; do echo $i/libusb-config if test -x $i/libusb-config; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i/libusb-config is found" >&5 $as_echo "$i/libusb-config is found" >&6; } LIBUSB_CONFIG="$i/libusb-config" break; fi done fi fi # Check for USB enabled ENABLE_USB=auto { $as_echo "$as_me:${as_lineno-$LINENO}: checking if usb support is enabled" >&5 $as_echo_n "checking if usb support is enabled... " >&6; } # Check whether --enable-usb was given. if test "${enable_usb+set}" = set; then : enableval=$enable_usb; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_USB=false fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto (default)" >&5 $as_echo "auto (default)" >&6; } fi if test "${ENABLE_USB}" != "false"; then # Include libusb if the usb is enabled if test "X${LIBUSB_CONFIG}" != "X" ; then LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags` LIBUSB_LIBS=`$LIBUSB_CONFIG --libs` save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS" LDFLAGS="$save_LDFLAGS $LIBUSB_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libusb compiles with includes+lib " >&5 $as_echo_n "checking if libusb compiles with includes+lib ... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { usb_open(NULL); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: compilation error" >&5 $as_echo "compilation error" >&6; } LIBUSB_CFLAGS="" LIBUSB_LDFLAGS="" LIBUSB_CONFIG="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "X${LIBUSB_CONFIG}" != "X" ; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_usb_interrupt_read_ok=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking if usb_interrupt_read is found" >&5 $as_echo_n "checking if usb_interrupt_read is found... " >&6; } save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$save_LIBS $LIBUSB_LIBS" CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { usb_interrupt_read(NULL, 0, NULL, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_usb_interrupt_read_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_usb_interrupt_read_ok}" >&5 $as_echo "${acx_usb_interrupt_read_ok}" >&6; } # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_usb_interrupt_read_ok" = xyes; then $as_echo "#define HAVE_USB_INTERRUPT_READ 1" >>confdefs.h : else acx_usb_interrupt_read_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" #LIBUSB_CONFIG fi # last test to see if libusb is found after AC_CHECK_LIB if test "X${LIBUSB_CONFIG}" == "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_open in -lusb" >&5 $as_echo_n "checking for usb_open in -lusb... " >&6; } if ${ac_cv_lib_usb_usb_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char usb_open (); int main () { return usb_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_usb_open=yes else ac_cv_lib_usb_usb_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_usb_open" >&5 $as_echo "$ac_cv_lib_usb_usb_open" >&6; } if test "x$ac_cv_lib_usb_usb_open" = xyes; then : LIBUSB_LIBS="-lusb" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find libusb" >&5 $as_echo "$as_me: WARNING: Can't find libusb" >&2;} if test "${ENABLE_USB}" = "true" ; then as_fn_error $? "libusb must be installed to use a USB adapter" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libusb not found, usb will be disabled" >&5 $as_echo "$as_me: WARNING: libusb not found, usb will be disabled" >&2;} ENABLE_USB=false fi fi if test "${ENABLE_USB}" != "false" ; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_usb_interrupt_read_ok=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking if usb_interrupt_read is found" >&5 $as_echo_n "checking if usb_interrupt_read is found... " >&6; } save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$save_LIBS $LIBUSB_LIBS" CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { usb_interrupt_read(NULL, 0, NULL, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_usb_interrupt_read_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_usb_interrupt_read_ok}" >&5 $as_echo "${acx_usb_interrupt_read_ok}" >&6; } # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_usb_interrupt_read_ok" = xyes; then $as_echo "#define HAVE_USB_INTERRUPT_READ 1" >>confdefs.h : else acx_usb_interrupt_read_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi fi if test "${ENABLE_USB}" != "false" ; then ENABLE_USB=true fi # ENABLE_USB fi if test "${ENABLE_USB}" = "true"; then ENABLE_USB_TRUE= ENABLE_USB_FALSE='#' else ENABLE_USB_TRUE='#' ENABLE_USB_FALSE= fi # Check for Parallel port enabled ENABLE_PARPORT=auto { $as_echo "$as_me:${as_lineno-$LINENO}: checking if parallel port support is enabled" >&5 $as_echo_n "checking if parallel port support is enabled... " >&6; } # Check whether --enable-parport was given. if test "${enable_parport+set}" = set; then : enableval=$enable_parport; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if ! test "$enableval" = "yes" ; then ENABLE_PARPORT=false fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } fi # Include linux/ppdev.h if the parallel port is enabled if test "${ENABLE_PARPORT}" != "false" ; then ac_fn_c_check_header_mongrel "$LINENO" "linux/ppdev.h" "ac_cv_header_linux_ppdev_h" "$ac_includes_default" if test "x$ac_cv_header_linux_ppdev_h" = xyes; then : else if test "${ENABLE_PARPORT}" = "true" ; then as_fn_error $? "ppdev.h must be installed to use parallel port adapter" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ppdev.h not found, parallel port will be disabled" >&5 $as_echo "$as_me: WARNING: ppdev.h not found, parallel port will be disabled" >&2;} ENABLE_PARPORT=false fi fi if test "${ENABLE_PARPORT}" != "false" ; then ENABLE_PARPORT=true fi fi if test "${ENABLE_PARPORT}" = "true"; then ENABLE_PARPORT_TRUE= ENABLE_PARPORT_FALSE='#' else ENABLE_PARPORT_TRUE='#' ENABLE_PARPORT_FALSE= fi if test "${HAVE_CYGWIN}" = "true" ; then OW_CYGWIN=1 else OW_CYGWIN=0 fi if test "${HAVE_DARWIN}" = "true" ; then OW_DARWIN=1 else OW_DARWIN=0 fi ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif " if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_SOCKADDR_STORAGE 1 _ACEOF fi if test "$ac_cv_type_struct_sockaddr_storage" = no; then ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" "$ac_includes_default" if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes; then : $as_echo "#define SOCKADDR_IN_HAS_LEN 1" >>confdefs.h fi fi ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" "#include " if test "x$ac_cv_type_struct_addrinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_ADDRINFO 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif " if test "x$ac_cv_type_socklen_t" = xyes; then : else $as_echo "#define socklen_t unsigned int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AF_NETLINK" >&5 $as_echo_n "checking for AF_NETLINK... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif int main () { int ss_family = AF_NETLINK; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_af_netlink="yes" $as_echo "#define HAVE_AF_NETLINK 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_af_netlink="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "${have_af_netlink}" != "yes" ; then if test "${ENABLE_W1}" != "false" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disable w1 since AF_NETLINK not found" >&5 $as_echo "$as_me: WARNING: Disable w1 since AF_NETLINK not found" >&2;} ENABLE_W1="false" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken glibc with __ss_family" >&5 $as_echo_n "checking for broken glibc with __ss_family... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif int main () { struct sockaddr_storage s; s.__ss_family = AF_INET; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_BROKEN_SS_FAMILY 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for core ipv6 support" >&5 $as_echo_n "checking for core ipv6 support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define IN_AUTOCONF #include "include/stdinc.h" int main () { struct sockaddr_in6 s; struct sockaddr_storage t; s.sin6_family = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if test "${HAVE_CYGWIN}" = "true" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, Cygwin's ipv6 is incomplete" >&5 $as_echo "no, Cygwin's ipv6 is incomplete" >&6; } have_v6=no else have_v6=yes $as_echo "#define IPV6 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct in6addr_any" >&5 $as_echo_n "checking for struct in6addr_any... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define IN_AUTOCONF #include "include/stdinc.h" int main () { struct in6_addr a = in6addr_any; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_IN6ADDR_ANY 1" >>confdefs.h inet_misc=1 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_v6="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sem_timedwait exists" >&5 $as_echo_n "checking if sem_timedwait exists... " >&6; } if ${ac_cv_sem_timedwait+:} false; then : $as_echo_n "(cached) " >&6 else save_LIBS="$LIBS"; LIBS="$LIBS $PTHREAD_LIBS" ; save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $PTHREAD_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_STDLIB_H #include #endif #if HAVE_SEMAPHORE_H #include #endif int main () { sem_timedwait(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sem_timedwait="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find sem_timedwait" >&5 $as_echo "$as_me: WARNING: Can't find sem_timedwait" >&2;} ac_cv_sem_timedwait="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sem_timedwait" >&5 $as_echo "$ac_cv_sem_timedwait" >&6; } if test "$ac_cv_sem_timedwait" = "yes"; then $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether string.h and strings.h may both be included" >&5 $as_echo_n "checking whether string.h and strings.h may both be included... " >&6; } if ${gcc_cv_header_string+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gcc_cv_header_string=yes else gcc_cv_header_string=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_string" >&5 $as_echo "$gcc_cv_header_string" >&6; } if test "$gcc_cv_header_string" = "yes"; then $as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h fi if test "${ENABLE_MT}" = "true" ; then OW_MT=1 else OW_MT=0 fi if test "${ENABLE_I2C}" = "true" ; then OW_I2C=1 else OW_I2C=0 fi if test "${ENABLE_HA7}" = "true" ; then OW_HA7=1 else OW_HA7=0 fi if test "${ENABLE_W1}" = "true" ; then OW_W1=1 else OW_W1=0 fi if test "${ENABLE_CACHE}" = "true" ; then OW_CACHE=1 else OW_CACHE=0 fi if test "${ENABLE_USB}" = "true" ; then OW_USB=1 else OW_USB=0 fi if test "${ENABLE_ZERO}" = "true" ; then OW_ZERO=1 else OW_ZERO=0 fi if test "${ENABLE_PARPORT}" = "true" ; then OW_PARPORT=1 else OW_PARPORT=0 fi if test "${ENABLE_DEBUG}" = "true" ; then OW_DEBUG=1 else OW_DEBUG=0 fi if test "${ENABLE_TAI8570}" = "true" ; then OW_TAI8570=1 else OW_TAI8570=0 fi if test "${ENABLE_THERMOCOUPLE}" = "true" ; then OW_THERMOCOUPLE=1 else OW_THERMOCOUPLE=0 fi if test "${ENABLE_OWMALLOC}" = "true" ; then OW_ALLOC_DEBUG=1 else OW_ALLOC_DEBUG=0 fi if test "${ENABLE_TRAFFIC}" = "true" ; then OW_SHOW_TRAFFIC=1 else OW_SHOW_TRAFFIC=0 fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi # Checks for library functions. for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi #AC_FUNC_MALLOC #AC_FUNC_MKTIME #AC_FUNC_REALLOC for ac_header in sys/select.h sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } if ${ac_cv_func_select_args+:} false; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : "${ac_cv_func_select_args=int,int *,struct timeval *}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if ${ac_cv_lib_intl_strftime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 $as_echo_n "checking for working strtod... " >&6; } if ${ac_cv_func_strtod+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifndef strtod double strtod (); #endif int main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ char *string = " +69"; char *term; double value; value = strtod (string, &term); if (value != 69 || term != (string + 4)) return 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 $as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 $as_echo_n "checking for pow in -lm... " >&6; } if ${ac_cv_lib_m_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 $as_echo "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 $as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in accept daemon getaddrinfo freeaddrinfo gethostbyname2_r gethostbyaddr_r gethostbyname_r getservbyname_r getopt getopt_long gettimeofday inet_ntop inet_pton memchr memset select socket strcasecmp strchr strdup strncasecmp strtol strtoul twalk tsearch tfind tdelete tdestroy vasprintf strsep vsprintf vsnprintf writev getline do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "${ENABLE_ZERO}" = "true" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lrint" >&5 $as_echo_n "checking for library containing lrint... " >&6; } if ${ac_cv_search_lrint+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char lrint (); int main () { return lrint (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_lrint=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_lrint+:} false; then : break fi done if ${ac_cv_search_lrint+:} false; then : else ac_cv_search_lrint=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lrint" >&5 $as_echo "$ac_cv_search_lrint" >&6; } ac_res=$ac_cv_search_lrint if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_LRINT 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 $as_echo_n "checking for library containing nanosleep... " >&6; } if ${ac_cv_search_nanosleep+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char nanosleep (); int main () { return nanosleep (); ; return 0; } _ACEOF for ac_lib in '' rt posix4; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_nanosleep=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_nanosleep+:} false; then : break fi done if ${ac_cv_search_nanosleep+:} false; then : else ac_cv_search_nanosleep=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 $as_echo "$ac_cv_search_nanosleep" >&6; } ac_res=$ac_cv_search_nanosleep if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_NANOSLEEP 1" >>confdefs.h fi # clock_gettime needed if real-time wait is needed for sem_timedwait. gettimeofday is enough. #AC_SEARCH_LIBS(clock_gettime, rt posix4, AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime])) ac_config_files="$ac_config_files Makefile module/Makefile module/owlib/Makefile module/owlib/src/Makefile module/owlib/src/include/Makefile module/owlib/src/c/Makefile module/owfs/Makefile module/owfs/src/Makefile module/owfs/src/include/Makefile module/owfs/src/c/Makefile module/owhttpd/Makefile module/owhttpd/src/Makefile module/owhttpd/src/include/Makefile module/owhttpd/src/c/Makefile module/owserver/Makefile module/owserver/src/Makefile module/owserver/src/include/Makefile module/owserver/src/c/Makefile module/owftpd/Makefile module/owftpd/src/Makefile module/owftpd/src/include/Makefile module/owftpd/src/c/Makefile module/ownet/Makefile module/ownet/php/Makefile module/ownet/php/examples/ownet_example.php module/ownet/python/Makefile module/ownet/perl5/Makefile module/ownet/c/Makefile module/ownet/c/src/Makefile module/ownet/c/src/include/Makefile module/ownet/c/src/c/Makefile module/ownet/c/src/example/Makefile module/owshell/Makefile module/owshell/src/Makefile module/owshell/src/include/Makefile module/owshell/src/c/Makefile module/owcapi/Makefile module/owcapi/src/Makefile module/owcapi/src/include/Makefile module/owcapi/src/c/Makefile module/owcapi/src/example/Makefile module/owcapi/src/example++/Makefile module/owtap/Makefile module/owmon/Makefile module/swig/Makefile module/swig/perl5/Makefile module/swig/perl5/OW/Makefile.linux module/swig/perl5/OW/Makefile.osx module/swig/php/Makefile module/swig/php/example/load_php_OW.php module/swig/python/Makefile module/swig/python/ow/Makefile module/swig/python/setup.py module/owtcl/Makefile src/Makefile src/include/Makefile src/man/Makefile src/rpm/Makefile src/rpm/owfs.spec src/scripts/Makefile src/scripts/windows/Makefile src/scripts/windows/owfs.nsi src/scripts/usb/Makefile src/scripts/usb/cygwin/Makefile src/scripts/usb/windows/Makefile src/include/owfs_config.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DEBIAN_TRUE}" && test -z "${HAVE_DEBIAN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DEBIAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DARWIN_TRUE}" && test -z "${HAVE_DARWIN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_CYGWIN_TRUE}" && test -z "${HAVE_CYGWIN_FALSE}"; then as_fn_error $? "conditional \"HAVE_CYGWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DEBUG_TRUE}" && test -z "${ENABLE_DEBUG_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWSHELL_TRUE}" && test -z "${ENABLE_OWSHELL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWSHELL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWLIB_TRUE}" && test -z "${ENABLE_OWLIB_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWNETLIB_TRUE}" && test -z "${ENABLE_OWNETLIB_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWNETLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TAI8570_TRUE}" && test -z "${ENABLE_TAI8570_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TAI8570\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_THERMOCOUPLE_TRUE}" && test -z "${ENABLE_THERMOCOUPLE_FALSE}"; then as_fn_error $? "conditional \"ENABLE_THERMOCOUPLE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_MT_TRUE}" && test -z "${ENABLE_MT_FALSE}"; then as_fn_error $? "conditional \"ENABLE_MT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_I2C_TRUE}" && test -z "${ENABLE_I2C_FALSE}"; then as_fn_error $? "conditional \"ENABLE_I2C\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_HA7_TRUE}" && test -z "${ENABLE_HA7_FALSE}"; then as_fn_error $? "conditional \"ENABLE_HA7\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_W1_TRUE}" && test -z "${ENABLE_W1_FALSE}"; then as_fn_error $? "conditional \"ENABLE_W1\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWHTTPD_TRUE}" && test -z "${ENABLE_OWHTTPD_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWHTTPD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWFTPD_TRUE}" && test -z "${ENABLE_OWFTPD_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWFTPD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWSERVER_TRUE}" && test -z "${ENABLE_OWSERVER_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWSERVER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWEXTERNAL_TRUE}" && test -z "${ENABLE_OWEXTERNAL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWEXTERNAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWNET_TRUE}" && test -z "${ENABLE_OWNET_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWNET\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWTAP_TRUE}" && test -z "${ENABLE_OWTAP_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWTAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWMALLOC_TRUE}" && test -z "${ENABLE_OWMALLOC_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWMALLOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TRAFFIC_TRUE}" && test -z "${ENABLE_TRAFFIC_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TRAFFIC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWMON_TRUE}" && test -z "${ENABLE_OWMON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWMON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWCAPI_TRUE}" && test -z "${ENABLE_OWCAPI_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWCAPI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_SWIG_TRUE}" && test -z "${ENABLE_SWIG_FALSE}"; then as_fn_error $? "conditional \"ENABLE_SWIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWPERL_TRUE}" && test -z "${ENABLE_OWPERL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWPERL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PERL_TRUE}" && test -z "${ENABLE_PERL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PERL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWPHP_TRUE}" && test -z "${ENABLE_OWPHP_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWPHP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PHP_TRUE}" && test -z "${ENABLE_PHP_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PHP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWPYTHON_TRUE}" && test -z "${ENABLE_OWPYTHON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWPYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PYTHON_TRUE}" && test -z "${ENABLE_PYTHON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWTCL_TRUE}" && test -z "${ENABLE_OWTCL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWTCL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PROFILING_TRUE}" && test -z "${ENABLE_PROFILING_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PROFILING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_OWFS_TRUE}" && test -z "${ENABLE_OWFS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_OWFS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CACHE_TRUE}" && test -z "${ENABLE_CACHE_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CACHE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_ZERO_TRUE}" && test -z "${ENABLE_ZERO_FALSE}"; then as_fn_error $? "conditional \"ENABLE_ZERO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_USB_TRUE}" && test -z "${ENABLE_USB_FALSE}"; then as_fn_error $? "conditional \"ENABLE_USB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PARPORT_TRUE}" && test -z "${ENABLE_PARPORT_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PARPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "module/Makefile") CONFIG_FILES="$CONFIG_FILES module/Makefile" ;; "module/owlib/Makefile") CONFIG_FILES="$CONFIG_FILES module/owlib/Makefile" ;; "module/owlib/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owlib/src/Makefile" ;; "module/owlib/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owlib/src/include/Makefile" ;; "module/owlib/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owlib/src/c/Makefile" ;; "module/owfs/Makefile") CONFIG_FILES="$CONFIG_FILES module/owfs/Makefile" ;; "module/owfs/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owfs/src/Makefile" ;; "module/owfs/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owfs/src/include/Makefile" ;; "module/owfs/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owfs/src/c/Makefile" ;; "module/owhttpd/Makefile") CONFIG_FILES="$CONFIG_FILES module/owhttpd/Makefile" ;; "module/owhttpd/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owhttpd/src/Makefile" ;; "module/owhttpd/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owhttpd/src/include/Makefile" ;; "module/owhttpd/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owhttpd/src/c/Makefile" ;; "module/owserver/Makefile") CONFIG_FILES="$CONFIG_FILES module/owserver/Makefile" ;; "module/owserver/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owserver/src/Makefile" ;; "module/owserver/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owserver/src/include/Makefile" ;; "module/owserver/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owserver/src/c/Makefile" ;; "module/owftpd/Makefile") CONFIG_FILES="$CONFIG_FILES module/owftpd/Makefile" ;; "module/owftpd/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owftpd/src/Makefile" ;; "module/owftpd/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owftpd/src/include/Makefile" ;; "module/owftpd/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owftpd/src/c/Makefile" ;; "module/ownet/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/Makefile" ;; "module/ownet/php/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/php/Makefile" ;; "module/ownet/php/examples/ownet_example.php") CONFIG_FILES="$CONFIG_FILES module/ownet/php/examples/ownet_example.php" ;; "module/ownet/python/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/python/Makefile" ;; "module/ownet/perl5/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/perl5/Makefile" ;; "module/ownet/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/c/Makefile" ;; "module/ownet/c/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/c/src/Makefile" ;; "module/ownet/c/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/c/src/include/Makefile" ;; "module/ownet/c/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/c/src/c/Makefile" ;; "module/ownet/c/src/example/Makefile") CONFIG_FILES="$CONFIG_FILES module/ownet/c/src/example/Makefile" ;; "module/owshell/Makefile") CONFIG_FILES="$CONFIG_FILES module/owshell/Makefile" ;; "module/owshell/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owshell/src/Makefile" ;; "module/owshell/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owshell/src/include/Makefile" ;; "module/owshell/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owshell/src/c/Makefile" ;; "module/owcapi/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/Makefile" ;; "module/owcapi/src/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/src/Makefile" ;; "module/owcapi/src/include/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/src/include/Makefile" ;; "module/owcapi/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/src/c/Makefile" ;; "module/owcapi/src/example/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/src/example/Makefile" ;; "module/owcapi/src/example++/Makefile") CONFIG_FILES="$CONFIG_FILES module/owcapi/src/example++/Makefile" ;; "module/owtap/Makefile") CONFIG_FILES="$CONFIG_FILES module/owtap/Makefile" ;; "module/owmon/Makefile") CONFIG_FILES="$CONFIG_FILES module/owmon/Makefile" ;; "module/swig/Makefile") CONFIG_FILES="$CONFIG_FILES module/swig/Makefile" ;; "module/swig/perl5/Makefile") CONFIG_FILES="$CONFIG_FILES module/swig/perl5/Makefile" ;; "module/swig/perl5/OW/Makefile.linux") CONFIG_FILES="$CONFIG_FILES module/swig/perl5/OW/Makefile.linux" ;; "module/swig/perl5/OW/Makefile.osx") CONFIG_FILES="$CONFIG_FILES module/swig/perl5/OW/Makefile.osx" ;; "module/swig/php/Makefile") CONFIG_FILES="$CONFIG_FILES module/swig/php/Makefile" ;; "module/swig/php/example/load_php_OW.php") CONFIG_FILES="$CONFIG_FILES module/swig/php/example/load_php_OW.php" ;; "module/swig/python/Makefile") CONFIG_FILES="$CONFIG_FILES module/swig/python/Makefile" ;; "module/swig/python/ow/Makefile") CONFIG_FILES="$CONFIG_FILES module/swig/python/ow/Makefile" ;; "module/swig/python/setup.py") CONFIG_FILES="$CONFIG_FILES module/swig/python/setup.py" ;; "module/owtcl/Makefile") CONFIG_FILES="$CONFIG_FILES module/owtcl/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; "src/man/Makefile") CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;; "src/rpm/Makefile") CONFIG_FILES="$CONFIG_FILES src/rpm/Makefile" ;; "src/rpm/owfs.spec") CONFIG_FILES="$CONFIG_FILES src/rpm/owfs.spec" ;; "src/scripts/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/Makefile" ;; "src/scripts/windows/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/windows/Makefile" ;; "src/scripts/windows/owfs.nsi") CONFIG_FILES="$CONFIG_FILES src/scripts/windows/owfs.nsi" ;; "src/scripts/usb/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/usb/Makefile" ;; "src/scripts/usb/cygwin/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/usb/cygwin/Makefile" ;; "src/scripts/usb/windows/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/usb/windows/Makefile" ;; "src/include/owfs_config.h") CONFIG_FILES="$CONFIG_FILES src/include/owfs_config.h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi # Now, let's tell them what is the current configuration. Only the items # that are funny (like current default prefix) or configurable (like the # cache) should be included. { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: Current configuration:" >&5 $as_echo "Current configuration:" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: Deployment location: ${prefix}" >&5 $as_echo " Deployment location: ${prefix}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: Compile-time options:" >&5 $as_echo "Compile-time options:" >&6; } if test "${ENABLE_CACHE}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Caching is enabled" >&5 $as_echo " Caching is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Caching is DISABLED" >&5 $as_echo " Caching is DISABLED" >&6; } fi if test "${ENABLE_USB}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: USB is enabled" >&5 $as_echo " USB is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: USB is DISABLED" >&5 $as_echo " USB is DISABLED" >&6; } fi if test "${ENABLE_I2C}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: I2C is enabled" >&5 $as_echo " I2C is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: I2C is DISABLED" >&5 $as_echo " I2C is DISABLED" >&6; } fi if test "${ENABLE_HA7}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: HA7Net is enabled" >&5 $as_echo " HA7Net is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: HA7Net is DISABLED" >&5 $as_echo " HA7Net is DISABLED" >&6; } fi if test "${ENABLE_W1}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: W1 is enabled" >&5 $as_echo " W1 is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: W1 is DISABLED" >&5 $as_echo " W1 is DISABLED" >&6; } fi if test "${ENABLE_MT}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Multithreading is enabled" >&5 $as_echo " Multithreading is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Multithreading is DISABLED" >&5 $as_echo " Multithreading is DISABLED" >&6; } fi if test "${ENABLE_PARPORT}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Parallel port DS1410E is enabled" >&5 $as_echo " Parallel port DS1410E is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Parallel port DS1410E is DISABLED" >&5 $as_echo " Parallel port DS1410E is DISABLED" >&6; } fi if test "${ENABLE_TAI8570}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: TAI8570 barometer is enabled" >&5 $as_echo " TAI8570 barometer is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: TAI8570 barometer is DISABLED" >&5 $as_echo " TAI8570 barometer is DISABLED" >&6; } fi if test "${ENABLE_THERMOCOUPLE}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Thermocouple is enabled" >&5 $as_echo " Thermocouple is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Thermocouple is DISABLED" >&5 $as_echo " Thermocouple is DISABLED" >&6; } fi if test "${ENABLE_ZERO}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Zeroconf/Bonjour is enabled" >&5 $as_echo " Zeroconf/Bonjour is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Zeroconf/Bonjour is DISABLED" >&5 $as_echo " Zeroconf/Bonjour is DISABLED" >&6; } fi if test "${ENABLE_DEBUG}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug-output is enabled" >&5 $as_echo " Debug-output is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug-output is DISABLED" >&5 $as_echo " Debug-output is DISABLED" >&6; } fi if test "${ENABLE_PROFILING}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Profiling is enabled" >&5 $as_echo " Profiling is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Profiling is DISABLED" >&5 $as_echo " Profiling is DISABLED" >&6; } fi if test "${ENABLE_OWMALLOC}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Tracing memory allocation is enabled" >&5 $as_echo "Tracing memory allocation is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Tracing memory allocation is DISABLED" >&5 $as_echo "Tracing memory allocation is DISABLED" >&6; } fi if test "${ENABLE_TRAFFIC}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: 1wire bus traffic reports is enabled" >&5 $as_echo "1wire bus traffic reports is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: 1wire bus traffic reports is DISABLED" >&5 $as_echo "1wire bus traffic reports is DISABLED" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: Module configuration:" >&5 $as_echo "Module configuration:" >&6; } if test "${ENABLE_OWLIB}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owlib is enabled" >&5 $as_echo " owlib is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owlib is DISABLED" >&5 $as_echo " owlib is DISABLED" >&6; } fi if test "${ENABLE_OWSHELL}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owshell is enabled" >&5 $as_echo " owshell is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owshell is DISABLED" >&5 $as_echo " owshell is DISABLED" >&6; } fi if test "${ENABLE_OWFS}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owfs is enabled" >&5 $as_echo " owfs is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owfs is DISABLED" >&5 $as_echo " owfs is DISABLED" >&6; } fi if test "${ENABLE_OWHTTPD}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owhttpd is enabled" >&5 $as_echo " owhttpd is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owhttpd is DISABLED" >&5 $as_echo " owhttpd is DISABLED" >&6; } fi if test "${ENABLE_OWFTPD}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owftpd is enabled" >&5 $as_echo " owftpd is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owftpd is DISABLED" >&5 $as_echo " owftpd is DISABLED" >&6; } fi if test "${ENABLE_OWSERVER}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owserver is enabled" >&5 $as_echo " owserver is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owserver is DISABLED" >&5 $as_echo " owserver is DISABLED" >&6; } fi if test "${ENABLE_OWEXTERNAL}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owexternal is enabled" >&5 $as_echo " owexternal is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owexternal is DISABLED" >&5 $as_echo " owexternal is DISABLED" >&6; } fi if test "${ENABLE_OWNET}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: ownet is enabled" >&5 $as_echo " ownet is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ownet is DISABLED" >&5 $as_echo " ownet is DISABLED" >&6; } fi if test "${ENABLE_OWNETLIB}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: ownetlib is enabled" >&5 $as_echo " ownetlib is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ownetlib is DISABLED" >&5 $as_echo " ownetlib is DISABLED" >&6; } fi if test "${ENABLE_OWTAP}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owtap is enabled" >&5 $as_echo " owtap is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owtap is DISABLED" >&5 $as_echo " owtap is DISABLED" >&6; } fi if test "${ENABLE_OWMON}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owmon is enabled" >&5 $as_echo " owmon is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owmon is DISABLED" >&5 $as_echo " owmon is DISABLED" >&6; } fi if test "${ENABLE_OWCAPI}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owcapi is enabled" >&5 $as_echo " owcapi is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owcapi is DISABLED" >&5 $as_echo " owcapi is DISABLED" >&6; } fi if test "${ENABLE_SWIG}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: swig is enabled" >&5 $as_echo " swig is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: swig is DISABLED" >&5 $as_echo " swig is DISABLED" >&6; } fi if test "${ENABLE_OWPERL}" = "true" -a "${ENABLE_SWIG}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owperl is enabled" >&5 $as_echo " owperl is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owperl is DISABLED" >&5 $as_echo " owperl is DISABLED" >&6; } fi if test "${ENABLE_OWPHP}" = "true" -a "${ENABLE_SWIG}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owphp is enabled" >&5 $as_echo " owphp is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owphp is DISABLED" >&5 $as_echo " owphp is DISABLED" >&6; } fi if test "${ENABLE_OWPYTHON}" = "true" -a "${ENABLE_SWIG}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owpython is enabled" >&5 $as_echo " owpython is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owpython is DISABLED" >&5 $as_echo " owpython is DISABLED" >&6; } fi if test "${ENABLE_OWTCL}" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: owtcl is enabled" >&5 $as_echo " owtcl is enabled" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: owtcl is DISABLED" >&5 $as_echo " owtcl is DISABLED" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } owfs-2.8p15/configure.ac0000644000175000017500000013624411756247373012127 00000000000000dnl Process this file with autoconf to produce a configure script. AC_REVISION($Id: configure.ac,v 1.308 2012/05/20 20:07:23 alfille Exp $) AC_INIT # Making releases: # VERSION_PATCHLEVEL += 1; # OWFS_INTERFACE_AGE += 1; # OWFS_BINARY_AGE += 1; # if any functions have been added, set OWFS_INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set OWFS_BINARY_AGE _and_ OWFS_INTERFACE_AGE to 0. # (In our case it's better to always keep AGE to 0, since nobody else will use our library) VERSION_MAJOR=2 VERSION_MINOR=8 VERSION_PATCHLEVEL=15 OWFS_INTERFACE_AGE=0 OWFS_BINARY_AGE=0 AC_SUBST(VERSION_MAJOR) AC_SUBST(VERSION_MINOR) AC_SUBST(VERSION_PATCHLEVEL) AC_SUBST(OWFS_INTERFACE_AGE) AC_SUBST(OWFS_BINARY_AGE) LT_CURRENT=`expr $VERSION_PATCHLEVEL - $OWFS_INTERFACE_AGE` LT_REVISION=$OWFS_INTERFACE_AGE LT_AGE=`expr $OWFS_BINARY_AGE - $OWFS_INTERFACE_AGE` AC_SUBST(LT_CURRENT)dnl AC_SUBST(LT_REVISION)dnl AC_SUBST(LT_AGE)dnl LT_RELEASE=$VERSION_MAJOR.$VERSION_MINOR AC_SUBST(LT_RELEASE)dnl VERSION="${VERSION_MAJOR}.${VERSION_MINOR}p${VERSION_PATCHLEVEL}" AC_SUBST(VERSION)dnl PACKAGE="owfs" AC_SUBST(PACKAGE)dnl AC_MSG_RESULT(Configuring ${PACKAGE}-${VERSION}) AC_CONFIG_AUX_DIR(src/scripts/install)dnl #added based on libtoolize warning output AC_CONFIG_MACRO_DIR([m4])dnl AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})dnl # Process config.h.in AH_TOP([ #ifndef OWCONFIG_H #define OWCONFIG_H ]) AH_BOTTOM([#endif]) AM_CONFIG_HEADER(src/include/config.h) AC_PREREQ(2.57)dnl AC_PREFIX_DEFAULT(/opt/owfs)dnl AC_PATH_PROG(ECHO,echo,,$PATH)dnl AC_PATH_PROG(TEST,test,,$PATH)dnl AC_PATH_PROG(RM,rm,,$PATH)dnl AC_PATH_PROG(RPM,rpm,,$PATH)dnl AC_PATH_PROG(RPMBUILD,rpmbuild,,$PATH)dnl AC_PATH_PROG([SWIG],[swig],,$PATH)dnl # Check for additional programs # We don't need c++ right now. #AC_PROG_CXX AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_LIBTOOL_WIN32_DLL AC_PROG_LN_S AC_PROG_MAKE_SET # Modern libtool prefers LT_INIT over AC_PROG_RABLIB #AC_PROG_RANLIB LT_INIT AC_PROG_AWK AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) # Supposedly this helps OS X compiling AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) HAVE_DEBIAN="false" AC_MSG_CHECKING([if debian-system is used]) AC_ARG_ENABLE(debian, [ --enable-debian Enable debian-system (default false)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "yes" ; then HAVE_DEBIAN="true" fi ], [ AC_MSG_RESULT([no (default)]) ]) AC_SUBST(HAVE_DEBIAN) AM_CONDITIONAL(HAVE_DEBIAN, test "${HAVE_DEBIAN}" = "true") HAVE_DARWIN="false" HAVE_CYGWIN="false" AC_MSG_CHECKING([for special host]) case "$host" in *-*-cygwin*) HAVE_CYGWIN="true" CFLAGS="$CFLAGS -mwin32 -g" AC_MSG_RESULT([Cygwin]) ;; *-darwin*) HAVE_DARWIN="true" AC_MSG_RESULT([Darwin]) ;; *) AC_MSG_RESULT([Other host]) ;; esac AC_SUBST(HAVE_DARWIN) AM_CONDITIONAL(HAVE_DARWIN, test "${HAVE_DARWIN}" = "true") AC_SUBST(HAVE_CYGWIN) AM_CONDITIONAL(HAVE_CYGWIN, test "${HAVE_CYGWIN}" = "true") PIC_FLAGS="" if test "$lt_prog_compiler_pic_works" = yes; then PIC_FLAGS="$lt_prog_compiler_pic" fi AC_SUBST(PIC_FLAGS) # Make sure tclConfig.sh is found under /usr/lib64/ # Should perhaps support cross-compiling to other cpu-type too? LIBPOSTFIX= case "${host_os}" in *linux* ) case "${host_cpu}" in powerpc64 | s390x | x86_64 ) LIBPOSTFIX="64" CFLAGS="$CFLAGS -m64" ;; esac ;; esac AC_SUBST(LIBPOSTFIX) if test "$cross_compiling" != yes; then OW_CHECK_NESTED_FUNCTIONS fi OWFSROOT="`pwd`" AC_SUBST(OWFSROOT) m4_include(acx_pthread.m4) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([asm/types.h arpa/inet.h sys/ioctl.h sys/mkdev.h sys/socket.h sys/time.h sys/times.h sys/types.h sys/uio.h feature_tests.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/file.h syslog.h termios.h unistd.h limits.h stdint.h features.h getopt.h resolv.h semaphore.h]) AC_CHECK_HEADERS([linux/limits.h linux/types.h netdb.h dlfcn.h]) # Test if debugging out enabled ENABLE_DEBUG="true" AC_MSG_CHECKING([if debug-output is enabled]) AC_ARG_ENABLE(debug, [ --enable-debug Enable debug-output (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_DEBUG="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_DEBUG) AM_CONDITIONAL(ENABLE_DEBUG, test "${ENABLE_DEBUG}" = "true") # Test if OWSHELL should be supported ENABLE_OWSHELL="true" AC_MSG_CHECKING([if OWSHELL support is enabled]) AC_ARG_ENABLE(owshell, [ --enable-owshell Enable owshell support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_OWSHELL="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWSHELL) AM_CONDITIONAL(ENABLE_OWSHELL, test "${ENABLE_OWSHELL}" = "true") # Test if OWLIB should be supported ENABLE_OWLIB="true" AC_MSG_CHECKING([if OWLIB support is enabled]) AC_ARG_ENABLE(owlib, [ --enable-owlib Enable owlib support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_OWLIB="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWLIB) AM_CONDITIONAL(ENABLE_OWLIB, test "${ENABLE_OWLIB}" = "true") # Test if OWNETLIB should be supported ENABLE_OWNETLIB="true" AC_MSG_CHECKING([if OWNETLIB support is enabled]) AC_ARG_ENABLE(ownetlib, [ --enable-ownetlib Enable ownetlib support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_OWNETLIB="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWNETLIB) AM_CONDITIONAL(ENABLE_OWNETLIB, test "${ENABLE_OWNETLIB}" = "true") # Test if TAI8570 barometer should be supported ENABLE_TAI8570="true" AC_MSG_CHECKING([if TAI8570 barometer support is enabled]) AC_ARG_ENABLE(tai8570, [ --enable-tai8570 Enable tai8570 barometer support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_TAI8570="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_TAI8570) AM_CONDITIONAL(ENABLE_TAI8570, test "${ENABLE_TAI8570}" = "true") # Test if thermocouples should be supported ENABLE_THERMOCOUPLE="true" AC_MSG_CHECKING([if thermocouple support is enabled]) AC_ARG_ENABLE(thermocouple, [ --enable-thermocouple Enable thermocouple support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_THERMOCOUPLE="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_THERMOCOUPLE) AM_CONDITIONAL(ENABLE_THERMOCOUPLE, test "${ENABLE_THERMOCOUPLE}" = "true") # Check for threading ENABLE_MT="true" AC_MSG_CHECKING([if multithreading is enabled]) AC_ARG_ENABLE(mt, [ --enable-mt Enable multithreading support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_MT="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) if test "${ENABLE_MT}" = "true" ; then ACX_PTHREAD if test "$acx_pthread_ok" = "yes"; then #CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # can't set pthread flags for all compilations, since owshell doesn't need it. if test "$cross_compiling" = yes; then # We need to link libow.so with -lpthread on some cross-platforms # since owtcl.so doesn't work otherwise. -pthread is not enough if test x"$PTHREAD_LIBS" = x -a "x$PTHREAD_CFLAGS" = "x-pthread"; then AC_MSG_RESULT([add -lpthread to PTHREAD_LIBS]) PTHREAD_LIBS="-lpthread" fi fi ENABLE_MT="true" else ENABLE_MT="false" PTHREAD_CFLAGS="" PTHREAD_LIBS="" PTHREAD_CC="" fi fi AC_SUBST(ENABLE_MT) AM_CONDITIONAL(ENABLE_MT, test "${ENABLE_MT}" = "true") # Check for i2c support ENABLE_I2C="true" AC_MSG_CHECKING([if i2c(DS2482-x00) is enabled]) AC_ARG_ENABLE(i2c, [ --enable-i2c Enable i2c (DS2482-x00) support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_I2C="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_I2C) AM_CONDITIONAL(ENABLE_I2C, test "${ENABLE_I2C}" = "true") # Check for HA7Net ENABLE_HA7="true" AC_MSG_CHECKING([if HA7Net is enabled]) AC_ARG_ENABLE(ha7, [ --enable-ha7 Enable ha7 support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_HA7="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_HA7) AM_CONDITIONAL(ENABLE_HA7, test "${ENABLE_HA7}" = "true") # Check for W1 (linux kernel module) ENABLE_W1="true" AC_MSG_CHECKING([if W1 is enabled]) AC_ARG_ENABLE(w1, [ --enable-w1 Enable w1 support (default true)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_W1="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_W1) AM_CONDITIONAL(ENABLE_W1, test "${ENABLE_W1}" = "true") # Check if the modules are enabled #Check owhttpd ENABLE_OWHTTPD="true" AC_MSG_CHECKING(if owhttpd is enabled) AC_ARG_ENABLE(owhttpd, [ --enable-owhttpd Enable owhttpd module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWHTTPD="false" else ENABLE_OWLIB="true" fi ], [ ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWHTTPD) AM_CONDITIONAL(ENABLE_OWHTTPD, test "${ENABLE_OWHTTPD}" = "true") #Check owftpd ENABLE_OWFTPD="true" AC_MSG_CHECKING(if owftpd is enabled) AC_ARG_ENABLE(owftpd, [ --enable-owftpd Enable owftpd module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWFTPD="false" else # if test ! "${ENABLE_MT}" = "true" ; then # AC_MSG_ERROR([owftpd needs multithreading]) # fi ENABLE_OWLIB="true" fi ], [ if test "${ENABLE_MT}" = "true" ; then ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) else ENABLE_OWFTPD="false" AC_MSG_RESULT([no (multithreading needed)]) fi ]) AC_SUBST(ENABLE_OWFTPD) AM_CONDITIONAL(ENABLE_OWFTPD, test "${ENABLE_OWFTPD}" = "true") #Check owserver AC_MSG_CHECKING(if owserver is enabled) ENABLE_OWSERVER="true" AC_ARG_ENABLE(owserver, [ --enable-owserver Enable owserver module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWSERVER="false" else ENABLE_OWLIB="true" fi ], [ ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWSERVER) AM_CONDITIONAL(ENABLE_OWSERVER, test "${ENABLE_OWSERVER}" = "true") #Check owexternal AC_MSG_CHECKING(if owexternal is enabled) ENABLE_OWEXTERNAL="true" AC_ARG_ENABLE(owexternal, [ --enable-owexternal Enable owexternal module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWEXTERNAL="false" else ENABLE_OWLIB="true" fi ], [ ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWEXTERNAL) AM_CONDITIONAL(ENABLE_OWEXTERNAL, test "${ENABLE_OWEXTERNAL}" = "true") #Check ownet ENABLE_OWNET="true" AC_MSG_CHECKING(if ownet is enabled) AC_ARG_ENABLE(ownet, [ --enable-ownet Enable ownet module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWNET="false" else ENABLE_OWLIB="true" fi ], [ ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWNET) AM_CONDITIONAL(ENABLE_OWNET, test "${ENABLE_OWNET}" = "true") #Check owtap ENABLE_OWTAP="true" AC_MSG_CHECKING(if owtap is enabled) AC_ARG_ENABLE(owtap, [ --enable-owtap Enable owtap module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWTAP="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWTAP) AM_CONDITIONAL(ENABLE_OWTAP, test "${ENABLE_OWTAP}" = "true") #Check owmalloc (special memory allocation routines) ENABLE_OWMALLOC="false" AC_MSG_CHECKING(if owmalloc is enabled) AC_ARG_ENABLE(owmalloc, [ --enable-owmalloc Enable owmalloc checking (default false)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "yes" ; then ENABLE_OWMALLOC="true" fi ], [ AC_MSG_RESULT([no (default)]) ]) AC_SUBST(ENABLE_OWMALLOC) AM_CONDITIONAL(ENABLE_OWMALLOC, test "${ENABLE_OWMALLOC}" = "true") #Check for all bus traffic being reported ENABLE_TRAFFIC="false" AC_MSG_CHECKING(if bus traffic reports is enabled) AC_ARG_ENABLE(owtraffic, [ --enable-owtraffic Enable bus traffic reports (default false)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "yes" ; then ENABLE_TRAFFIC="true" fi ], [ AC_MSG_RESULT([no (default)]) ]) AC_SUBST(ENABLE_TRAFFIC) AM_CONDITIONAL(ENABLE_TRAFFIC, test "${ENABLE_TRAFFIC}" = "true") #Check owmon AC_MSG_CHECKING(if owmon is enabled) ENABLE_OWMON="true" AC_ARG_ENABLE(owmon, [ --enable-owmon Enable owmon module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWMON="false" fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWMON) AM_CONDITIONAL(ENABLE_OWMON, test "${ENABLE_OWMON}" = "true") #Check owcapi AC_MSG_CHECKING(if owcapi is enabled) ENABLE_OWCAPI="true" AC_ARG_ENABLE(owcapi, [ --enable-owcapi Enable owcapi module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWCAPI="false" else ENABLE_OWLIB="true" fi ], [ ENABLE_OWLIB="true" AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_OWCAPI) AM_CONDITIONAL(ENABLE_OWCAPI, test "${ENABLE_OWCAPI}" = "true") #Check swig AC_MSG_CHECKING(if swig is enabled) if test -z "$SWIG" ; then ENABLE_SWIG="false" else ENABLE_SWIG="auto" fi AC_ARG_ENABLE(swig, [ --enable-swig Enable swig (default auto)], [ if test "$enableval" = "no"; then ENABLE_SWIG="false" SWIG="" AC_MSG_RESULT([no]) else if test -z "$SWIG"; then AC_MSG_ERROR([Swig is not found and could not be enabled]) fi ENABLE_OWLIB="true" ENABLE_SWIG="true" AC_MSG_RESULT([yes]) fi ], [ AC_MSG_RESULT([auto (default)]) ]) if test "${HAVE_CYGWIN}" = "true"; then if test ! "$ENABLE_SWIG" = "true"; then ENABLE_SWIG="false" SWIG="" AC_MSG_RESULT([(Disable swig by default in Cygwin)]) fi else if test "$ENABLE_SWIG" = "auto"; then ENABLE_SWIG="true" fi fi AC_SUBST(ENABLE_SWIG) AM_CONDITIONAL(ENABLE_SWIG, test "${ENABLE_SWIG}" = "true") #Check owperl AC_MSG_CHECKING(if owperl is enabled) ENABLE_OWPERL="true" AC_ARG_ENABLE(owperl, [ --enable-owperl Enable owperl module (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_OWPERL="false" else if test -z "$SWIG" ; then AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN]) AC_MSG_WARN([OWPERL is disabled because swig is not found]) ENABLE_OWPERL="false" fi fi ], [ if test -z "$SWIG" ; then AC_MSG_RESULT([no (swig disabled)]) else AC_MSG_RESULT([yes (default)]) fi ]) PERL="" if test "${ENABLE_OWPERL}" = "true"; then m4_include(module/swig/perl5/perl5.m4) AC_MSG_RESULT(Looking for location of Perl executable) SC_PATH_PERL5 AC_SUBST(PERL5EXT) AC_SUBST(PERL5DYNAMICLINKING) AC_SUBST(PERL5LIB) AC_SUBST(PERL5DIR) AC_SUBST(PERL5NAME) AC_SUBST(PERL5CCFLAGS) if test -z "${PERL}" ; then AC_MSG_WARN([Cannot find perl binary.]) AC_MSG_WARN([OWPERL is disabled because perl binary is not found]) ENABLE_OWPERL="false" else if test -z "${PERL5NAME}" ; then AC_MSG_WARN([Cannot find perl library. Install perl-devel package.]) AC_MSG_WARN([OWPERL is disabled because perl library is not found]) ENABLE_OWPERL="false" fi fi fi AC_SUBST(PERL) AC_SUBST(ENABLE_OWPERL) AM_CONDITIONAL(ENABLE_OWPERL, test "${ENABLE_OWPERL}" = "true") if test -z "$PERL" ; then ENABLE_PERL="false" else ENABLE_PERL="true" fi AC_SUBST(ENABLE_PERL) AM_CONDITIONAL(ENABLE_PERL, test "${ENABLE_PERL}" = "true") #Check owphp AC_MSG_CHECKING(if owphp is enabled) ENABLE_OWPHP="true" AC_ARG_ENABLE(owphp, [ --enable-owphp Enable owphp module (default true)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "no" ; then ENABLE_OWPHP="false" fi if test "$enableval" = "yes" ; then ENABLE_OWPHP="true" fi if test -z "$SWIG" ; then AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN]) AC_MSG_WARN([OWPHP is disabled because swig is not found]) ENABLE_OWPHP="false" fi ], [ if test -z "$SWIG" ; then AC_MSG_RESULT([no (swig disabled)]) else AC_MSG_RESULT([yes (default)]) fi ]) PHP="" if test "${ENABLE_OWPHP}" = "true" ; then m4_include(module/swig/php/php.m4) AC_MSG_RESULT(Looking for location of Php executable) SC_PATH_PHP AC_SUBST(PHPCONFIG) AC_SUBST(PHPINC) AC_SUBST(PHPEXT) AC_SUBST(PHPLIBDIR) if test -z "${PHP}" ; then AC_MSG_WARN([Cannot find php binary. Install php or php5 package]) AC_MSG_WARN([OWPHP is disabled because php binary is not found]) ENABLE_OWPHP="false" else if test -z "${PHPCONFIG}" ; then AC_MSG_WARN([Cannot find php-config binary. Install php-devel or php5-dev package]) AC_MSG_WARN([include and library paths will be guessed]) fi if test -z "${PHPINC}" ; then AC_MSG_WARN([Cannot find php include-file. Install php-devel or php5-dev package]) AC_MSG_WARN([OWPHP is disabled because php include-file is not found]) ENABLE_OWPHP="false" else if test -z "${PHPLIBDIR}" ; then AC_MSG_WARN([Cannot find php extension-dir. Install php-devel or php5-dev package]) AC_MSG_WARN([OWPHP is disabled because php extension-dir is not found]) ENABLE_OWPHP="false" fi fi fi fi AC_SUBST(PHP) AC_SUBST(ENABLE_OWPHP) AM_CONDITIONAL(ENABLE_OWPHP, test "${ENABLE_OWPHP}" = "true") if test -z "$PHP" ; then ENABLE_PHP="false" else ENABLE_PHP="true" fi AC_SUBST(ENABLE_PHP) AM_CONDITIONAL(ENABLE_PHP, test "${ENABLE_PHP}" = "true") #Check owpython AC_MSG_CHECKING(if owpython is enabled) ENABLE_OWPYTHON="true" AC_ARG_ENABLE(owpython, [ --enable-owpython Enable owpython module (default true)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "no" ; then ENABLE_OWPYTHON="false" fi if test "$enableval" = "yes" ; then ENABLE_OWPYTHON="true" if test -z "$SWIG" ; then AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN]) AC_MSG_WARN([OWPYTHON is disabled because swig is not found]) ENABLE_OWPYTHON="false" fi fi ], [ if test -z "$SWIG" ; then AC_MSG_RESULT([no (swig disabled)]) else AC_MSG_RESULT([yes (default)]) fi ]) PYTHON="" if test "${ENABLE_OWPYTHON}" = "true" ; then m4_include(module/swig/python/python.m4) AC_MSG_RESULT(Looking for location of Python executable) SC_PATH_PYTHON AC_SUBST(PYCFLAGS) AC_SUBST(PYLDFLAGS) AC_SUBST(PYLIB) AC_SUBST(PYVERSION) AC_SUBST(PYSITEDIR) AC_SUBST(PYTHONDYNAMICLINKING) if test -z "${PYTHON}" ; then AC_MSG_WARN([Cannot find python binary. Install python package.]) AC_MSG_WARN([OWPYTHON is disabled because python binary is not found]) ENABLE_OWPYTHON="false" else if test -z "${PYLDFLAGS}" ; then AC_MSG_WARN([Cannot find python library. Install python-devel package.]) AC_MSG_WARN([OWPYTHON is disabled because python library is not found]) ENABLE_OWPYTHON="false" else if test -z "${PYCFLAGS}" ; then AC_MSG_WARN([Cannot find python include-file. Install python-devel package.]) AC_MSG_WARN([OWPYTHON is disabled because python include-file is not found]) ENABLE_OWPYTHON="false" fi fi fi fi AC_SUBST(ENABLE_OWPYTHON) AM_CONDITIONAL(ENABLE_OWPYTHON, test "${ENABLE_OWPYTHON}" = "true") AC_SUBST(PYTHON) if test -z "$PYTHON" ; then ENABLE_PYTHON="false" else ENABLE_PYTHON="true" fi AC_SUBST(ENABLE_PYTHON) AM_CONDITIONAL(ENABLE_PYTHON, test "${ENABLE_PYTHON}" = "true") #Check owtcl AC_MSG_CHECKING(if owtcl is enabled) ENABLE_OWTCL="true" AC_ARG_ENABLE(owtcl, [ --enable-owtcl Enable owtcl module (default true)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "no" ; then ENABLE_OWTCL="false" fi if test "$enableval" = "yes" ; then ENABLE_OWTCL="true" fi ], [ AC_MSG_RESULT([yes (default)]) ]) if test "${ENABLE_OWTCL}" = "true" ; then m4_include(module/owtcl/tcl.m4) AC_MSG_RESULT(Looking for tclConfig.sh) SC_PATH_TCLCONFIG if test -z "$TCL_BIN_DIR" -o ! -f "$TCL_BIN_DIR/tclConfig.sh" ; then AC_MSG_WARN([OWTCL is disabled because tclConfig.sh is not found]) ENABLE_OWTCL="false" else SC_LOAD_TCLCONFIG AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SHLIB_CFLAGS) AC_SUBST(TCL_SHLIB_LD) AC_SUBST(TCL_SHLIB_LD_LIBS) AC_SUBST(TCL_SHLIB_SUFFIX) AC_SUBST(TCL_VERSION) AC_SUBST(TCL_PREFIX) AC_SUBST(TCL_EXEC_PREFIX) AC_SUBST(TCL_CFLAGS) AC_SUBST(TCL_DEFS) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_LIBS) AC_SUBST(TCL_LD_FLAGS) AC_SUBST(TCL_COMPAT_OBJS) AC_SUBST(TCL_LD_SEARCH_FLAGS) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_SPEC) AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_PACKAGE_PATH) # guess that tcl will install the files under the first path in # TCL_PACKAGE_PATH. TCL_BIN_DIR is usually correct, but this # might contain staging_dir prefix when cross-compiling. OWTCL_INSTALL_PATH="`echo ${TCL_PACKAGE_PATH} | cut -d' ' -f1`" # Debian Hack: do not install in /usr/local/lib/tcltk # OWTCL_INSTALL_PATH="/usr/lib/tcltk" AC_SUBST(OWTCL_INSTALL_PATH) fi fi AC_SUBST(ENABLE_OWTCL) AM_CONDITIONAL(ENABLE_OWTCL, test "${ENABLE_OWTCL}" = "true") AC_DEFUN([ACX_EXPAND], [ EXP_VAR=[$1] FROM_VAR=[$2] dnl first expand prefix and exec_prefix if necessary prefix_save=$prefix exec_prefix_save=$exec_prefix dnl if no prefix given, then use /usr/local, the default prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi dnl if no exec_prefix given, then use prefix if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" dnl loop until it doesn't change anymore while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done dnl clean up full_var=$new_full_var AC_SUBST([$1], "$full_var") dnl restore prefix and exec_prefix prefix=$prefix_save exec_prefix=$exec_prefix_save ]) dnl ACX_EXPAND ACX_EXPAND(LIBDIR, $libdir) ACX_EXPAND(BINDIR, $bindir) ACX_EXPAND(DATADIR, $datadir) EXTRACFLAGS="-D_FILE_OFFSET_BITS=64" AC_MSG_CHECKING([if cflag _XOPEN_SOURCE is required]) case "${host_cpu}-${host_os}" in *-aix* | *solaris* | *-osf* | *-hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500" EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=500" AC_MSG_RESULT([-D_XOPEN_SOURCE=500]) ;; *-darwin* | *-netbsd*) AC_MSG_RESULT([no]) ;; *-freebsd* | *) # have to add this to support pthread_rwlock_t CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500" EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=500" AC_MSG_RESULT([-D_XOPEN_SOURCE=500]) ;; esac AC_MSG_CHECKING([if cflag _BSD_SOURCE is required]) case "${host_cpu}-${host_os}" in *-netbsd*) CFLAGS="$CFLAGS -D_NETBSD_SOURCE=1" EXTRACFLAGS="$EXTRACFLAGS -D_NETBSD_SOURCE=1" { $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_NETBSD_SOURCE=1" >&5 $as_echo "-D_NETBSD_SOURCE=1" >&6; } ;; *) # have to add -D_BSD_SOURCE=1 to support major() in sys/sysmacros.h # have to add -D_ISOC99_SOURCE=1 to support lrint() in bits/mathcalls.h # have to add -D_POSIX_C_SOURCE=200112L for sem_timedwait # have to add -D_POSIX_C_SOURCE=199309L for clock_gettime() CFLAGS="$CFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" EXTRACFLAGS="$EXTRACFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L" AC_MSG_RESULT([-D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L]) ;; esac # should perhaps add _GNU_SOURCE=1 instead of the two defines above... # That would define _BSD_SOURCE, _SVID_SOURCE, _LARGEFILE64_SOURCE, # _XOPEN_SOURCE=600, _POSIX_C_SOURCE, _POSIX_SOURCE, _ISOC99_SOURCE # Check if extra libs are needed. Should perhaps test if they are available too # instead of hardcoding the libraries. EXTRALIBS="" AC_MSG_CHECKING([if extra libs are required]) case "${host_cpu}-${host_os}" in *-darwin*) # This will actually be duplicates if libusb is used. OSLIBS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation" EXTRALIBS="" AC_MSG_RESULT([${OSLIBS}]) ;; *-solaris*) OSLIBS="" EXTRALIBS=" -lsocket -lnsl " LIBS="$LIBS -lsocket -lnsl" AC_MSG_RESULT([${EXTRALIBS}]) ;; *) OSLIBS="" EXTRALIBS="" AC_MSG_RESULT([${EXTRALIBS}]) ;; esac #Check for profiling AC_MSG_CHECKING(if profiling is enabled) ENABLE_PROFILING="false" AC_ARG_ENABLE(profiling, [ --enable-profiling Enable profiling (default false)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "yes" ; then ENABLE_PROFILING=true EXTRALIBS="$EXTRALIBS -pg" EXTRACFLAGS="$EXTRACFLAGS -pg" fi ], [ AC_MSG_RESULT([no (default)]) ]) AC_SUBST(EXTRACFLAGS) AC_SUBST(ENABLE_PROFILING) AM_CONDITIONAL(ENABLE_PROFILING, test "${ENABLE_PROFILING}" = "true") ACX_EXPAND(LD_EXTRALIBS, $EXTRALIBS) AC_SUBST(LD_EXTRALIBS) AC_SUBST(OSLIBS) AC_MSG_WARN([LD_EXTRALIBS=${LD_EXTRALIBS} OSLIBS=${OSLIBS}]) AC_ARG_WITH(fuseinclude, [ --with-fuseinclude=DIR FUSE-include from @<:@/usr/local/include@:>@], [fuse_include_path=$withval], [fuse_include_path='/usr/local/include']) AC_SUBST(fuse_include_path) AC_ARG_WITH(fuselib, [ --with-fuselib=DIR FUSE-lib from @<:@/usr/local/lib@:>@], [fuse_lib_path=$withval], [fuse_lib_path='/usr/local/lib']) AC_SUBST(fuse_lib_path) #Check owfs AC_MSG_CHECKING([if owfs is enabled]) ENABLE_OWFS="auto" AC_ARG_ENABLE(owfs, [ --enable-owfs Enable owfs module (default auto)], [ AC_MSG_RESULT([$enableval]) if test "$enableval" = "yes" ; then ENABLE_OWFS="true" fi if test "$enableval" = "no" ; then ENABLE_OWFS="false" fi ], [ AC_MSG_RESULT([auto (default)]) ]) # We need fuse only if OWFS is enabled if test "${ENABLE_OWFS}" != "false" ; then save_LD_EXTRALIBS="$LD_EXTRALIBS" save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" FUSE_FLAGS="-DFUSE_USE_VERSION=26" FUSE_INCLUDES="-I${fuse_include_path}" FUSE_LIBS="-L${fuse_lib_path}" LD_EXTRALIBS="$save_LD_EXTRALIBS " CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64 $FUSE_FLAGS $FUSE_INCLUDES" LDFLAGS="$save_LDFLAGS $FUSE_LIBS" AC_CHECK_HEADER(fuse.h,,[ AC_MSG_WARN([ Can't find fuse.h - Add the search path with --with-fuseinclude]) FUSE_FLAGS="" FUSE_INCLUDES="" FUSE_LIBS="" LD_EXTRALIBS="$save_LD_EXTRALIBS" CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64" LDFLAGS="$save_LDFLAGS" AC_MSG_WARN([Install FUSE-2.2 or later to enable owfs - download it from http://fuse.sourceforge.net/]) if test "${ENABLE_OWFS}" = "auto"; then AC_MSG_WARN([OWFS is disabled because fuse.h is not found.]) ENABLE_OWFS="false" else AC_MSG_ERROR([Configure without --enable-owfs to detect fuse automatically.]) fi ]) if test "${ENABLE_OWFS}" != "false"; then save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$LIBS $PTHREAD_LIBS" AC_CHECK_LIB(fuse,fuse_main, [FUSE_LIBS="$FUSE_LIBS -lfuse"],[ AC_MSG_WARN([ Can't find libfuse.a - add the search path with --with-fuselib]) AC_MSG_WARN([Running ldconfig or adding "/usr/local/lib" to /etc/ld.so.conf might also solve the problem, otherwise re-install fuse.]) if test "${ENABLE_OWFS}" = "auto"; then AC_MSG_WARN([OWFS is disabled because libfuse.a is not found.]) ENABLE_OWFS="false" else AC_MSG_ERROR([Can't enable OWFS]) fi ],) CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" fi if test "${ENABLE_OWFS}" != "false"; then # check for a supported FUSE_MAJOR_VERSION. AC_MSG_CHECKING([For supported FUSE API version]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[#include ]], [[ #ifndef FUSE_MAJOR_VERSION #error "FUSE_MAJOR_VERSION not defined" #endif ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_WARN([OWFS is disabled since fuse.h is too old]) if test "${ENABLE_OWFS}" = "true"; then AC_MSG_ERROR([You have to install fuse first (fuse-2.2 or later recommended) - download it from http://fuse.sourceforge.net/]) else ENABLE_OWFS="false" fi ]) fi # Use newest FUSE API if version is newer than 2.2 if test "${ENABLE_OWFS}" != "false"; then # check for a supported FUSE_MAJOR_VERSION. AC_MSG_CHECKING([For FUSE version ]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[#include ]], [[ #ifndef FUSE_VERSION #ifndef FUSE_MAJOR_VERSION #define FUSE_VERSION 11 #else /* FUSE_MAJOR_VERSION */ #undef FUSE_MAKE_VERSION #define FUSE_MAKE_VERSION(maj,min) ((maj) * 10 + (min)) #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION,FUSE_MINOR_VERSION) #endif /* FUSE_MAJOR_VERSION */ #endif /* FUSE_VERSION */ #if (FUSE_VERSION >= 22) /* Fuse > 2.2 is ok */ #else #error "Fuse < 2.2" #endif ]])], [AC_MSG_RESULT([2.2 or later]) ], [AC_MSG_RESULT([<2.2]) FUSE_FLAGS="" ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LD_EXTRALIBS="$save_LD_EXTRALIBS" if test "${ENABLE_OWFS}" != "false"; then ENABLE_OWLIB="true" ENABLE_OWFS="true" fi else ENABLE_OWFS="false" fi AC_SUBST(FUSE_LIBS) AC_SUBST(FUSE_FLAGS) AC_SUBST(FUSE_INCLUDES) AC_SUBST(ENABLE_OWFS) AM_CONDITIONAL(ENABLE_OWFS, test "${ENABLE_OWFS}" = "true") # Check if the cache is enabled. AC_MSG_CHECKING(if caching is enabled) ENABLE_CACHE="true" AC_ARG_ENABLE(cache, [ --enable-cache Enable caching (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_CACHE=false fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_CACHE) AM_CONDITIONAL(ENABLE_CACHE, test "${ENABLE_CACHE}" = "true") # Check if the zeroconf/bonjour is enabled. AC_MSG_CHECKING(if zeroconf/bonjour is enabled) ENABLE_ZERO="true" AC_ARG_ENABLE(zero, [ --enable-zero Enable zeroconf/bonjour (default true)], [ AC_MSG_RESULT([$enableval]) if test ! "$enableval" = "yes" ; then ENABLE_ZERO=false fi ], [ AC_MSG_RESULT([yes (default)]) ]) AC_SUBST(ENABLE_ZERO) AM_CONDITIONAL(ENABLE_ZERO, test "${ENABLE_ZERO}" = "true") LIBUSB_CFLAGS="" LIBUSB_LIBS="" AC_DEFUN([ACX_USB_INTERRUPT_READ], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_usb_interrupt_read_ok=no AC_MSG_CHECKING([if usb_interrupt_read is found]) save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$save_LIBS $LIBUSB_LIBS" CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" AC_TRY_LINK([#include ], [usb_interrupt_read(NULL, 0, NULL, 0, 0);], acx_usb_interrupt_read_ok=yes) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT(${acx_usb_interrupt_read_ok}) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_usb_interrupt_read_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_USB_INTERRUPT_READ,1,[Define to 1 if you have the `usb_interrupt_read' function.]),[$1]) : else acx_usb_interrupt_read_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_USB_INTERRUPT_READ if test "$cross_compiling" != yes; then AC_CHECK_PROGS(LIBUSB_CONFIG, libusb-config) else LIBUSB_CONFIG="" fi AC_SUBST(LIBUSB_CONFIG) AC_ARG_WITH(libusb-config, [ --with-libusb-config=PATH Specify full path to libusb-config]) dnl Check if user passed a specific php-config program. if test "X$with_libusb_config" != "X" ; then LIBUSB_CONFIG=$with_libusb_config fi if test "$cross_compiling" != yes; then if test "X$LIBUSB_CONFIG" == "X" ; then dirs="/usr/bin /usr/local/bin /opt/local/bin" for i in $dirs; do echo $i/libusb-config if test -x $i/libusb-config; then AC_MSG_RESULT($i/libusb-config is found) LIBUSB_CONFIG="$i/libusb-config" break; fi done fi fi # Check for USB enabled ENABLE_USB=auto AC_MSG_CHECKING([if usb support is enabled]) AC_ARG_ENABLE(usb, [ --enable-usb Enable 1-Wire usb DS2490 support (default auto)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_USB=false fi ], [ AC_MSG_RESULT([auto (default)]) ]) if test "${ENABLE_USB}" != "false"; then # Include libusb if the usb is enabled if test "X${LIBUSB_CONFIG}" != "X" ; then LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags` LIBUSB_LIBS=`$LIBUSB_CONFIG --libs` save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS" LDFLAGS="$save_LDFLAGS $LIBUSB_LIBS" AC_MSG_CHECKING([if libusb compiles with includes+lib ]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[#include ]], [[ usb_open(NULL); ]])], [AC_MSG_RESULT([ok])], [AC_MSG_RESULT([compilation error]) LIBUSB_CFLAGS="" LIBUSB_LDFLAGS="" LIBUSB_CONFIG="" ]) if test "X${LIBUSB_CONFIG}" != "X" ; then ACX_USB_INTERRUPT_READ fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" #LIBUSB_CONFIG fi # last test to see if libusb is found after AC_CHECK_LIB if test "X${LIBUSB_CONFIG}" == "X"; then AC_CHECK_LIB(usb,usb_open,[ LIBUSB_LIBS="-lusb"],[ AC_MSG_WARN([Can't find libusb]) if test "${ENABLE_USB}" = "true" ; then AC_MSG_ERROR([libusb must be installed to use a USB adapter]) else AC_MSG_WARN([libusb not found, usb will be disabled]) ENABLE_USB=false fi ],) if test "${ENABLE_USB}" != "false" ; then ACX_USB_INTERRUPT_READ fi fi if test "${ENABLE_USB}" != "false" ; then ENABLE_USB=true fi # ENABLE_USB fi AC_SUBST(LIBUSB_CFLAGS) AC_SUBST(LIBUSB_LIBS) AC_SUBST(ENABLE_USB) AM_CONDITIONAL(ENABLE_USB, test "${ENABLE_USB}" = "true") # Check for Parallel port enabled ENABLE_PARPORT=auto AC_MSG_CHECKING([if parallel port support is enabled]) AC_ARG_ENABLE(parport, [ --enable-parport Enable 1-Wire parallel port DS1410E support (default auto)], [ AC_MSG_RESULT([$enableval]) if ! test "$enableval" = "yes" ; then ENABLE_PARPORT=false fi ], [ AC_MSG_RESULT([yes (default)]) ]) # Include linux/ppdev.h if the parallel port is enabled if test "${ENABLE_PARPORT}" != "false" ; then AC_CHECK_HEADER(linux/ppdev.h,,[ if test "${ENABLE_PARPORT}" = "true" ; then AC_MSG_ERROR([ppdev.h must be installed to use parallel port adapter]) else AC_MSG_WARN([ppdev.h not found, parallel port will be disabled]) ENABLE_PARPORT=false fi ]) if test "${ENABLE_PARPORT}" != "false" ; then ENABLE_PARPORT=true fi fi AC_SUBST(ENABLE_PARPORT) AM_CONDITIONAL(ENABLE_PARPORT, test "${ENABLE_PARPORT}" = "true") if test "${HAVE_CYGWIN}" = "true" ; then OW_CYGWIN=1 else OW_CYGWIN=0 fi AC_SUBST(OW_CYGWIN) if test "${HAVE_DARWIN}" = "true" ; then OW_DARWIN=1 else OW_DARWIN=0 fi AC_SUBST(OW_DARWIN) AC_CHECK_TYPES([struct sockaddr_storage], , , [[ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif ]] ) if test "$ac_cv_type_struct_sockaddr_storage" = no; then AC_CHECK_MEMBER([struct sockaddr_in.sin_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr_in has a 'sin_len' member.])]) fi AC_CHECK_TYPES([struct addrinfo], , , [[#include ]]) AC_CHECK_TYPE(socklen_t, , [AC_DEFINE([socklen_t], [unsigned int], [If we don't have a real socklen_t, unsigned int is good enough.])], [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ]) AC_MSG_CHECKING(for AF_NETLINK) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ], [int ss_family = AF_NETLINK;])], [ AC_MSG_RESULT(yes) have_af_netlink="yes" AC_DEFINE(HAVE_AF_NETLINK, 1, [Have AF_NETLINK in socket.h]) ], [AC_MSG_RESULT(no) have_af_netlink="no"]) if test "${have_af_netlink}" != "yes" ; then if test "${ENABLE_W1}" != "false" ; then AC_MSG_WARN([Disable w1 since AF_NETLINK not found]) ENABLE_W1="false" fi fi AC_MSG_CHECKING(for broken glibc with __ss_family) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ], [struct sockaddr_storage s; s.__ss_family = AF_INET;])], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_BROKEN_SS_FAMILY, 1, [Broken glibc implementations use __ss_family instead of ss_family.]) ], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING([for core ipv6 support]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#define IN_AUTOCONF #include "include/stdinc.h"]], [[struct sockaddr_in6 s; struct sockaddr_storage t; s.sin6_family = 0;]] )], [ if test "${HAVE_CYGWIN}" = "true" ; then AC_MSG_RESULT([no, Cygwin's ipv6 is incomplete]) have_v6=no else have_v6=yes AC_DEFINE(IPV6, 1, [Define if ipv6 support is present and available.]) AC_MSG_RESULT(yes) AC_MSG_CHECKING([for struct in6addr_any]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#define IN_AUTOCONF #include "include/stdinc.h"]], [[struct in6_addr a = in6addr_any;]] )], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.]) inet_misc=1 ] ) fi ], [AC_MSG_RESULT(no) have_v6="no"]) AC_CACHE_CHECK(if sem_timedwait exists,ac_cv_sem_timedwait, [ save_LIBS="$LIBS"; LIBS="$LIBS $PTHREAD_LIBS" ; save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS $PTHREAD_CFLAGS" AC_TRY_LINK([ #if HAVE_STDLIB_H #include #endif #if HAVE_SEMAPHORE_H #include #endif ], [sem_timedwait(NULL, NULL)],[ ac_cv_sem_timedwait="yes"],[ AC_MSG_WARN([Can't find sem_timedwait]) ac_cv_sem_timedwait="no" ]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" ]) if test "$ac_cv_sem_timedwait" = "yes"; then AC_DEFINE(HAVE_SEM_TIMEDWAIT, 1, [Define to 1 if you have the `sem_timedwait' function.]) fi AC_CACHE_CHECK([whether string.h and strings.h may both be included], gcc_cv_header_string, [ AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#include #include ]] )], [gcc_cv_header_string=yes], [gcc_cv_header_string=no] ) ]) if test "$gcc_cv_header_string" = "yes"; then AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h]) fi if test "${ENABLE_MT}" = "true" ; then OW_MT=1 else OW_MT=0 fi AC_SUBST(OW_MT) if test "${ENABLE_I2C}" = "true" ; then OW_I2C=1 else OW_I2C=0 fi AC_SUBST(OW_I2C) if test "${ENABLE_HA7}" = "true" ; then OW_HA7=1 else OW_HA7=0 fi AC_SUBST(OW_HA7) if test "${ENABLE_W1}" = "true" ; then OW_W1=1 else OW_W1=0 fi AC_SUBST(OW_W1) if test "${ENABLE_CACHE}" = "true" ; then OW_CACHE=1 else OW_CACHE=0 fi AC_SUBST(OW_CACHE) if test "${ENABLE_USB}" = "true" ; then OW_USB=1 else OW_USB=0 fi AC_SUBST(OW_USB) if test "${ENABLE_ZERO}" = "true" ; then OW_ZERO=1 else OW_ZERO=0 fi AC_SUBST(OW_ZERO) if test "${ENABLE_PARPORT}" = "true" ; then OW_PARPORT=1 else OW_PARPORT=0 fi AC_SUBST(OW_PARPORT) if test "${ENABLE_DEBUG}" = "true" ; then OW_DEBUG=1 else OW_DEBUG=0 fi AC_SUBST(OW_DEBUG) if test "${ENABLE_TAI8570}" = "true" ; then OW_TAI8570=1 else OW_TAI8570=0 fi AC_SUBST(OW_TAI8570) if test "${ENABLE_THERMOCOUPLE}" = "true" ; then OW_THERMOCOUPLE=1 else OW_THERMOCOUPLE=0 fi AC_SUBST(OW_THERMOCOUPLE) if test "${ENABLE_OWMALLOC}" = "true" ; then OW_ALLOC_DEBUG=1 else OW_ALLOC_DEBUG=0 fi AC_SUBST(OW_ALLOC_DEBUG) if test "${ENABLE_TRAFFIC}" = "true" ; then OW_SHOW_TRAFFIC=1 else OW_SHOW_TRAFFIC=0 fi AC_SUBST(OW_SHOW_TRAFFIC) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_HEADER_STDBOOL AC_STRUCT_TM # Checks for library functions. AC_FUNC_FORK #AC_FUNC_MALLOC #AC_FUNC_MKTIME #AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_FUNC_STRFTIME AC_FUNC_STRTOD AC_TYPE_SIGNAL AC_CHECK_FUNCS([accept daemon getaddrinfo freeaddrinfo gethostbyname2_r gethostbyaddr_r gethostbyname_r getservbyname_r getopt getopt_long gettimeofday inet_ntop inet_pton memchr memset select socket strcasecmp strchr strdup strncasecmp strtol strtoul twalk tsearch tfind tdelete tdestroy vasprintf strsep vsprintf vsnprintf writev getline]) if test "${ENABLE_ZERO}" = "true" ; then AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have dlopen])) fi AC_SEARCH_LIBS(lrint, m, AC_DEFINE(HAVE_LRINT, 1, [Define if you have lrint])) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) # clock_gettime needed if real-time wait is needed for sem_timedwait. gettimeofday is enough. #AC_SEARCH_LIBS(clock_gettime, rt posix4, AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime])) AC_CONFIG_FILES([ Makefile module/Makefile module/owlib/Makefile module/owlib/src/Makefile module/owlib/src/include/Makefile module/owlib/src/c/Makefile module/owfs/Makefile module/owfs/src/Makefile module/owfs/src/include/Makefile module/owfs/src/c/Makefile module/owhttpd/Makefile module/owhttpd/src/Makefile module/owhttpd/src/include/Makefile module/owhttpd/src/c/Makefile module/owserver/Makefile module/owserver/src/Makefile module/owserver/src/include/Makefile module/owserver/src/c/Makefile module/owftpd/Makefile module/owftpd/src/Makefile module/owftpd/src/include/Makefile module/owftpd/src/c/Makefile module/ownet/Makefile module/ownet/php/Makefile module/ownet/php/examples/ownet_example.php module/ownet/python/Makefile module/ownet/perl5/Makefile module/ownet/c/Makefile module/ownet/c/src/Makefile module/ownet/c/src/include/Makefile module/ownet/c/src/c/Makefile module/ownet/c/src/example/Makefile module/owshell/Makefile module/owshell/src/Makefile module/owshell/src/include/Makefile module/owshell/src/c/Makefile module/owcapi/Makefile module/owcapi/src/Makefile module/owcapi/src/include/Makefile module/owcapi/src/c/Makefile module/owcapi/src/example/Makefile module/owcapi/src/example++/Makefile module/owtap/Makefile module/owmon/Makefile module/swig/Makefile module/swig/perl5/Makefile module/swig/perl5/OW/Makefile.linux module/swig/perl5/OW/Makefile.osx module/swig/php/Makefile module/swig/php/example/load_php_OW.php module/swig/python/Makefile module/swig/python/ow/Makefile module/swig/python/setup.py module/owtcl/Makefile src/Makefile src/include/Makefile src/man/Makefile src/rpm/Makefile src/rpm/owfs.spec src/scripts/Makefile src/scripts/windows/Makefile src/scripts/windows/owfs.nsi src/scripts/usb/Makefile src/scripts/usb/cygwin/Makefile src/scripts/usb/windows/Makefile src/include/owfs_config.h ]) AC_OUTPUT # Now, let's tell them what is the current configuration. Only the items # that are funny (like current default prefix) or configurable (like the # cache) should be included. AC_MSG_RESULT() AC_MSG_RESULT([Current configuration:]) AC_MSG_RESULT() AC_MSG_RESULT([ Deployment location: ${prefix}]) AC_MSG_RESULT() AC_MSG_RESULT([Compile-time options:]) if test "${ENABLE_CACHE}" = "true"; then AC_MSG_RESULT([ Caching is enabled]) else AC_MSG_RESULT([ Caching is DISABLED]) fi if test "${ENABLE_USB}" = "true"; then AC_MSG_RESULT([ USB is enabled]) else AC_MSG_RESULT([ USB is DISABLED]) fi if test "${ENABLE_I2C}" = "true"; then AC_MSG_RESULT([ I2C is enabled]) else AC_MSG_RESULT([ I2C is DISABLED]) fi if test "${ENABLE_HA7}" = "true"; then AC_MSG_RESULT([ HA7Net is enabled]) else AC_MSG_RESULT([ HA7Net is DISABLED]) fi if test "${ENABLE_W1}" = "true"; then AC_MSG_RESULT([ W1 is enabled]) else AC_MSG_RESULT([ W1 is DISABLED]) fi if test "${ENABLE_MT}" = "true"; then AC_MSG_RESULT([ Multithreading is enabled]) else AC_MSG_RESULT([ Multithreading is DISABLED]) fi if test "${ENABLE_PARPORT}" = "true"; then AC_MSG_RESULT([ Parallel port DS1410E is enabled]) else AC_MSG_RESULT([ Parallel port DS1410E is DISABLED]) fi if test "${ENABLE_TAI8570}" = "true"; then AC_MSG_RESULT([ TAI8570 barometer is enabled]) else AC_MSG_RESULT([ TAI8570 barometer is DISABLED]) fi if test "${ENABLE_THERMOCOUPLE}" = "true"; then AC_MSG_RESULT([ Thermocouple is enabled]) else AC_MSG_RESULT([ Thermocouple is DISABLED]) fi if test "${ENABLE_ZERO}" = "true"; then AC_MSG_RESULT([ Zeroconf/Bonjour is enabled]) else AC_MSG_RESULT([ Zeroconf/Bonjour is DISABLED]) fi if test "${ENABLE_DEBUG}" = "true"; then AC_MSG_RESULT([ Debug-output is enabled]) else AC_MSG_RESULT([ Debug-output is DISABLED]) fi if test "${ENABLE_PROFILING}" = "true"; then AC_MSG_RESULT([ Profiling is enabled]) else AC_MSG_RESULT([ Profiling is DISABLED]) fi if test "${ENABLE_OWMALLOC}" = "true"; then AC_MSG_RESULT([Tracing memory allocation is enabled]) else AC_MSG_RESULT([Tracing memory allocation is DISABLED]) fi if test "${ENABLE_TRAFFIC}" = "true"; then AC_MSG_RESULT([1wire bus traffic reports is enabled]) else AC_MSG_RESULT([1wire bus traffic reports is DISABLED]) fi AC_MSG_RESULT() AC_MSG_RESULT([Module configuration:]) if test "${ENABLE_OWLIB}" = "true"; then AC_MSG_RESULT([ owlib is enabled]) else AC_MSG_RESULT([ owlib is DISABLED]) fi if test "${ENABLE_OWSHELL}" = "true"; then AC_MSG_RESULT([ owshell is enabled]) else AC_MSG_RESULT([ owshell is DISABLED]) fi if test "${ENABLE_OWFS}" = "true"; then AC_MSG_RESULT([ owfs is enabled]) else AC_MSG_RESULT([ owfs is DISABLED]) fi if test "${ENABLE_OWHTTPD}" = "true"; then AC_MSG_RESULT([ owhttpd is enabled]) else AC_MSG_RESULT([ owhttpd is DISABLED]) fi if test "${ENABLE_OWFTPD}" = "true"; then AC_MSG_RESULT([ owftpd is enabled]) else AC_MSG_RESULT([ owftpd is DISABLED]) fi if test "${ENABLE_OWSERVER}" = "true"; then AC_MSG_RESULT([ owserver is enabled]) else AC_MSG_RESULT([ owserver is DISABLED]) fi if test "${ENABLE_OWEXTERNAL}" = "true"; then AC_MSG_RESULT([ owexternal is enabled]) else AC_MSG_RESULT([ owexternal is DISABLED]) fi if test "${ENABLE_OWNET}" = "true"; then AC_MSG_RESULT([ ownet is enabled]) else AC_MSG_RESULT([ ownet is DISABLED]) fi if test "${ENABLE_OWNETLIB}" = "true"; then AC_MSG_RESULT([ ownetlib is enabled]) else AC_MSG_RESULT([ ownetlib is DISABLED]) fi if test "${ENABLE_OWTAP}" = "true"; then AC_MSG_RESULT([ owtap is enabled]) else AC_MSG_RESULT([ owtap is DISABLED]) fi if test "${ENABLE_OWMON}" = "true"; then AC_MSG_RESULT([ owmon is enabled]) else AC_MSG_RESULT([ owmon is DISABLED]) fi if test "${ENABLE_OWCAPI}" = "true"; then AC_MSG_RESULT([ owcapi is enabled]) else AC_MSG_RESULT([ owcapi is DISABLED]) fi if test "${ENABLE_SWIG}" = "true"; then AC_MSG_RESULT([ swig is enabled]) else AC_MSG_RESULT([ swig is DISABLED]) fi if test "${ENABLE_OWPERL}" = "true" -a "${ENABLE_SWIG}" = "true"; then AC_MSG_RESULT([ owperl is enabled]) else AC_MSG_RESULT([ owperl is DISABLED]) fi if test "${ENABLE_OWPHP}" = "true" -a "${ENABLE_SWIG}" = "true"; then AC_MSG_RESULT([ owphp is enabled]) else AC_MSG_RESULT([ owphp is DISABLED]) fi if test "${ENABLE_OWPYTHON}" = "true" -a "${ENABLE_SWIG}" = "true"; then AC_MSG_RESULT([ owpython is enabled]) else AC_MSG_RESULT([ owpython is DISABLED]) fi if test "${ENABLE_OWTCL}" = "true"; then AC_MSG_RESULT([ owtcl is enabled]) else AC_MSG_RESULT([ owtcl is DISABLED]) fi AC_MSG_RESULT() owfs-2.8p15/AUTHORS0000664000175000017500000000246011651552637010677 00000000000000$Id: AUTHORS,v 1.6 2009/10/31 14:41:42 alfille Exp $ Paul H Allfille: Concept and original work Vadim Tkachenko: Module split, build infrastructure, configuration Geo Carncross: Configuration work Christian Magnusson: Embedded work, and work on chips, and multiple busses Serg Oskin: TCL support as well as alarms and many patches Peter Kropf: Python support Sebastian Zuther: PHP support By Sections: Programs: owfs Paul Alfille owhttpd Paul Alfille owftpd Paul Alfille owserver Paul Alfille and Christian Magnusson Lanquages (light weight) C Christian Magnusson C# (.NET) George M. Zouganelis java jowfsclient Patrik Åkerfeldt java ownet.java George M. Zouganelis pascal ownet.pas George M. Zouganelis php ownet.php Christian Magnusson perl5 OWNet.pm Paul Alfille python ownet Peter Kropf ruby Pedro Côrte-Real shell owdir owread owwrite Paul Alfille VisualBasic OWNet.VB Roberto Spadim Languages (heavy weight) owtcl Serg Oskin owperl Paul Alfille owphp Sebastian Zuther owpython Peter Kropf Libraies: owlib Paul Alfille and Christian Magnusson owcapi Paul Alfille and Christian Magnusson ownet Paul Alfille and Christian Magnusson swig Paul Alfille Added Modules: temploggerd Christian Magnusson TempTrakker Jim Canfield Maison Nicholas Huilardowfs-2.8p15/src/0000775000175000017500000000000011756315507010473 500000000000000owfs-2.8p15/src/man/0000775000175000017500000000000011756315507011246 500000000000000owfs-2.8p15/src/man/DS2505-UNW.30000664000175000017500000000001510244633637012535 00000000000000.so DS2505.3 owfs-2.8p15/src/man/DS2740.30000664000175000017500000000632711535561503012077 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2740.3,v 1.9 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2740 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2740 \- High-Precision Coulomb Counter .SH SYNOPSIS Voltage and Switch .PP .B 36 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B PIO | .B sensed | .B vis | .B vis_B | .B volthours | .br .B smod | .br .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 36 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2670 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS vis_B .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I vis_B is from a different tuning of the .I DS2740 (3) chip with faster sampling and lower resolution. There is no way to know this through software. .SS volthours .I read-write, floating point .br Integral of .I vis over time. Units are in .B volthours .SH OBSCURE PROPERTIES .SS smod .I read-write, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .br Default power-on state for the corresponding properties. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2740 The .B DS2740 (3) is a class of battery charging controllers. This chip measures voltage and volthours, and has a pin that can be used for control. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2740.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owtap.10000664000175000017500000000541311542520452012373 00000000000000'\" '\" Copyright (c) 2007 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for owtap -- 1-wire filesystem package '\" Protocol sniffer for owserver tcp protocol '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owtap.1,v 1.4 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWTAP 1 2007 "OWTAP Manpage" "One-Wire File System" .SH NAME .B owtap \- Packet sniffer for the owserver protocol .SH SYNOPSIS .B owtap .I \-p owtap-tcp-port .I \-s owserver-tcp-port .br .SH "DESCRIPTION" .so description.1so .SS owserver .B owserver (1) is the backend component of the OWFS 1-wire bus control system. .B owserver (1) arbitrates access to the bus from multiple client processes. The physical bus is usually connected to a serial or USB port, and other processes connect to .B owserver (1) over network sockets (tcp port). .PP Frontend clients include a filesystem representation: .B owfs (1) , and a webserver: .B owhttpd (1). Direct language bindings are also available, e.g: .B owperl (3). .PP There are also many light-weight clients that can only talk to .B owserver (1) and not to the 1-Wire bus directly. They include shell and multiple language modules (perl, Visual Basic, python,...) .SS owserver protocol All the .B owserver (1) clients use the .B owserver protocol for communication. The .B owserver protocol is a well documented tcp/ip client/server protocol. Assigned the "well known port" default of 4304. .SS owtap .B owtap (1) is interposed between .B owserver (1) and clients, to display and help resolve communication problems. Network communication is forwarded in both directions, but a visual display is also created, with statistics and "drill-down" of individual packets. .SH SPECIFIC OPTIONS .SS \-p TCP port or IPaddress:port for .I owtap .br Other OWFS programs will access owtap via this address. (e.g. owdir \-s IP:port /) .SS \-s TCP port or IPaddress:port for .I owserver .br The tcp port (IP:port) for the "upstream" owserver. .SH EXAMPLE If .B owserver (1) is started: .br .B owserver \-p 4304 \-d /dev/ttyS0 .br owserver on tcp port 4304 and connects to a physical 1-wire bus on a serial port. .PP You can directly query .B owserver (1) with .br .B owdir \-s 4304 / .PP To see the protocol in action: .br .B owtap \-s 4304 \-p 3000 .br .B owdir \-p 3000 / .PP In this case .B owtap (1) is connecting to .B owserver (1) on the original port (4304) and offering a new port (3000) for clients. .SH PLATFOMS .B owtap (1) is a pure .I Tcl/TK program and will run whereever .I Tcl/TK is available (Windows, Macintosh, Linux, Unix) .SH LINKS .SS owserver protocol http://www.owfs.org/index.php?page=owserver-protocol .SS Tcl/TK http://www.tcl.tk .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2409.30000664000175000017500000000736311535561503012102 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2409.3,v 1.19 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2409 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2409 \- MicroLAN Coupler .SH SYNOPSIS 1-wire network branch controller. .PP .B 1F [.]XXXXXXXXXXXX[XX][/[ .B aux | .B branch.[0|1|ALL|BYTE] | .B control | .B discharge | .B event.[0|1|ALL|BYTE] | .B clearevent | .B main | .B sensed.[0|1|ALL|BYTE] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1F .SH SPECIAL PROPERTIES .SS aux .I directory .br This is the .I aux branch of the .I DS2409 network branch. It is implicitly accessed (via the .I aux smart-on command) when it is listed or devices on this branch are addressed. .SS branch.0 branch.1 branch.ALL branch.BYTE .I read-only, yes-no .br Is the branch ( .I 0=main or .I 1=aux ) currently connected to the master bus? Value returned is 1 (yes) or 0 (no). The .I DS2409 should not allow both to be on simultaneously. .br .I ALL is an aggregate of the properties, comma separated. It is an atomic operation. .br .I BYTE is an aggregate of the branches as a byte, A is bit 0. .SS control .I read-write, unsigned integer .br Setting of the PIO .I control pin. There are 4 possible settings: .TP .B 0 Unconditionally off (non-conducting) .TP .B 1 Unconditionally on (conducting) .TP .B 2 Auto on when .I main branch switched in .TP .B 3 Auto on when .I aux branch switched in .SS discharge .I write-only, yes-no .br Writing a non-zero value to this property will electrically reset both the main and auxillary branches of the 1-wire bus by dropping power for 100 milliseconds. All devices on those branches will lose parasitic power and reset to power-up defaults. As a side effect, both .I event flags and thus, the alarm state, are cleared, too. .SS event.0 event.1 event.ALL event.BYTE .I read-only, yes-no .br Has the .I event flag for the branch been triggered? A negative edge on the disconnected branch ( .I 0=main or .I 1=aux ) sets the flag. This is achieved by e.g. connecting an iButton to the branch. Value returned is 1 (yes) or 0 (no). .I ALL is an aggregate of the properties, comma separated. It is an atomic operation. .br .I BYTE is an aggregate of the branches as a byte, .I main is bit 0. .SS clearevent .I write-only, yes-no .br Writing a non-zero value to this property will reset both .I event flags and thus, clear the alarm state, too. .br .SS main .I directory .br This is the .I main branch of the .I DS2409 network branch. It is implicitly accessed (via the .I main smart-on command) when it is listed or devices on this branch are addressed. .SS sensed.0 sensed.1 sensed.ALL sensed.BYTE .I read-only, yes-no .br Voltage sensed at the .I 0=main or .I 1=aux branch pin. Valid only when the branch is switched out. Value returned is 0 (low) or 1 (high). .br .I ALL is an aggregate of the properties, comma separated. It is an atomic operation. .br .I BYTE is an aggregate of the branches as a byte, A is bit 0. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS The .I DS2409 will respond to a conditional search if the .I main event flag is set. .SH DESCRIPTION .so description.3so .SS DS2409 The .B DS2409 (3) allows complex 1-wire network topology. Each branch has it's power preserved, even when isolated from the master. A separate PIO pin can be configured to show branch switching, or controlled explicitly. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2409.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/pressure.1so0000664000175000017500000000114511323511171013444 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: pressure.1so,v 1.1 2010/01/14 03:41:45 alfille Exp $ '\" .SH PRESSURE SCALE OPTIONS .SS \-\-mbar (default) .SS \-\-atm .SS \-\-mmHg .SS \-\-inHg .SS \-\-psi .SS \-\-Pa Pressure scale used for data output. Millibar is the default. .PP Can also be changed within the program at .I /settings/units/pressure_scale owfs-2.8p15/src/man/DS2417.30000664000175000017500000000001510244633637012070 00000000000000.so DS2415.3 owfs-2.8p15/src/man/DS2804.30000664000175000017500000000001610667266523012076 00000000000000.so DS28E04.3 owfs-2.8p15/src/man/owserver.10000664000175000017500000000612711535515532013125 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owserver.1,v 1.29 2011/03/08 21:10:50 alfille Exp $ '\" .TH OWSERVER 1 2004 "OWSERVER Manpage" "One-Wire File System" .SH NAME .B owserver \- Backend server (daemon) for 1-wire control .SH SYNOPSIS .B owserver .so cmdline_mini.1so .I \-p tcp-port .SH "DESCRIPTION" .so description.1so .SS owserver .B owserver (1) is the backend component of the OWFS 1-wire bus control system. .B owserver (1) arbitrates access to the bus from multiple client processes. The physical bus is usually connected to a serial or USB port, and other processes connect to .B owserver (1) over network sockets (tcp port). Communication can be local or over a network. Secure tunneling can be implemented using standard techniques. .PP Frontend clients include a filesystem representation: .B owfs (1) , and a webserver: .B owhttpd (1). Direct language bindings are also available, e.g: .B owperl (3). Several instances of each client can be initiated. .PP Each client can also connect directly to the physical bus, skipping .B owserver (1) but only one client can connect to the physical bus safely. Simultaneous access is prevented by the operating system for USB ports, but unfortunately not serial ports. The safe way to share access to the 1-wire bus is via .B owserver (1) with the clients connecting. Note: .B owserver (1) can connect to another .B owserver (1) process, though the utility of this technique is limited (perhaps as a .I readonly buffer?) .PP .B owserver (1) is by default multithreaded. Optional data caching is in the server, not clients, so all the clients gain efficiency. .so device.1so .SH SPECIFIC OPTIONS .SS \-p TCP port or IPaddress:port for .I owserver .PP Other OWFS programs will access owserver via this address. (e.g. owfs \-s IP:port /1wire) .PP If no port is specified, the default well-known port (4304 -- assigned by the IANA) will be used. .so temperature.1so .so pressure.1so .so format.1so .so job_control.1so .so configuration.1so .so help.1so .so timeout.1so .so persistent_thresholds.1so .SH DEVELOPER OPTIONS .SS --no_dirall Reject DIRALL messages (requests directory as a single message), forcing client to use older DIR method (each element is an individual message) .SS --no_get Reject GET messages (lets owserver determine if READ or DIRALL is appropriate). Client will fall back to older methods. .SS --no_persistence Reject persistence in requests. All transactions will have to be new connections. .SS --pingcrazy Interject many "keep-alive" (PING) responses. Usually PING responses are only sent when processing is taking a long time to inform client that owserver is still there. .SH EXAMPLE .B owserver -p 3001 -d /dev/ttyS0 runs owserver on tcp port 3001 and connects to a physical 1-wire bus on a serial port. .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2788.30000664000175000017500000000001510733077624012104 00000000000000.so DS2780.3 owfs-2.8p15/src/man/DS2433.30000664000175000017500000000275111535561503012073 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2433.3,v 1.14 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2433 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2433 \- EEPROM (4 kBit) .SH SYNOPSIS Erasable programmable read-only memory (EEPROM) .PP .B 23 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-15|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 23 DS2433 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 512 bytes of memory. Initially all bits are set to 1. Writing zero permanently alters the memory. .SS pages/page.0 ... pages/page.15 pages/page.ALL .I read-write, yes-no .br Memory is split into 16 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2433 The .B DS2433 (3) is used for storing memory which should be available even after a reset or power off. It's main advantage is for audit trails (i.e. a digital purse). .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2433.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Christian Magnusson (mag@mag.cx) owfs-2.8p15/src/man/DS2407.30000664000175000017500000000001410244610020012043 00000000000000.so DS2406.3owfs-2.8p15/src/man/DS2506-UNW.30000664000175000017500000000001510244633637012536 00000000000000.so DS2506.3 owfs-2.8p15/src/man/DS18B20.30000664000175000017500000000410011535561503012162 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS18B20.3,v 1.21 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS18B20 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS18B20 \- Programmable Resolution 1-Wire Digital Thermometer .SH SYNOPSIS Thermometer. .PP .B 28 [.]XXXXXXXXXXXX[XX][/[ .so temperatures_mini.3so .B die | .B power | .B temphigh | .B templow | .B errata/die | .B errata/trim | .B errata/trimblanket | .B errata/trimvalid | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 28 .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .SS temperature .I read-only, floating point .br Measured temperature with 12 bit resolution. .SS temperature9 temperature10 temperature11 temperature12 .I read-only, floating point Measured temperature at 9 to 12 bit resolution. There is a tradeoff of time versus accuracy in the temperature measurement. .SS fasttemp .I read-only, floating point .br Equivalent to .I temperature9 .so temperature_threshold.3so .so temperature_errata.3so .SH STANDARD PROPERTIES .so standard.3so .SH DESCRIPTION .so description.3so .SS DS18B20 The .B DS18B20 (3) is one of several available 1-wire temperature sensors. It is the replacement for the .B DS18S20 (3) Alternatives are .B DS1822 (3) as well as temperature/vlotage measurements in the .B DS2436 (3) and .B DS2438 (3). For truly versatile temperature measurements, see the protean .B DS1921 (3) Thermachron (3). .br The .B DS18B20 (3) can select between 4 resolutions. In general, high resolution is the best choice unless your application is truly time-constrained. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS18B20.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/cmdline_mini.1so0000664000175000017500000000065211152543241014230 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: cmdline_mini.1so,v 1.1 2009/03/01 17:32:17 alfille Exp $ '\" [ .I \-c config ] .I \-d serialport | .I \-u | .I \-s [host:]port owfs-2.8p15/src/man/owpresent.10000664000175000017500000000001510504657057013271 00000000000000.so owshell.1owfs-2.8p15/src/man/owdir.10000664000175000017500000000001510504657057012367 00000000000000.so owshell.1owfs-2.8p15/src/man/EDS0068.30000664000175000017500000000001211531345773012173 00000000000000.so EDS.3 owfs-2.8p15/src/man/DS2890.30000664000175000017500000000437011535561503012101 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2890.3,v 1.16 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2890 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2890 \- 1-Wire Digital Potentiometer .SH SYNOPSIS Variable resistance .PP .B 2C [.]XXXXXXXXXXXX[XX][/[ .B chargepump | .B wiper | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 2C .SH SPECIAL PROPERTIES .SS chargepump .I read-write, yes-no .br State of the .I chargepump in the chip (0 = off 1 = on). Only available if external power is available (hence not in the TO-92 packaging) at pin Vdd. .br When .I chargepump is on, the .I wiper resistance will range between Rh and Rl relatively linearly. .br When .I chargepump is off, the .I wiper resistance (to ground) will range relatively linearly (to 100kOhms). .SS wiper .I read-write, unsigned integer .br Value of the variable element, 0 to 255. The actual interpretation of .I wiper depands on the .I chargepump state, but in general 0 is low and 255 is high. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS The device condition that will cause individual .B DS2890s to participate in a Conditional Search is a wiper position located at the power-on default setting (00h). This feature enables the bus master to easily determine whether a potentiometer has gone through a power-on reset and needs to be re-configured with a required wiper position setting. .SH DESCRIPTION .so description.3so .SS DS2890 The .B D2890 (3) allows variable resistance under 1-wire control. Possible uses are analog feedback mechanisms (sound pitch, light level). .P Although there are provisions in the datasheet for different .B DS2890 configurations (non-linear wiper ranges, multiple wipers, different resistance scales) non are in production. To simplify implementation, this driver assumes the standard .B DS2890 design. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2890.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1985.30000664000175000017500000000001510244633637012101 00000000000000.so DS2505.3 owfs-2.8p15/src/man/description.5so0000664000175000017500000000402611152544732014135 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: description.5so,v 1.1 2009/03/01 17:46:02 alfille Exp $ '\" .SS 1-Wire .I 1-wire is a wiring protocol and series of devices designed and manufactured by Dallas Semiconductor, Inc. The bus is a low-power low-speed low-connector scheme where the data line can also provide power. .PP Each device is uniquely and unalterably numbered during manufacture. There are a wide variety of devices, including memory, sensors (humidity, temperature, voltage, contact, current), switches, timers and data loggers. More complex devices (like thermocouple sensors) can be built with these basic devices. There are also 1-wire devices that have encryption included. .PP The 1-wire scheme uses a single .I bus master and multiple .I slaves on the same wire. The bus master initiates all communication. The slaves can be individually discovered and addressed using their unique ID. .PP Bus masters come in a variety of configurations including serial, parallel, i2c, network or USB adapters. .SS OWFS design .I OWFS is a suite of programs that designed to make the 1-wire bus and its devices easily accessible. The underlying priciple is to create a virtual filesystem, with the unique ID being the directory, and the individual properties of the device are represented as simple files that can be read and written. .PP Details of the individual slave or master design are hidden behind a consistent interface. The goal is to provide an easy set of tools for a software designer to create monitoring or control applications. There are some performance enhancements in the implementation, including data caching, parallel access to bus masters, and aggregation of device communication. Still the fundemental goal has been ease of use, flexibility and correctness rather than speed. owfs-2.8p15/src/man/DS1822.30000664000175000017500000000376511535561503012102 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1822.3,v 1.20 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1822 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1822 \- Econo 1-Wire Digital Thermometer .SH SYNOPSIS Thermometer. .PP .B 22 [.]XXXXXXXXXXXX[XX][/[ .so temperatures_mini.3so | .B die | .B power | .B temphigh | .B templow | .B trim | .B trimblanket | .B trimvalid | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 22 .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .SS temperature .I read-only, floating point .br Measured temperature with 12 bit resolution. .SS temperature9 temperature10 temperature11 temperature12 .I read-only, floating point Measured temperature at 9 to 12 bit resolution. There is a tradeoff of time versus accuracy in the temperature measurement. .SS fasttemp .I read-only, floating point .br Equivalent to .I temperature9 .so temperature_threshold.3so .so temperature_errata.3so .SH STANDARD PROPERTIES .so standard.3so .SH DESCRIPTION .so description.3so .SS DS1822 The .B DS1822 (3) is one of several available 1-wire temperature sensors. Alternatives are the .B DS18S20 (3), .B DS18B20 (3) as well as temperature/voltage measurements in the .B DS2436 (3) and .B DS2438 (3). For truly versatile temperature measurements, see the protean .B DS1921 (3) Thermachron (3). .PP Although the .B DS1822 (3) can select between 4 resolutions, this program simplifies the interface by only implementing the fastest/roughest and slowest/best. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1822.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owread.10000664000175000017500000000001510504657057012524 00000000000000.so owshell.1owfs-2.8p15/src/man/owwrite.10000664000175000017500000000001510504657057012743 00000000000000.so owshell.1owfs-2.8p15/src/man/DS2781.30000664000175000017500000001316711607632732012107 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2781.3,v 1.12 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2760 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2781 \- Stand-alone Fuel Gauge IC .SH SYNOPSIS .SS Temperature Voltage Current Memory and Switch. .PP .B 3D [.]XXXXXXXXXXXX[XX][/[ .B lock.[0-1|ALL] | .B memory | .B pages/page.[0-1|ALL] | .B PIO | .B sensed | .B temperature | .B vbias | .B vis | .B vis_avg | .B vis_offset | .B volt | .B volthours | .br .B aef | .B chgtf | .B learnf | .B pmod | .B porf | .B sef | .B uven | .B uvf | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 3D [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature .SH FAMILY CODE .PP .I 3D .SH SPECIAL PROPERTIES .SS lock.[0-1|ALL] .I read-write, yes-no .br Lock either of the two eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-1|ALL] .I read-write, binary Two 16 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2680 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS vis_avg .I read-only, floating point .br Average current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .SS vis_offset .I read-write, floating point .br Offset to .I vis for current sensor reading (unknown external resistor). Units are in .B Volts .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .I DS2781 to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH OBSCURE PROPERTIES .SS aef chgtf learnf pmod porf sef uven uvf .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2781 The .B DS2781 (3) is a battery charging controller. It has elaborate algorithms for estimating battery capacity. .PP A number of interesting devices can be built with the .B DS2781 including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2781.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/UVI.30000664000175000017500000000001311254034533011675 00000000000000.so EEEF.3 owfs-2.8p15/src/man/EDS0071.30000664000175000017500000000001211531345773012165 00000000000000.so EDS.3 owfs-2.8p15/src/man/OWNet.30000664000175000017500000004713111542520452012242 00000000000000.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "OWNet 3" .TH OWNet 3 "2010-06-15" "perl v5.10.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" OWNet \- Light weight access to \fBowserver\fR .SH "SYNOPSIS" .IX Header "SYNOPSIS" OWNet is an easy way to access \fBowserver\fR and thence the 1\-wire bus. .PP Dallas Semiconductor's 1\-wire system uses simple wiring and unique addresses for its interesting devices. The \fBOne Wire File System (\s-1OWFS\s0)\fR is a suite of programs that hide 1\-wire details behind a file system metaphor. \fBowserver\fR connects to the 1\-wire bus and provides network access. .PP \&\fBOWNet\fR is a perl module that connects to \fBowserver\fR and allows reading, writing and listing the 1\-wire bus. .PP Example perl program that prints the temperature: .PP .Vb 2 \& use OWNet ; \& print OWNet::read( "localhost:4304" , "/10.67C6697351FF/temperature" ) ."\en" ; .Ve .PP There is the alternative object oriented form: .PP .Vb 3 \& use OWNet ; \& my $owserver = OWNet\->new( "localhost:4304" ) ; \& print $owserver\->read( "/10.67C6697351FF/temperature" ) ."\en" ; .Ve .SH "SYNTAX" .IX Header "SYNTAX" .SS "methods" .IX Subsection "methods" .IP "\fBnew\fR" 4 .IX Item "new" .Vb 1 \& my $owserver = OWNet \-> new( address ) ; .Ve .IP "\fBread\fR" 4 .IX Item "read" .Vb 2 \& OWNet::read( address, path [,size [,offset]] ) \& $owserver \-> read( path [,size [,offset]] ) .Ve .IP "\fBwrite\fR" 4 .IX Item "write" .Vb 2 \& OWNet::write( address, path, value [,offset] ) \& $owserver \-> write( path, value [,offset] ) .Ve .IP "\fBdir\fR" 4 .IX Item "dir" .Vb 2 \& OWNet::dir( address, path ) \& $owserver \-> dir( path ) .Ve .SS "\fIaddress\fP" .IX Subsection "address" \&\s-1TCP/IP\s0 \fIaddress\fR of \fBowserver\fR. Valid forms: .IP "\fIname\fR test.owfs.net:4304" 4 .IX Item "name test.owfs.net:4304" .PD 0 .IP "\fIquad\fR number: 123.231.312.213:4304" 4 .IX Item "quad number: 123.231.312.213:4304" .IP "\fIhost\fR localhost:4304" 4 .IX Item "host localhost:4304" .IP "\fIport\fR 4304" 4 .IX Item "port 4304" .PD .SS "\fIadditional arguments\fP" .IX Subsection "additional arguments" Additional arguments to add to address .PP Temperature scale can also be specified in the \fIaddress\fR. Same syntax as the other \s-1OWFS\s0 programs: .IP "\-C Celsius (Centigrade)" 4 .IX Item "-C Celsius (Centigrade)" .PD 0 .IP "\-F Fahrenheit" 4 .IX Item "-F Fahrenheit" .IP "\-K Kelvin" 4 .IX Item "-K Kelvin" .IP "\-R Rankine" 4 .IX Item "-R Rankine" .PD .PP Pressure scale can also be specified in the \fIaddress\fR. Same syntax as the other \s-1OWFS\s0 programs: .IP "\-\-mbar millibar (default)" 4 .IX Item "--mbar millibar (default)" .PD 0 .IP "\-\-atm atmosphere" 4 .IX Item "--atm atmosphere" .IP "\-\-mmHg mm Mercury" 4 .IX Item "--mmHg mm Mercury" .IP "\-\-inHg inch Mercury" 4 .IX Item "--inHg inch Mercury" .IP "\-\-psi pounds per inch^2" 4 .IX Item "--psi pounds per inch^2" .IP "\-\-Pa pascal" 4 .IX Item "--Pa pascal" .PD .PP Device display format (1\-wire unique address) can also be specified in the \fIaddress\fR, with the general form of \-ff[.]i[[.]c] (\fIf\fRamily \fIi\fRd \fIc\fRrc): .IP "\-ff.i /10.67C6697351FF (default)" 4 .IX Item "-ff.i /10.67C6697351FF (default)" .PD 0 .IP "\-ffi /1067C6697351FF" 4 .IX Item "-ffi /1067C6697351FF" .IP "\-ff.i.c /10.67C6697351FF.8D" 4 .IX Item "-ff.i.c /10.67C6697351FF.8D" .IP "\-ff.ic /10.67C6697351FF8D" 4 .IX Item "-ff.ic /10.67C6697351FF8D" .IP "\-ffi.c /1067C6697351FF.8D" 4 .IX Item "-ffi.c /1067C6697351FF.8D" .IP "\-ffic /1067C6697351FF8D" 4 .IX Item "-ffic /1067C6697351FF8D" .PD .PP Show directories that are themselves directories with a '/' suffix ( e.g. /10.67C6697351FF/ ) .IP "\-slash show directory elements" 4 .IX Item "-slash show directory elements" .PP Warning messages will only be displayed if verbose flag is specified in \fIaddress\fR .IP "\-v verbose" 4 .IX Item "-v verbose" .SS "\fIpath\fP" .IX Subsection "path" \&\fBowfs\fR\-type \fIpath\fR to an item on the 1\-wire bus. Valid forms: .IP "main directories" 4 .IX Item "main directories" Used for the \fIdir\fR method. E.g. \*(L"/\*(R" \*(L"/uncached\*(R" \*(L"/1F.321432320000/main\*(R" .IP "device directory" 4 .IX Item "device directory" Used for the \fIdir\fR and \fIpresent\fR method. E.g. \*(L"/10.4300AC220000\*(R" \*(L"/statistics\*(R" .IP "device properties" 4 .IX Item "device properties" Used to \fIread\fR, \fIwrite\fR. E.g. \*(L"/10.4300AC220000/temperature\*(R" .SS "\fIvalue\fP" .IX Subsection "value" New \fIvalue\fR for a device property. Used by \fIwrite\fR. .SH "METHODS" .IX Header "METHODS" .IP "\fBnew\fR" 4 .IX Item "new" Object-oriented (only): .Sp \&\fBOWNet::new\fR( \fIaddress\fR ) .Sp Create a new OWNet object \*(-- corresponds to an \fBowserver\fR. .Sp Error (and undef return value) if: .RS 4 .IP "1 Badly formed tcp/ip \fIaddress\fR" 4 .IX Item "1 Badly formed tcp/ip address" .PD 0 .IP "2 No \fBowserver\fR at \fIaddress\fR" 4 .IX Item "2 No owserver at address" .IP "" 4 .RE .RS 4 .RE .IP "\fBread\fR" 4 .IX Item "read" .RS 4 .IP "Non object-oriented:" 4 .IX Item "Non object-oriented:" .PD \&\fBOWNet::read\fR( \fIaddress\fR , \fIpath\fR [ , \fIsize\fR [ , \fIoffset\fR ] ] ) .IP "Object-oriented:" 4 .IX Item "Object-oriented:" \&\f(CW$ownet\fR\->\fBread\fR( \fIpath\fR [ , \fIsize\fR [ , \fIoffset\fR ] ] ) .RE .RS 4 .Sp Read the value of a 1\-wire device property. Returns the (scalar string) value of the property. .Sp \&\fIsize\fR (number of bytes to read) is optional .Sp \&\fIoffset\fR (number of bytes from start of field to start write) is optional .Sp Error (and undef return value) if: .IP "1 (Non object) No \fBowserver\fR at \fIaddress\fR" 4 .IX Item "1 (Non object) No owserver at address" .PD 0 .IP "2 (Object form) Not called with a valid OWNet object" 4 .IX Item "2 (Object form) Not called with a valid OWNet object" .IP "3 Bad \fIpath\fR" 4 .IX Item "3 Bad path" .IP "4 \fIpath\fR not a readable device property" 4 .IX Item "4 path not a readable device property" .IP "" 4 .RE .RS 4 .RE .IP "\fBwrite\fR" 4 .IX Item "write" .RS 4 .IP "Non object-oriented:" 4 .IX Item "Non object-oriented:" .PD \&\fBOWNet::write\fR( \fIaddress\fR , \fIpath\fR , \fIvalue\fR [ , \fIoffset\fR ] ) .IP "Object-oriented:" 4 .IX Item "Object-oriented:" \&\f(CW$ownet\fR\->\fBwrite\fR( \fIpath\fR , \fIvalue\fR [ , \fIoffset\fR ] ) .RE .RS 4 .Sp Set the value of a 1\-wire device property. Returns \*(L"1\*(R" on success. .Sp \&\fIoffset\fR (number of bytes from start of field to start write) is optional .Sp Error (and undef return value) if: .IP "1 (Non object) No \fBowserver\fR at \fIaddress\fR" 4 .IX Item "1 (Non object) No owserver at address" .PD 0 .IP "2 (Object form) Not called with a valid OWNet object" 4 .IX Item "2 (Object form) Not called with a valid OWNet object" .IP "3 Bad \fIpath\fR" 4 .IX Item "3 Bad path" .IP "4 \fIpath\fR not a writable device property" 4 .IX Item "4 path not a writable device property" .IP "5 \fIvalue\fR incorrect size or format" 4 .IX Item "5 value incorrect size or format" .IP "" 4 .RE .RS 4 .RE .IP "\fBdir\fR" 4 .IX Item "dir" .RS 4 .IP "Non object-oriented:" 4 .IX Item "Non object-oriented:" .PD \&\fBOWNet::dir\fR( \fIaddress\fR , \fIpath\fR ) .IP "Object-oriented:" 4 .IX Item "Object-oriented:" \&\f(CW$ownet\fR\->\fBdir\fR( \fIpath\fR ) .RE .RS 4 .Sp Return a comma-separated list of the entries in \fIpath\fR. Entries are equivalent to \*(L"fully qualified names\*(R" \*(-- full path names. .Sp Error (and undef return value) if: .IP "1 (Non object) No \fBowserver\fR at \fIaddress\fR" 4 .IX Item "1 (Non object) No owserver at address" .PD 0 .IP "2 (Object form) Not called with a valid OWNet object" 4 .IX Item "2 (Object form) Not called with a valid OWNet object" .IP "3 Bad \fIpath\fR" 4 .IX Item "3 Bad path" .IP "4 \fIpath\fR not a directory" 4 .IX Item "4 path not a directory" .IP "" 4 .RE .RS 4 .RE .IP "\fBpresent\fR (deprecated)" 4 .IX Item "present (deprecated)" .RS 4 .IP "Non object-oriented:" 4 .IX Item "Non object-oriented:" .PD \&\fBOWNet::present\fR( \fIaddress\fR , \fIpath\fR ) .IP "Object-oriented:" 4 .IX Item "Object-oriented:" \&\f(CW$ownet\fR\->\fBpresent\fR( \fIpath\fR ) .RE .RS 4 .Sp Test if a 1\-wire device exists. .Sp Error (and undef return value) if: .IP "1 (Non object) No \fBowserver\fR at \fIaddress\fR" 4 .IX Item "1 (Non object) No owserver at address" .PD 0 .IP "2 (Object form) Not called with a valid OWNet object" 4 .IX Item "2 (Object form) Not called with a valid OWNet object" .IP "3 Bad \fIpath\fR" 4 .IX Item "3 Bad path" .IP "4 \fIpath\fR not a device" 4 .IX Item "4 path not a device" .IP "" 4 .RE .RS 4 .RE .PD .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "\s-1OWFS\s0" .IX Subsection "OWFS" \&\fI\s-1OWFS\s0\fR is a suite of programs that allows easy access to \fIDallas Semiconductor\fR's 1\-wire bus and devices. \&\fI\s-1OWFS\s0\fR provides a consistent naming scheme, safe multplexing of 1\-wire traffice, multiple methods of access and display, and network access. The basic \fI\s-1OWFS\s0\fR metaphor is a file-system, with the bus beinng the root directory, each device a subdirectory, and the the device properties (e.g. voltage, temperature, memory) a file. .SS "1\-Wire" .IX Subsection "1-Wire" \&\fI1\-wire\fR is a protocol allowing simple connection of inexpensive devices. Each device has a unique \s-1ID\s0 number (used in its \s-1OWFS\s0 address) and is individually addressable. The bus itself is extremely simple \*(-- a data line and a ground. The data line also provides power. 1\-wire devices come in a variety of packages \*(-- chips, commercial boxes, and iButtons (stainless steel cans). 1\-wire devices have a variety of capabilities, from simple \s-1ID\s0 to complex voltage, temperature, current measurements, memory, and switch control. .SS "Programs" .IX Subsection "Programs" Connection to the 1\-wire bus is either done by bit-banging a digital pin on the processor, or by using a bus master \*(-- \s-1USB\s0, serial, i2c, parallel. The heavy-weight \fI\s-1OWFS\s0\fR programs: \fBowserver\fR \fBowfs\fR \fBowhttpd\fR \fBowftpd\fR and the heavy-weight perl module \fB\s-1OW\s0\fR all link in the full \fI\s-1OWFS\s0\fR library and can connect directly to the bus master(s) and/or to \fBowserver\fR. .PP \&\fBOWNet\fR is a light-weight module. It connects only to an \fBowserver\fR, does not link in the \fI\s-1OWFS\s0\fR library, and should be more portable.. .SS "Object-oriented" .IX Subsection "Object-oriented" \&\fBOWNet\fR can be used in either a classical (non-object-oriented) manner, or with objects. The object stored the ip address of the \fBowserver\fR and a network socket to communicate. \&\fBOWNet\fR will use persistent tcp connections for the object form \*(-- potentially a performance boost over a slow network. .SH "EXAMPLES" .IX Header "EXAMPLES" .SS "owserver" .IX Subsection "owserver" \&\fBowserver\fR is a separate process that must be accessible on the network. It allows multiple clients, and can connect to many physical 1\-wire adapters and 1\-wire devices. It's address must be discoverable \*(-- either set on the command line, or at it's default location, or by using Bonjour (zeroconf) service discovery. .PP An example owserver invocation for a serial adapter and explicitly chooses the default port: .PP .Vb 1 \& owserver \-d /dev/ttyS0 \-p 4304 .Ve .SS "OWNet" .IX Subsection "OWNet" .Vb 1 \& use OWNet ; \& \& # Create owserver object \& my $owserver = OWNet\->new(\*(Aqlocalhost:4304 \-v \-F\*(Aq) ; #default location, verbose errors, Fahrenheit degrees \& # my $owserver = OWNet\->new() ; #simpler, again default location, no error messages, default Celsius \& \& #print directory \& print $owserver\->dir(\*(Aq/\*(Aq) ; \& \& #print temperature from known device (DS18S20, ID: 10.13224366A280) \& print "Temperature: ".$owserver\->read(\*(Aq/uncached/10.13224366A280/temperature\*(Aq) ; \& \& # Now for some fun \-\- a tree of everything: \& sub Tree($$) { \& my $ow = shift ; \& my $path = shift ; \& \& print "$path\et" ; \& \& # first try to read \& my $value = $ow\->read($path) ; \& if ( defined($value) ) { \& print "$value\en"; \& return ; \& } \& \& # not readable, try as directory \& my $dirstring = $ow\->dir($path) ; \& if ( defined($dirstring) ) { \& print "\en" ; \& my @dir = split /,/ , $ow\->dir($path) ; \& foreach (@dir) { \& Tree($ow,$_) ; \& } \& return ; \& } \& \& # can\*(Aqt read, not directory \& print "\en" ; \& return ; \& } \& \& Tree( $owserver, \*(Aq/\*(Aq ) ; .Ve .SH "INTERNALS" .IX Header "INTERNALS" .SS "Object properties (All private)" .IX Subsection "Object properties (All private)" .IP "\s-1ADDR\s0" 4 .IX Item "ADDR" literal sting for the \s-1IP\s0 address, in dotted-quad or host format. This property is also used to indicate a substantiated object. .IP "\s-1PORT\s0" 4 .IX Item "PORT" string for the port number (or service name). Service name must be specified as :owserver or the like. .IP "\s-1SG\s0" 4 .IX Item "SG" Flag sent to server, and returned, that encodes temperature scale and display format. Persistence is also encoded in this word in the actual tcp message, but kept separately in the object. .IP "\s-1VERBOSE\s0" 4 .IX Item "VERBOSE" Print error messages? Set by \*(L"\-v\*(R" in object invocation. .IP "\s-1SLASH\s0" 4 .IX Item "SLASH" Add \*(L"/\*(R" to the end of directory entries. Set by \*(L"\-slash\*(R" in object invocation. .IP "\s-1SOCK\s0" 4 .IX Item "SOCK" Socket address (object) for communication. Stays defined for persistent connections, else deleted between calls. .IP "\s-1PERSIST\s0" 4 .IX Item "PERSIST" State of socket connection (persistent means the same socket is used which speeds network communication). .IP "\s-1VER\s0" 4 .IX Item "VER" owprotocol version number (currently 0) .SS "Private methods" .IX Subsection "Private methods" .IP "_self" 4 .IX Item "_self" Takes either the implicit object reference (if called on an object) or the ip address in non-object format. In either case a socket is created, the persistence bit is properly set, and the address parsed. Returns the object reference, or undef on error. Called by each external method (read,write,dir) on the first parameter. .IP "_new" 4 .IX Item "_new" Takes command line invocation parameters (for an object or not) and properly parses and sets up the properties in a hash array. .IP "_Sock" 4 .IX Item "_Sock" Socket processing, including tests for persistence and opening. If no host is specified, localhost (127.0.0.1) is used. If no port is specified, uses the \s-1IANA\s0 allocated well known port (4304) for owserver. First looks in /etc/services, then just tries 4304. .IP "_ToServer" 4 .IX Item "_ToServer" Sends a message to owserver. Formats in owserver protocol. If a persistent socket fails, retries after new socket created. .IP "_FromServerBinaryParse" 4 .IX Item "_FromServerBinaryParse" Reads a specified length from server .IP "_FromServer" 4 .IX Item "_FromServer" Reads whole packet from server, using _FromServerBinaryParse (first for header, then payload). Discards ping packets silently. .IP "_BonjourLookup" 4 .IX Item "_BonjourLookup" Uses the mDNS service discovery protocol to find an available owserver. Employs NET::Rendezvous (an earlier name or Apple's Bonjour) This module is loaded only if available. (Uses the method of http://sial.org/blog/2006/12/optional_perl_module_loading.html) .SH "AUTHOR" .IX Header "AUTHOR" Paul H Alfille paul.alfille@gmail.com .SH "BUGS" .IX Header "BUGS" Support for proper timeout using the \*(L"select\*(R" function seems broken in perl. This might leave the routines vulnerable to network timing errors. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "http://www.owfs.org" 4 .IX Item "http://www.owfs.org" Documentation for the full \fBowfs\fR program suite, including man pages for each of the supported 1\-wire devices, and more extensive explanatation of owfs components. .IP "http://owfs.sourceforge.net/projects/owfs" 4 .IX Item "http://owfs.sourceforge.net/projects/owfs" Location where source code is hosted. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2007 Paul H Alfille. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. owfs-2.8p15/src/man/owmon.10000664000175000017500000000441411152551115012375 00000000000000'\" '\" Copyright (c) 2007 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for owtap -- 1-wire filesystem package '\" Protocol sniffer for owserver tcp protocol '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owmon.1,v 1.3 2009/03/01 18:22:05 alfille Exp $ '\" .TH OWMON 1 2007 "OWTAP Manpage" "One-Wire File System" .SH NAME .B owmon \- Monitor for owserver settings and statistics .SH SYNOPSIS .B owmon .I \-s owserver-tcp-port .br .SH "DESCRIPTION" .so description.1so .SS owserver .B owserver (1) is the backend component of the OWFS 1-wire bus control system. .B owserver (1) arbitrates access to the bus from multiple client processes. The physical bus is usually connected to a serial or USB port, and other processes connect to .B owserver (1) over network sockets (tcp port). .PP Frontend clients include a filesystem representation: .B owfs (1) , and a webserver: .B owhttpd (1). Direct language bindings are also available, e.g: .B owperl (3). .PP There are also many light-weight clients that can only talk to .B owserver (1) and not to the 1-Wire bus directly. They include shell and multiple language modules (perl, Visual Basic, python,...) .SS owserver protocol All the .B owserver (1) clients use the .B owserver protocol for communication. The .B owserver protocol is a well documented tcp/ip client/server protocol. Assigned the "well known port" default of 4304. .SS owmon .B owmon (1) is connects to .B owserver (1) and displays the bus structure and contents of the interface, statistics and settings directories. .SH SPECIFIC OPTIONS .SS \-s TCP port or IPaddress:port for .I owserver .br The tcp port (IP:port) for the "upstream" owserver. .SH EXAMPLE If .B owserver (1) is started: .br .B owserver -p 4304 -d /dev/ttyS0 .br owserver on tcp port 4304 and connects to a physical 1-wire bus on a serial port. .PP You can monitor .B owserver (1) with .br .B owmon -s 4304 / .SH PLATFOMS .B owmon (1) is a pure .I Tcl/TK program and will run whereever .I Tcl/TK is available (Windows, Macintosh, Linux, Unix) .SH LINKS .SS owserver protocol http://www.owfs.org/index.php?page=owserver-protocol .SS Tcl/TK http://www.tcl.tk .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS28EA00.30000664000175000017500000000564711542520452012302 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS28EA00.3,v 1.10 2011/03/24 01:40:58 alfille Exp $ '\" .TH DS28EA00 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS28EA00 \- 1-Wire Digital Thermometer with Sequence Detect and PIO .SH SYNOPSIS Thermometer, PIO and Chain. .PP .B 42 [.]XXXXXXXXXXXX[XX][/[ .so temperatures_mini.3so .B die | .B power | .B temphigh | .B templow | .B PIO.A|B|ALL.BYTE | .B latch.A|B|ALL.BYTE | .B sensed.A|B|ALL.BYTE .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 42 .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .SH TEMPERATURE PROPERTIES .SS temperature .I read-only, floating point .br Measured temperature with 12 bit resolution. .SS temperature9 temperature10 temperature11 temperature12 .I read-only, floating point Measured temperature at 9 to 12 bit resolution. There is a tradeoff of time versus accuracy in the temperature measurement. .SS fasttemp .I read-only, floating point .br Equivalent to .I temperature9 .SH PIO PROPERTIES .SS PIO.A|B|ALL|BYTE .I read-write, yes-no .br Two channels of sensors/switches. We use the logical raqther than eletrical interpretation: 0=off (non-conducting) 1=on (conducting -- to ground) .PP The .I PIO channels are alternatively used for the sequence-detect (chain) mode. .PP Reading .I sensed gives the inverse value of the cooresponding .I PIO. .PP Reading .I PIO gives the actual pin values. Use the .I latch property to see how the pin is set. .SS latch.A|B|ALL|BYTE .I read-only, yes-no .br Set (intended) va;ue of the .I PIO pins. .SS sensed.A|B|ALL|BYTE .I read-only, yes-no .br Actual logical level at the .I PIO pins. .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .so temperature_threshold.3so .SH STANDARD PROPERTIES .so standard.3so .SH DESCRIPTION .so description.3so .SS DS28EA00 The .B DS28EA00 (3) is one of several available 1-wire temperature sensors. It is the replacement for the .B DS18S20 (3) Alternatives are .B DS1822 (3) as well as temperature/vlotage measurements in the .B DS2436 (3) and .B DS2438 (3). For truly versatile temperature measurements, see the protean .B DS1921 (3) Thermachron (3). .br The .B DS28EA00 has special switch/sequence detect properties. In sequence mode, the PIO pins are daisy-chained to the next DS28EA00, allowing the system to step through the physical sequence of the DS28EA00s. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS28EA00.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/job_control.1so0000664000175000017500000000245411152550602014114 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: job_control.1so,v 1.1 2009/03/01 18:18:42 alfille Exp $ '\" .SH JOB CONTROL OPTIONS .SS \-r \-\-readonly .SS \-w \-\-write Do we allow writing to the 1-wire bus (writing memory, setting switches, limits, PIOs)? The .I write option is available for symmetry, it's the default. .SS \-P \-\-pid-file "filename" Places the PID -- process ID of owfs into the specified filename. Useful for startup scripts control. .SS \-\-background | \-\-foreground Whether the program releases the console and runs in the .I background after evaluating command line options. .I background is the default. .SS \-\-error_print=0|1|2|3 .TP .I =0 default mixed destination: stderr foreground / syslog background .TP .I =1 syslog only .TP .I =2 stderr only .TP .I =3 /dev/null (quiet mode). .SS \-\-error_level=0..9 .TP .I =0 default errors only .TP .I =1 connections/disconnections .TP .I =2 all high level calls .TP .I =3 data summary for each call .TP .I =4 details level .TP .I >4 debugging chaff .PP .I --error_level=9 produces a lot of output owfs-2.8p15/src/man/DS2415.30000664000175000017500000000602711535561503012073 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2415.3,v 1.18 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2415 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2415 \- 1-Wire Time Chip .br DS1904 \- RTC iButton .br DS2417 \- 1-Wire Time Chip with Interrupt .SH SYNOPSIS Real time clock. .br .B 24 [.]XXXXXXXXXXXX[XX][/[ .B date | .B flags | .B running | .B udate | .so standard_mini.3so ]] .PP Clock with interrupts .br .B 27 [.]XXXXXXXXXXXX[XX][/[ .B date | .B enable | .B interval | .B itime | .B running | .B udate | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 24 DS2415 DS1904 .TP .I 27 DS2417 .SH SPECIAL PROPERTIES .SS date .I read-write, ascii .br 26 character date representation of the .I counter value. Increments once per second while .I running .br Setting .I date to a null string will put the current system time. .br Accepted date formats are: .br Sat[urday] March 12 12:23:59 2001 .br Apr[il] 4 9:34:56 2002 .br 3/23/04 23:34:57 .br current locale setting (your system's format) .SS enable .I read-write, yes-no .br State of the timer interrupt. 0=off 1=running. .SS interval .I read-write, unsigned integer .br Interval between timer interrupts. Values: 0-7. See table under .I DESCRIPTION for interpretation. .I itime will reflect the .I interval chosen. .SS itime .I read-write, unsigned integer .br Interval between timer interrupts. Value in seconds. See table under .I DESCRIPTION for interpretation and acceptable values. .I interval will reflect the .I itime chosen. .SS flags .I read-write, unsigned integer .br General use data. 4 bits (0-15 accepted values). .SS running .I read-write, yes-no .br State of the clock. 0=off 1=running. .SS udate .I read-write, unsigned integer .br Time represented as a number. .I udate increments once per second, while .I running is on. .br Usually set to unix time standard: number of seconds since Jan 1, 1970. The .I date field will be the unix representation of .I udate and setting either will change the other. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None implemented. .SH DESCRIPTION .so description.3so .SS DS2415 DS1904 The .B DS2415 (3) and .B DS1904 (3) are simple clocks that can be read on the 1-wire bus. They can also be used the time an event, for remote confirmation. .P .SS DS2417 The .B DS2417 has the same clock function, but also includes a programmable interval interrupt. Values Allowed are: .br 0 1sec .br 1 4sec .br 2 32s = .5m .br 3 6 = 1m .br 4 2048s = .5h .br 5 4096s = 1h .br 6 65536s = 18h .br 7 131072s = 36h .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2415.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1904.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2417.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2762.30000664000175000017500000000001510244633637012073 00000000000000.so DS2760.3 owfs-2.8p15/src/man/addressing.3so0000664000175000017500000000142311152543241013723 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: addressing.3so,v 1.1 2009/03/01 17:32:17 alfille Exp $ '\" All 1-wire devices are factory assigned a unique 64-bit address. This address is of the form: .TP .B Family Code 8 bits .TP .B Address 48 bits .TP .B CRC 8 bits .IP .PP Addressing under OWFS is in hexidecimal, of form: .IP .B 01.123456789ABC .PP where .B 01 is an example 8-bit family code, and .B 12345678ABC is an example 48 bit address. .PP The dot is optional, and the CRC code can included. If included, it must be correct. owfs-2.8p15/src/man/DS1993.30000664000175000017500000000303111535561503012075 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1993.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1993 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1993 \- 4kbit Memory iButton .SH SYNOPSIS Non-volatile memory. .PP .B 06 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-15|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 06 DS1996 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 512 bytes of memory. .SS pages/page.0 ... pages/page.15 pages/page.ALL .I read-write, binary .br Memory is split into 16 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1993 The .B DS1993 (3) is an iButton with static memory. Data is read/written with error checking (transparent to the user). The .B DS1992 , .B DS1993 , .B DS1995 , and .B DS1996 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically.) .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1992-DS1993.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2438.30000664000175000017500000002200111607632732012071 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2438.3,v 1.34 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2438 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME .B DS2438 \- Smart Battery Monitor .SH SYNOPSIS .SS Temperature Voltages and Current. .PP .B 26 [.]XXXXXXXXXXXX[XX][/[ .B CA | .B EE | .B date | .B disconnect/date | .B disconnect/udate | .B endcharge/date | .B endcharge/udate | .B IAD | .B offset | .B pages/page.[0-7|ALL] | .B temperature | .B udate | .B VAD | .B VDD | .B vis | .so standard_mini.3so ]] .SS Humidity sensor .PP .B 26 [.]XXXXXXXXXXXX[XX][/[ .B HIH4000/humidity | .B HTM1735/humidity | .B DATANAB/reset | .B DATANAB/humidity | .B humidity | .B temperature ]] .SS Barometer .PP .B 26 [.]XXXXXXXXXXXX[XX][/[ .B B1-R1-A/pressure | .B B1-R1-A/gain | .B B1-R1-A/offset | ]] .SS Light .PP .B 26 [.]XXXXXXXXXXXX[XX][/[ .B S3-R1-A/current | .B S3-R1-A/illuminance | .B S3-R1-A/gain ]] .SH FAMILY CODE .PP .I 26 .SH SPECIAL PROPERTIES .SS pages/page.0 ... pages/page.7 pages/page.ALL .I read-write, binary .br Memory is split into 8 pages of 8 bytes each. Only the pages 3-7 are really available, and some of that appears to be reserved. See the datasheet for details. .\" page.3/0 = Multisensor .\" page.3/2-7 = Hobby Boards Calibration data .\" page.4 = .\" page.5 = .\" page.7/4-7 = current storage .br .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. Conversion takes ~20 msec. .SS VAD VDD .I read-only, floating point .br Voltage read (~10 bits) at the one of the chip's two supply voltages. Range VDD= 2.4V to 10V, VAD=1.5 to 10V. .SS vis .I read-only, floating point .br Current sensor reading, as a voltage difference. Value is in volts. .br Actual current depends on Rsens resistor (see datasheet). .br The formula for current is I = vis / Rsens .br with units in Amps and Ohms. .br Current measurement will be temporarily enabled (see .I Ienable ) if not currently enabled (pun intended) for this reading. .SH CONFIGURATION PROPERTIES .SS CA .I read-write, yes-no .br .I Current Accumulator Configuration flag bit. If "on" (1) current is stored in page 7 bytes 4-7. If "off" (0) that page can be used for general storage. See the datasheet for more information. .SS EE .I read-write, yes-no .br .I Current Accumulator Shadow flag bit. If "on" (1) current reading is stored to EEPROM. If "off" (0) that data will be lost when chip loses power. See the datasheet for more information .SS IAD .I read-write, yes-no .br .I Current A/D Control flag bit. If "on" (1) current measured at 36.41 Hz. If "off" (0) current measurements won't be made. See the datasheet for more information. .SH DATE PROPERTIES .SS date .I read-write, ascii .br 26 character date representation of the .I counter value. Increments once per second. .br Setting .I date to a null string will put the current system time. .br Accepted date formats are: .br Sat[urday] March 12 12:23:59 2001 .br Apr[il] 4 9:34:56 2002 .br 3/23/04 23:34:57 .br current locale setting (your system's format) .SS disconnect/date .I read-write, ascii .br 26 character date representation of the .I disconnect/udate value. Time when the battery pack waws removed from the charger. Format is the same as the .I date property. .SS disconnect/udate .I read-write, unsigned integer .br Representation of .I disconnect/date as a number. See .I udate for details. .SS endcharge/date .I read-write, ascii .br 26 character date representation of the .I endcharge/udate value. Format is the same as the .I date property. .SS endcharge/udate .I read-write, unsigned integer .br Representation of .I endcharge/date as a number. See .I udate for details. .SS udate .I read-write, unsigned integer .br Time represented as a number. .I udate increments once per second. .br Usually set to unix time standard: number of seconds since Jan 1, 1970. The .I date field will be the unix representation (ascii text) of .I udate and setting either will change the other. .SH HUMIDITY PROPERTIES .SS HIH4000/humidity .I read-only, floating point .br Relative humidity, as percent (1-100 scale). .br This value is for a design based on Honeywell's HIH-4000 humidity sensor. .SS HTM1735/humidity .I read-only, floating point .br Relative humidity, as percent (1-100 scale). .br This value is for a design based on Humirel's HTM-1735 humidity sensor. .SS DATANAB/humidity .I read-only, floating point .br Based on DataNAB's humidity sensor. It uses a HIH-4000 sensor and the current sensning rather than voltage readings from the DS2438. Calibration values are stored on chip, and a check field is stored in chip memory. .SS DATANAB/reset .I write-only, yes-no .br Used to read calibration values and set the chip to current reading more. Should be automatically called when a humidity reading is requested. .SS humidity .I read-only, floating point .br Relative humidity, as percent (1-100 scale). .br The .B DS2438 actually does not read humidity, but a widely available and publicised circuit based on the chip, does. This design is for the common Honeywell HIH-3610 humidity chip. The mostly compatible HIH-4000 chip uses different temperature compensation, so is better read from the .I HIH4000/humidity value. See the datasheets for details. .br If the chip is instead a DATANAB design, the .I DATANAB/humidity value will be automatically used. .SH BAROMETER PROPERTIES .SS B1-R1-A/pressure .I read-only, floating point .br Pressure reading, as milli-bars, or other unit depending on .IR settings/units/pressure_scale . .br This value is for the B1-R1-A barometer from Hobby-Boards, and assumes the standard calibration. .SS B1-R1-A/gain .I read/write, floating point .br Calibration of pressure gain, as signed number, expressed as the same units as .I B1-R1-A/pressure per volt. .br This value will be multiplied with the measured voltage to get the .I B1-R1-A/pressure reading. It may have to be fine tuned for calibration purposes, although with the standard sensor, it will often be good enough to keep it as is. .SS B1-R1-A/offset .I read/write, floating point .br Calibration of pressure offset, as signed number, same units as .I B1-R1-A/pressure. .br This value will be added to the .I B1-R1-A/pressure reading. The default value is 904.7 millibars, which may be altered to to compensate for elevation. .SH SOLAR SENSOR PROPERTIES .SS S3-R1-A/current .I read-only, floating point .br Photo-diode current, in micro-amperes. .br This value is for the S3-R1-A solar radiation sensor from Hobby-Boards. Due to noise and offsets, this value may read as a negative number in low light conditions. The .I offset register can be modified to reduce the offset as much as possible. .SS S3-R1-A/illumination .I read-only, floating point .br Illumination, in lux. Always a positive number. .br This value is the lux reading from the solar sensor, taking .I S3-R1-A/gain into consideration. .SS S3-R1-A/gain .I read/write, floating point .br Calibration of photo-diode gain expressed as lux per micro-amperes. The default value is for the SFH203P photo-diode from Osram, used bare. A different gain may be used for instance to compensate for an integrathing, white sphere placed over the diode. .br This value is for the S3-R1-A solar radiation sensor from Hobby-Boards, using the SFH203P photo-diode from Osram. .SH MULTISENSOR PROPERTIES .SS MultiSensor/type .I read-only, ascii .br For .I iButtonLink's MultiSensor line of 1-wire devices, give the specific configuration based on a data byte set in memory. (Byte 0 of page 3). This can help interpretation of the sensor values, distinguishing, current from water from light. .SS offset .I read-write, integer .br Correction for .I current readings. A value between \-256 and 255. See the datasheet for details. Should be set to the negative of a true zero .I current reading. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2438 The .B DS2438 (3) is a more complete form of the .B DS2436 battery chip. Current sensing is available, but not implemented. The major advantage compared to the .B DS2436 is that two voltages can be read, allowing correcting circuit nmeasurements to supply voltage and temperature. A better comparison is the .B DS276x family of chips. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2438.pdf .br http://pdfserv.maxim-ic.com/en/an/humsensor.pdf .br http://goo.gl/o9DH0 (Redirects to 009012_2.pdf PDF file on honeywell.com website) .br http://www.phanderson.com/hih-4000.pdf .br http://www.humirel.com/product/fichier/HTM1735%20RevG%20.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) Egil Kvaleberg owfs-2.8p15/src/man/DS18S20.30000664000175000017500000000344011535561503012211 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS18S20.3,v 1.19 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS18S20 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS18S20 \- High-Precision 1-Wire Digital Thermometer .br DS1920 \- iButton version of the thermometer .SH SYNOPSIS Thermometer. .PP .B 10 [.]XXXXXXXXXXXX[XX][/[ .B die | .B power | .B temperature | .B temphigh | .B templow | .B trim | .B trimblanket | .B trimvalid | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 10 .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~12 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. Conversion takes 1000 msec. .so temperature_threshold.3so .so temperature_errata.3so .SH STANDARD PROPERTIES .so standard.3so .SH DESCRIPTION .so description.3so .SS DS18S20 DS1920 The .B DS18S20 (3) is one of several available 1-wire temperature sensors. It has been largely replaced by the .B DS18B20 (3) and .B DS1822 (3) as well as temperature/vlotage measurements in the .B DS2436 (3) and .B DS2438 (3). For truly versatile temperature measurements, see the protean .B DS1921 (3) Thermachron (3). .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS18S20.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/EDS0067.30000664000175000017500000000001211531345773012172 00000000000000.so EDS.3 owfs-2.8p15/src/man/device.1so0000664000175000017500000002031111542520452013034 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: device.1so,v 1.4 2011/03/24 01:40:58 alfille Exp $ '\" .SH "Device Options (1-wire Bus Master)" These options specify the device (bus master) connecting the computer to the 1-wire bus. The 1-wire slaves are connected to the 1-wire bus, and the bus master connects to a port on the computer and controls the 1-wire bus. The bus master is either an actual physical device, the kernel w1 module, or an .B owserver (1). .P At least one device option is required. There is no default. More than one device can be listed, and all will be used. (A logical union unless you explore the \fI/bus.n/\fR directories.) .P Linux and BSD enforce a security policy restricting access to hardware ports. You must have sufficient rights to access the given port or access will silently fail. .SH "* Serial devices" .I port specifies a serial port, e.g. .I /dev/ttyS0 .TP \fI-d port\fI \fR|\fR \fI--device=port\fI \fB(DS2480B)\fB DS2480B-based bus master (like the DS9097U or the LINK in emulation mode). If the adapter doesn't respond, a passive type (DS9907E or diode/resistor) circuit will be assumed. .TP .I --serial_flextime | --serial_regulartime \fB(DS2480B)\fB .br Changes details of bus timing (see DS2480B datasheet). Some devices, like the .I Swart LCD cannot work with .I flextime. .TP \fI--baud=\fI\fR1200|9600|19200|38400|57600|115200\fR \fB(DS2480B,LINK,HA5)\fB Sets the initial serial port communication speed for all bus masters. Not all serial devices support all speeds. You can change the individual bus master speed for the .B LINK and .B DS2880B in the interface/settings directory. The .B HA5 speed is set in hardware, so the command line buad rate should match that rate. .br Usually the default settings (9600 for .B LINK and .B DS2480B ) and 115200 for the .B HA5 are sane and shouldn't be changed. .TP \fI--straight_polarity\fI \fR|\fR \fI--reverse_polarity\fI \fB(DS2480B)\fB Reverse polarity of the DS2480B output transistors? Not needed for the DS9097U, but required for some other designs. .TP \fI--link=port\fI \fB(LINK)\fB .B iButtonLink .I LINK adapter (all versions) in non-emulation mode. Uses an ascii protocol over serial. .TP \fI--ha7e=port\fI \fB(HA7E)\fB .B Embedded Data Systems .I HA7E adapter ( and .I HA7S ) in native ascii mode. .TP \fI\-\-ha5=port | \-\-ha5=port:a | \-\-ha5=port:acg\fI \fB(HA5)\fB .B Embedded Data Systems .I HA5 mutidrop adapter in native ascii mode. Up to 26 adapters can share the same port, each with an assigned letter. If no letter specified, the program will scan for the first response (which may be slow). .TP .I --checksum | --no_checksum \fB(HA5)\fB .br Turn on (default) or off the checksum feature of the HA5 communication. .TP \fI--passive=port\fR | \fI--ha2=port\fR | \fI--ha3=port\fR | \fI--ha4b=port \fB(Passive)\fB Passive 1-wire adapters. Powered off the serial port and using passive electrical components (resitors and diodes). .TP .I --8bit | --6bit \fB(Passive)\fB .br Synthesize the 1-wire waveforme using a 6-bit (default) serial word, or 8-bit word. Not all UART devices support 6 bit operation. .TP \fI--timeout_serial=5\fI Timeout (in seconds) for all serial communications. 5 second default. Can be altered dynamically under .I /settings/timeout/serial .SH "* USB devices" The only supported true USB bus masters are based on the DS2490 chip. The most common is the DS9490R which has an included 1-wire ID slave with family code 81. .P There are also bus masters based on the serial chip with a USB to serial conversion built in. These are supported by the serial bus master protocol. .TP .I \-u \fR|\ \fI\-\-usb DS2490 based bus master (like the DS9490R). .TP .I \-u2 \fR|\ \fI\-\-usb=2 Use the second USB bus master. (The order isn't predicatble, however, since the operating system does not conssitently order USB devices). .TP .I \-uall \fR|\ \fI\-\-usb=ALL Use all the USB devices. .TP .I \-\-usb_flextime | \-\-usb_regulartime Changes the details of 1-wire waveform timing for certain network configurations. .TP .I \-\-altusb Willy Robion's alternative USB timing. .TP .I \-\-timeout_usb=5 Timeout for USB communications. This has a 5 second default and can be changed dynamically under .I /settings/timeout/usb .SH "* I2C devices" I2C is 2 wire protocol used for chip-to-chip communication. The bus masters: .I DS2482-100, DS2482-101 and .I DS2482-800 can specify (via pin voltages) a subset of addresses on the i2c bus. Those choices are .P .I i2c_address .TP 0,1,2,3 0x18,0x19,0x1A,0x1B .TP 4,5,6,7 0x1C,0x1D,0x1E,0x1F (DS2482-800 only) .P .I port for i2c masters have the form .I /dev/i2c-0, /dev/i2c-1, ... .TP \fI\-d port\fR | \fI\-\-device=port This simple form only permits a specific .I port and the first available .I i2c_address .TP \fI\-\-i2c=port\fR | \fI\-\-i2c=port:i2c_address\fR | \fI\-\-i2c=port:ALL Specific i2c .I port and the .I i2c_address is either the first, specific, or all or them. The .I i2c_address is 0,1,2,... .TP \fI\-\-i2c\fR | \fI\-\-i2c=:\fR | \fI\-\-i2c=ALL:ALL Search the available i2c buses for either the first, the first, or every i2c adapter. .P The .I DS2482-800 masters 8 1-wire buses and so will generate 8 .I /bus.n entries. .SH "* Network devices" These bus masters communicate via the tcp/ip network protocol and so can be located anywhere on the network. The .I network_address is of the form tcp_address:port .P E.g. 192.168.0.1:3000 or localhost:3000 .TP .I \-\-link=network_address LinkHubE network LINK adapter by .B iButtonLink .TP .I \-\-ha7net=network_address | \-\-ha7net HA7Net network 1-wire adapter with specified tcp address or discovered by udp multicast. By .B Embedded Data Systems .br .I \-\-timeout_ha7=60 specific timeout for HA7Net communications (60 second default). .TP .I \-\-etherweather=network_address Etherweather adapter .TP \fI\-s network_address\fR | \fI\-\-server=network_address Location of an .B owserver (1) program that talks to the 1-wire bus. The default port is 4304. .TP .I \-\-timeout_network=5 Timeout for network bus master communications. This has a 1 second default and can be changed dynamically under .I /settings/timeout/network .SH "* Simulated devices" Used for testing and development. No actual hardware is needed. Useful for separating the hardware development from the rest of the software design. .TP .I devices is a list of comma-separated 1-wire devices in the following formats. Note that a valid CRC8 code is created automatically. .TP 10,05,21 Hexidecimal .I family codes (the DS18S20, DS2405 and DS1921 in this example). .TP 10.12AB23431211 A more complete hexidecimal unique address. Useful when an actual hardware device should be simulated. .TP DS2408,DS2489 The 1-wire device name. (Full ID cannot be speciifed in this format). .TP .I \-\-fake=devices Random address and random values for each read. The device ID is also random (unless specified). .TP .I \-\-temperature_low=12 \-\-temperature_high=44 Specify the temperature limits for the .I fake adapter simulation. These should be in the same temperature scale that is specified in the command line. It is possible to change the limits dynamically for each adapter under .I /bus.x/interface/settings/simulated/[temperature_low|temperature_high] .TP .I \-\-tester=devices Predictable address and predictable values for each read. (See the website for the algorhythm). .SH "* w1 kernel module" This a linux-specific option for using the operating system's access to bus masters. Root access is required and the implementation was still in progress as of owfs v2.7p12 and linux 2.6.30. .P Bus masters are recognized and added dynamically. Details of the physical bus master are not accessible, bu they include USB, i2c and a number of GPIO designs on embedded boards. .P Access is restrict to superuser due to the netlink broadcast protocol employed by w1. Multitasking must be configured (threads) on the compilation. .TP .I \-\-w1 Use the linux kernel w1 virtual bus master. .TP .I \-\-timeout_w1=10 Timeout for w1 netlink communications. This has a 10 second default and can be changed dynamically under .I /settings/timeout/w1 owfs-2.8p15/src/man/DS2506.30000664000175000017500000000431611535561503012073 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2506.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2506 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2506 \- Add-Only Memory (64 kBit) .br DS2506-UNW \- UniqueWare Add-Only Memory (64 kBit) .br DS1986 \- Add-Only iButton (64 kBit) .br DS1986U \- UniqueWare iButton (64 kBit) .SH SYNOPSIS EPROM add-only memory. .PP .B 0F [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-255|ALL] | .so standard_mini.3so ]] .HP .B 8F [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-255|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 0F DS2506 DS1986 .TP .I 8F DS2506-UNW DS1986U .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 8192 bytes of memory. Initially all bits are set to 1. Writing zero permanently alters the memory. .SS pages/page.0 ... pages/page.255 pages/page.ALL .I read-write, yes-no .br Memory is split into 256 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2506 DS1986 The .B DS2506 (3) is used for write-once incremental storage. It's main advantage is for audit trails (i.e. a digital purse). .PP The .B DS2506-UNW is one of the .I UniqueWare class of devices. Some of the memory was preprogramed at the factory. See the datasheet for specifics. The .B DS2502 , .B DS2505 , and .B DS2506 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2506.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2502-UNW-DS2506S-UNW.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1986-F3-DS1986-F5.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1982U-DS1986U.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2720.30000664000175000017500000000420211535561503012063 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2720.3,v 1.10 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2720 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2720 \- Efficient Addressable Single-cell Rechargeable Lithium Protection IC .SH SYNOPSIS Memory and warnings. .PP .B 31 [.]XXXXXXXXXXXX[XX][/[ .B lock.[0-1|ALL] | .B memory | .B pages/page.[0-1|ALL] | .br .B cc | .B ce | .B dc | .B de | .B doc | .B ot | .B ov | .B psf | .B uv | .br .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 31 .SH SPECIAL PROPERTIES .SS lock.[0-1|ALL] .I read-write, yes-no .br Lock either of the two eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-1|ALL] .I read-write, binary Two 8 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SH OBSCURE PROPERTIES .SS cc ce dc de doc ot ov uv .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2720 The .B DS2720 (3) is a battery charging monitor. Besides it's intended use, it may have use in monitoring for device failures. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2720.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/EDS0064.30000664000175000017500000000001211531345773012167 00000000000000.so EDS.3 owfs-2.8p15/src/man/EDS0072.30000664000175000017500000000001211531345773012166 00000000000000.so EDS.3 owfs-2.8p15/src/man/description.nso0000664000175000017500000000402611152544732014226 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: description.nso,v 1.1 2009/03/01 17:46:02 alfille Exp $ '\" .SS 1-Wire .I 1-wire is a wiring protocol and series of devices designed and manufactured by Dallas Semiconductor, Inc. The bus is a low-power low-speed low-connector scheme where the data line can also provide power. .PP Each device is uniquely and unalterably numbered during manufacture. There are a wide variety of devices, including memory, sensors (humidity, temperature, voltage, contact, current), switches, timers and data loggers. More complex devices (like thermocouple sensors) can be built with these basic devices. There are also 1-wire devices that have encryption included. .PP The 1-wire scheme uses a single .I bus master and multiple .I slaves on the same wire. The bus master initiates all communication. The slaves can be individually discovered and addressed using their unique ID. .PP Bus masters come in a variety of configurations including serial, parallel, i2c, network or USB adapters. .SS OWFS design .I OWFS is a suite of programs that designed to make the 1-wire bus and its devices easily accessible. The underlying priciple is to create a virtual filesystem, with the unique ID being the directory, and the individual properties of the device are represented as simple files that can be read and written. .PP Details of the individual slave or master design are hidden behind a consistent interface. The goal is to provide an easy set of tools for a software designer to create monitoring or control applications. There are some performance enhancements in the implementation, including data caching, parallel access to bus masters, and aggregation of device communication. Still the fundemental goal has been ease of use, flexibility and correctness rather than speed. owfs-2.8p15/src/man/DS1920.30000664000175000017500000000001610244633637012067 00000000000000.so DS18S20.3 owfs-2.8p15/src/man/DS1963S.30000664000175000017500000000323111535561503012217 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1963S.3,v 1.8 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1963S 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1963S \- 256 byte Monetary iButton with SHA-1 .SH SYNOPSIS Non-volatile R/W memory with counters, SHA-1 (under NDA) .PP .B 18 [.]XXXXXXXXXXXX[XX][/[ .B pages/count.[0-15|ALL] | .B memory | .B pages/page.[0-15|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 18 .SH SPECIAL PROPERTIES .SS page/count.[0-15|ALL] .I read-only, unsigned .br Each write to the memory page increments the counter. An application can tell if the memory has been changed by another process. .P Only 4 pages are actually connected to counters: .TP Counter1 .I page/counter.12 .TP Counter2 .I page/counter.13 .TP Counter3 .I page/counter.14 .TP Counter4 .I page/counter.15 .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1963S The .B DS1963S (3) is used for read/write storage. It has SHA-1 authentication. Most of the information is under NDA and was not available for either the implementation of this man page. .P This man page corresponds to the non-secret .B DS1963L (3) .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2822 .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2423.30000664000175000017500000000447511535561503012077 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2423.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2423 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2423 \- 4kbit 1-Wire RAM with Counter .SH SYNOPSIS RAM and counters. .PP .B 1D [.]XXXXXXXXXXXX[XX][/[ .B counters.[A|B|ALL] | .B memory | .B pages/page.[0-15|ALL] | .B pages/count.[0-15|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1D .SH SPECIAL PROPERTIES .SS counters.A counters.B counters.ALL .I read-only, unsigned integer .br Debounced external counter. Associated with RAM .I page.14 and .I page.15 Note: counter increments only. It is reset when the chip loses power. .br .I ALL returns the two values, separated by a comma. They are read sequentially. .SS memory .I read-write, binary .br 512 bytes of memory. .SS pages/page.0 ... pages/page.15 pages/page.ALL .I read-write, binary .br Memory is split into 16 pages of 32 bytes each. Memory is RAM, contents are lost when power is lost. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS pages/count.0 ... pages/count.15 pages/count.ALL .I read-only, unsigned integer .br Write access to each page of memory. Actually only .I page.12 and .I page.13 have write counters. .br .I page14 and .I page.15 \'s counters are associated with the external .I counters.A and .I counters.B triggers. .br The value 0xFFFFFFFF is returned for .I pages/count.0 through .I pages/count.11 .br .I ALL is an aggregate of the counters, comma separated. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2423 The .B DS2423 (3) is used for its counters. The internal counters (associated with pages 12 and 13) can detect memory tampering. .PP The external counters A and B page been used in circuit design, such as a wind anometer. .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2423.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/EEEF.30000644000175000017500000000735411743022103011744 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: EEEF.3,v 1.7 2012/04/16 13:53:07 alfille Exp $ '\" .TH HobbyBoards_EE/EF 3 2009 "OWFS Manpage" "One-Wire File System" .SH NAME EEEF \- HobbyBoards EE/EF Microprocessor-based slaves .br UVI \- Ultra Violet (UV) Index sensor .br Moisture \- Soild and Leaf moisture measurements .SH SYNOPSIS General EE device .br .B EE [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B version | .B type_number | .B temperature_offset | .so standard_mini.3so ]] .PP UVI sensor .br .B EE [.]XXXXXXXXXXXX[XX][/[ .B UVI/UVI | .B UVI/UVI_offset | .B UVI/in_case | .B UVI/valid | .B temperature | .B version | .B type_number | .B temperature_offset ]] .PP General EF device .br .B EF [.]XXXXXXXXXXXX[XX][/[ .B version | .B type_number | .so standard_mini.3so ]] .PP Moisture Meter .br .B Moisture/sensor.[0-3|ALL] .SH FAMILY CODE .TP .I EE Device with temperature .TP .I EE UVI .TP .I EF Device without temperature .TP .I EF Moisture Meter .SH TEMPERATURE PROPERTIES .SS temperature .I read-only, floating point .br Temperature read every 30 seconds. Resolution .5C (uses an on-board DS18B20). Temperature is only present in the EE-series devices. .SS temperature_offset .I read-write, floating point .br Offset stored on device to apply to temperature readings. .SH UVI PROPERTIES .SS UVI/UVI .I read-only floating point .br UV Index (ultraviolet index) in the range 0.0 to 16.0 resolution .1 .PP Only the UVI version of the EE device has a UVI sensor. Readings made every .5 seconds. .SS UVI/UVI_offset .I read-write, floating point .br Signed offset to apply to the UVI measurement. Stored on-device non-volatile. .SS UVI/in_case .I read-write, yes-no .br Flag to apply compensation for the protective case. Stored on-device non-volatile. .SS UVI/valid .I read-only, yes-no Flag the the EE device type matches the known UVI type. .SH Moisture Meter .SS moisture/sensor.0 .. moisture/sensor.3 moisture/sensor.ALL .I read-only integer .br Up to 4 sensors reading moisture can be attached. .I OWFS addresses the sensors as 0 through 3 while the datasheet uses 1-4. Two types of external sensors are supported (and the data range): .TP Watermark Soil Moisture Sensor 0-199 .TP Leaf Wetness Sensor 0-99 .SH IDENTIFICATION PROPERTIES .SS version .I read-only, ascii .br Firmware version for the EE/EF device. Reported in HH.HH format where HH is a hex digit (0-9A-F). .SS type_number .I read-only, integer .br Index of the type of sensor built into this device. Current known assignments: .TP 1 UVI (Ultraviolet index) .TP 2 Moisture meter .TP 3 Moisture meter with datalogger .TP 4 Sniffer .TP 5 Hub .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None .SH DESCRIPTION .so description.3so .SS EE / EF The .B EEEF (3) are a reference platform of microprocessor based 1-wire slaves. In general they require external power, and have an on-board index for the specific capabilities. They are designed by Eric Vickery at HobbyBoards.com .PP The .I EE class device uses family code EE and has an included temperature sensor. The .I EF devices have no temperature sensor, .SS UVI The .I UVI sensor is an implementation of the .I EE class device with Ultra Violet Index sensing. All it's specific properties are in the .I UVI/ directory. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://www.hobby-boards.com/catalog/links/uvi2-r1/UVI%20Meter%20User%20Manual.pdf .br http://www.hobby-boards.com/download/manuals/Moisture%20Meter.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1996.30000664000175000017500000000302711535561503012105 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1996.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1996 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1996 \- 64kbit Memory iButton .SH SYNOPSIS Non-volatile memory. .PP .B 0C [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-255|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 0C DS1996 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 8192 bytes of memory. .SS pages/page.0 ... pages/page.255 pages/page.ALL .I read-write, binary .br Memory is split into 256 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1996 The .B DS1996 (3) is an iButton with static memory. Data is read/written with error checking (transparent to the user). The .B DS1992 , .B DS1993 , .B DS1995 , and .B DS1996 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically.) .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1996.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2502-UNW.30000664000175000017500000000001510244633637012532 00000000000000.so DS2502.3 owfs-2.8p15/src/man/EDS0066.30000664000175000017500000000001211531345773012171 00000000000000.so EDS.3 owfs-2.8p15/src/man/configuration.1so0000664000175000017500000000076011152543747014463 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: configuration.1so,v 1.1 2009/03/01 17:37:43 alfille Exp $ '\" .SH CONFIGURATION FILE .SS -c file | --configuration file Name of an .B owfs (5) configuration file with more command line parameters owfs-2.8p15/src/man/DS2430A.30000664000175000017500000000270711535561503012172 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2430A.3,v 1.10 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2430A 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2430A \- Quad A/D Converter .SH SYNOPSIS EEPROM .PP .B 14 [.]XXXXXXXXXXXX[XX][/[ .B application | .B status | .B memory | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 14 .SH SPECIAL PROPERTIES .SS application .I read-write, binary .br 8 bytes of data. Write once, then .I status is 0xFC and further writing is impossible. .SS status .I read-only, unsigned integer .br Is the .I application area locked? .TP 0xFF Application area untouched .TP 0xFC Applcation area locked .SS memory .I read-write, binary .br 32 bytes of data. (256 bits) .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2430A The .B DS2430A (3) is a memory 1-wire chip. It is considered obsolete and newer designs are supposed to use the .B DS2431 (3) .P The .B DS1971 (3) is an iButton version of the same device. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2430A-DS2430AP.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/ow.n0000664000175000017500000000001511370256757011771 00000000000000.so owtcl.n owfs-2.8p15/src/man/description.3so0000664000175000017500000000402611152544732014133 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: description.3so,v 1.1 2009/03/01 17:46:02 alfille Exp $ '\" .SS 1-Wire .I 1-wire is a wiring protocol and series of devices designed and manufactured by Dallas Semiconductor, Inc. The bus is a low-power low-speed low-connector scheme where the data line can also provide power. .PP Each device is uniquely and unalterably numbered during manufacture. There are a wide variety of devices, including memory, sensors (humidity, temperature, voltage, contact, current), switches, timers and data loggers. More complex devices (like thermocouple sensors) can be built with these basic devices. There are also 1-wire devices that have encryption included. .PP The 1-wire scheme uses a single .I bus master and multiple .I slaves on the same wire. The bus master initiates all communication. The slaves can be individually discovered and addressed using their unique ID. .PP Bus masters come in a variety of configurations including serial, parallel, i2c, network or USB adapters. .SS OWFS design .I OWFS is a suite of programs that designed to make the 1-wire bus and its devices easily accessible. The underlying priciple is to create a virtual filesystem, with the unique ID being the directory, and the individual properties of the device are represented as simple files that can be read and written. .PP Details of the individual slave or master design are hidden behind a consistent interface. The goal is to provide an easy set of tools for a software designer to create monitoring or control applications. There are some performance enhancements in the implementation, including data caching, parallel access to bus masters, and aggregation of device communication. Still the fundemental goal has been ease of use, flexibility and correctness rather than speed. owfs-2.8p15/src/man/help.1so0000664000175000017500000000150411152547576012545 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: help.1so,v 1.1 2009/03/01 18:10:06 alfille Exp $ '\" .SH HELP OPTIONS See also this man page and the web site http://www.owfs.org .SS \-h \-\-help=[device|cache|program|job|temperature] Shows basic summary of options. .TP .I device 1-wire bus master options .TP .I cache cache and communication size and timing .TP .I program mountpoint or TCP server settings .TP .I job control and debugging options .TP .I temperature Unique ID display format and temperature scale .SS \-V \-\-version .I Version of this program and related libraries. owfs-2.8p15/src/man/EDS.30000664000175000017500000002505111612101332011644 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: EDS.3,v 1.9 2011/07/21 19:49:46 alfille Exp $ '\" .TH EDS00xx 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME EDS \-Embedded Data Systems Sensors .br EDS0064 \-Temperature .br EDS0065 \-Temperature and Humidity .br EDS0066 \-Temperature and Barometric Pressure .br EDS0067 \-Temperature and Light .br EDS0068 \-Temperature, Barometric Pressure and Light .br EDS0071 \-RTD 4-wire temperature .br EDS0072 \-RTD 3-wire temperature .SH SYNOPSIS .B Embedded Data Systems microprocessor-based sensors .SS Sub-type ( all ) .B 7E [.]XXXXXXXXXXXX[XX][/[ .B device_id | .B device_type | .B tag ]] .SS Memory ( all ) .B 7E [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-2|ALL] ]] .SS Standard ( all ) .B 7E [.]XXXXXXXXXXXX[XX][/[ .B .so standard_mini.3so ]] .SS Temperature ( EDS0064/5/6/7/8 ) .B 7E.XXXXXXXXXXXX/EDS006X [/[ .B temperature | .B counters/seconds | .B alarm/ temp_[hi|low] | .B set_alarm/ temp_[hi|low] | .B threshold/ temp_[hi|low] ]] .SS Humidity ( EDS0065/8 ) .B 7E.XXXXXXXXXXXX/EDS006X [/[ .B humidity | .B humidex | .B dew_point | .B heat_index | .B alarm/ humidity_[hi|low] | .B alarm/ humidex_[hi|low] | .B alarm/ dew_point_[hi|low] | .B alarm/ heat_index_[hi|low] | .B set_alarm/ humidity_[hi|low] | .B set_alarm/ humidex_[hi|low] | .B set_alarm/ dew_point_[hi|low] | .B set_alarm/ heat_index_[hi|low] | .B threshold/ humidity_[hi|low] | .B threshold/ humidex_[hi|low] | .B threshold/ dew_point_[hi|low] | .B threshold/ heat_index_[hi|low] ]] .SS Barometric Pressure ( EDS0066/8 ) .B 7E.XXXXXXXXXXXX/EDS006X [/[ .B pressure | .B inHg | .B alarm/ pressure_[hi|low] | .B alarm/ inHg_[hi|low] | .B set_alarm/ pressure_[hi|low] | .B set_alarm/ inHg_[hi|low] | .B threshold/ pressure_[hi|low] | .B threshold/ inHg_[hi|low] ]] .SS Light ( EDS0067/8 ) .B 7E.XXXXXXXXXXXX/EDS006X [/[ .B light | .B alarm/ light_[hi|low] | .B set_alarm/ light_[hi|low] | .B threshold/ light_[hi|low] ]] .SS RTD Temperature ( EDS0071/2 ) .B 7E.XXXXXXXXXXXX/EDS007X [/[ .B temperature | .B resistance | .B raw | .B delay | .B user_byte | .B calibration/[key|constant] | .B counter/[seconds|samples] | .B alarm/temp_[hi|low] | .B alarm/RTD_[hi_low] | .B set_alarm/temp_[hi|low] | .B set_alarm/RTD_[hi_low] | .B threshold/temp_[hi|low] | .B threshold/RTD_[hi_low] ]] .SS LED ( all ) .B 7E.XXXXXXXXXXXX/EDS00XX/LED/[state|control] .SS relay ( all ) .B 7E.XXXXXXXXXXXX/EDS00XX/relay/[state|control] .SH FAMILY CODE .TP .I 7E .SH TEMPERATURE .SS EDS006X/temperature .I read-only, floating-point .br Temperature for the EDS006X series of chips. In the \-55C to 125C range, with 0.0636C precision. The temperature is read every second, continually. Data is presented in the specified temperature scale, Celsius by default. .SS EDS007X/temperature .I read-only, floating-point .br Temperature for the EDS007X series of chips. Read using a wide-range precise RTD sensor. Typical range is \-60C to 260C with 0.15C accuracy, although a range of \-200C to 850C is possible. The temperature is read every second unless a longer .I EDS007X/delay is given. Data is presented in the specified temperature scale, Celsius by default. .SS EDS007X/resistance .I read-only, floating-point .br Actual measured resistance (Ohms) of the RTD element. Useful if the RTD element doesn't conform to the typical European IEC 60751 standard. .SH HUMIDITY .SS EDS006X/humidity .I read-only, floating-point .br Relative humidity in the 0-100 range (percent). Read every 0.2 seconds. .SS EDS006X/dew_point .I read-only, floating-point .br Dew point computed from .I EDS006X/temperature and .I EDS006X/humidity computered every 0.2 seconds. Data is a calculated temperature and is reported in the specified temperature scale. Default Celsius. .SS EDS006X/heat_index .I read-only, floating-point .br Heat index computed from .I EDS006X/temperature and .I EDS006X/humidity computered every 0.2 seconds. Data is a calculated temperature and is reported in the specified temperature scale. Default Celsius. .SS EDS006X/humidex .I read-only, floating-point .br Humidex (popular in Canada) computed from .I EDS006X/temperature and .I EDS006X/humidity computered every 0.2 seconds. Data is a percent and reported in the 0-100 range. .SH LIGHT .SS EDS006X/light .I read-only, unsigned integer .br Ambient light in Lux. Measured every 0.2 seconds. .SH PRESSURE .SS EDS006X/pressure .I read-only, floating-point .br Ambient pressure, measured every 0.2 seconds. Data in the selected pressure scale (default mBar). .SS EDS006X/inHg .I read-only, floating-point .br Ambient pressure, measured every 0.2 seconds. Data in the inHg scale. .SH THRESHOLD High and low range of acceptable sensor readings. Values outside this range will trigger an alarm if the corresponding .I EDS00XX/set_alarm flag is set. .SS EDS00XX/threshold/temp_hi EDS00XX/threshold/temp_low .I read-write, floating-point .br Threshold temperatures in the specified temperature scale. Default Celsius. .SS EDS006X/threshold/humidity_hi EDS006X/threshold/humidity_low .SS EDS006X/threshold/dew_point_hi EDS006X/threshold/dew_point_low .SS EDS006X/threshold/heat_index_hi EDS006X/threshold/heat_index_low .SS EDS006X/threshold/humidex_hi EDS006X/threshold/humidex_low .I read-write, floating-point .br Threshold humidity values. .I Dew point and .I Heat index are in the specified temperature scale. Default Celsius. .SS EDS006X/threshold/pressure_hi EDS006X/threshold/pressure_low .SS EDS006X/threshold/inHg_hi EDS006X/threshold/inHg_low .I read-write, floating-point .br Threshold barometric pressure values. .I Pressure is the specified pressure scale. Default mBar. .SS EDS006X/threshold/light_hi EDS006X/threshold/light_low .I read-write, unsigned .br Threshold light (lux) values. .SS EDS007X/threshold/resistance_hi EDS007X/threshold/resistance_low .I read-write, floating-point .br Threshold RTD resistance values (Ohm). .SH SET ALARM Set conditional alarm to trigger if corresponding flag is set. Also must set high and low .I threshold. .SS EDS00XX/set_alarm/temp_hi EDS00XX/set_alarm/temp_low .SS EDS006X/set_alarm/humidity_hi EDS006X/set_alarm/humidity_low .SS EDS006X/set_alarm/dew_point_hi EDS006X/set_alarm/dew_point_low .SS EDS006X/set_alarm/heat_index_hi EDS006X/set_alarm/heat_index_low .SS EDS006X/set_alarm/humidex_hi EDS006X/set_alarm/humidex_low .SS EDS006X/set_alarm/pressure_hi EDS006X/set_alarm/pressure_low .SS EDS006X/set_alarm/inHg_hi EDS006X/set_alarm/inHg_low .SS EDS006X/set_alarm/light_hi EDS006X/set_alarm/light_low .SS EDS007X/set_alarm/resistance_hi EDS007X/set_alarm/resistance_low .I read-write, yes-no .br Flag to set corresponding out-of-range alarm. "1" turns on flag, and "0" turns off. .SH ALARM Show or clear the out-of-range flags. When set, the device will respond to a conditional search. Clearing the flags is performed with the .I EDS00XX/alarm/clear command, not just having the measured value return to the center range. .SS EDS00XX/alarm/clear .I write-only, yes-no .br Write "1" to clear .B ALL the alarm flags. .SS EDS00XX/alarm/temp_hi EDS00XX/alarm/temp_low .SS EDS006X/alarm/humidity_hi EDS006X/alarm/humidity_low .SS EDS006X/alarm/dew_point_hi EDS006X/alarm/dew_point_low .SS EDS006X/alarm/heat_index_hi EDS006X/alarm/heat_index_low .SS EDS006X/alarm/humidex_hi EDS006X/alarm/humidex_low .SS EDS006X/alarm/pressure_hi EDS006X/alarm/pressure_low .SS EDS006X/alarm/inHg_hi EDS006X/alarm/inHg_low .SS EDS006X/alarm/light_hi EDS006X/alarm/light_low .SS EDS007X/alarm/resistance_hi EDS007X/alarm/resistance_low .I read-only, yes-no .br Flag to set corresponding out-of-range alarm. "1" turns on flag, and "0" turns off. .SH RELAY Optionally found on the EDS006X and EDS007X. Can be controlled by software or the alarm condition. .SS EDS00XX/relay/control .I read-write, unsigned .br Set the relay control scheme: .TP 0 alarm control with hysteresis .TP 1 alarm control but need .I EDS00XX/alarm/clear to unset .TP 2 Control with .I EDS00XX/relay/state .TP 3 Always off .SS EDS00XX/relay/state .I read-write, yes-no .br Turn the relay on or off if the .I EDS00XX/relay/control is set to "2" .SH LED light Found on the EDS006X and EDS007X. Can be controlled by software or the alarm condition. .SS EDS00XX/LED/control .I read-write, unsigned .br Set the LED control scheme: .TP 0 alarm control with hysteresis .TP 1 alarm control but need .I EDS00XX/alarm/clear to unset .TP 2 Control with .I EDS00XX/LED/state .TP 3 Always off .SS EDS00XX/LED/state .I read-write, yes-no .br Turn the LED on or off if the .I EDS00XX/LED/control is set to "2" .SH COUNTER .SS EDS00XX/counter/seconds .I read-only, unsigned integer .br Approximate seconds since power up. .SS EDS007X/counter/samples .I read-only, unsigned integer .br Approximate samples since power up. .SH MEMORY .SS memory .I read-write, binary .br 96 bytes of memory. Not all is writable. Access to .I EDS00XX functions is better accomplished through the data fields, which expose all the chip features. .SS pages/page.0 ... pages/page.2 pages/page.ALL .I read-write, binary .br Memory is split into 3 pages of 32 bytes each. Only page 2 is writable. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH SUB-TYPE .SS tag .I read-only, ascii .br Text description of the device. Up to 30 characters. .SS device_type .I read-only, ascii .br Device name. E.g: "EDS0071" .SS device_id .I read-only, unsigned .br Number corresponding to the hexidecimal type. E.g: .br EDS0071 -> 0x0071 -> 113 in decimal .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS EDS00XX Overview The EDS00XX sensors are a family of devices from .I Embedded Data Systems. Although provisional support for several types is included, only early .I EDS0071 has been tested with .I OWFS. .PP The sensors all share the same .I 7E family code. They have the same first memory page layout with a text .I tag property that describes them, and a .I sub-type field giving the particular sensor. The data properties shown in a directory listing will be specific to the sensor .I sub-type. .SS EDS0071 The .B EDS0071 (3) is a micro-processor based 1-wire slave made by EDS (Embedded Data Systams). Is uses a high accuracy and extended range RTD sensor to accurately measure temperatures. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br https://www.embeddeddatasystems.com/1-Wire-Interface-for-4-Wire-RTD_p_165.html .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/EDS0065.30000664000175000017500000000001211531345773012170 00000000000000.so EDS.3 owfs-2.8p15/src/man/DS1990A.30000664000175000017500000000001510244633637012176 00000000000000.so DS2401.3 owfs-2.8p15/src/man/format.5so0000664000175000017500000000240011152545757013104 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: format.5so,v 1.1 2009/03/01 17:54:55 alfille Exp $ '\" .SH FORMAT OPTIONS Choose the representation of the 1-wire unique identifiers. OWFS uses these identifiers as unique directory names. .PP Although several display formats are selectable, all must be in .I family-id-crc8 form, unlike some other programs and the labelling on iButtons, which are .I crc8-id-family form. .SS \-f \-\-format="f[.]i[[.]c]" Display format for the 1-wire devices. Each device has a 8byte address, consisting of: .TP .I f family code, 1 byte .TP .I i ID number, 6 bytes .TP .I c CRC checksum, 1 byte .PP Possible formats are .I f.i (default, 01.A1B2C3D4E5F6), .I fi fic f.ic f.i.c and .I fi.c .PP All formats are accepted as input, but the output will be in the specified format. .PP The address elements can be retrieved from a device entry in owfs by the .I family, id and crc8 properties, and as a whole with .I address. The reversed id and address can be retrieved as .I r_id and .I r_address. owfs-2.8p15/src/man/DS2406.30000664000175000017500000001352711542520452012072 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2406.3,v 1.28 2011/03/24 01:40:58 alfille Exp $ '\" .TH DS2406 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2406, DS2407 \- Dual Addressable Switch with 1kbit Memory .SH SYNOPSIS Dual Switch, Write-once Memory .PP .B 12 [.]XXXXXXXXXXXX[XX][/[ .B channels | .B latch.[A|B|ALL|BYTE] | .B memory | .B pages/page.[0-3|ALL] | .B PIO.[A|B|ALL|BYTE] | .B power | .B sensed.[A|B|ALL|BYTE] | .B set_alarm | .B TAI8570/[sibling|temperature|pressure] | .B T8A/volt.[0-7,ALL] .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 12 .SH SPECIAL PROPERTIES .SS channels .I read-only, unsigned integer .br Is this a 1 or 2 channel switch? The .I DS2406 comes in two forms, one has only one .I PIO pin (PIO.A). Returns 1 or 2. .SS latch.A latch.B latch.ALL latch.BYTE .I read-write, yes-no .br The activity latch is set to 1 with the first negative or positive edge detected on the associated PIO channel. .br Writing any data will clear latch for all (both)) channels. This is a hardware "feature" of the chip. .br .I ALL references both channels simultaneously, comma separated .br .I BYTE references both channels simultaneously as a single byte, with channel A in bit 0. .SS memory .I read-write, binary .br 128 bytes of non-volatile, write-once data. .SS pages/page.0 ... pages/page.3 pages/page.ALL .I read-write, binary .br Memory organized as 4 pages or 32 bytes. Memory is write-once. .br .I ALL is the aggregate of all 4 pages, sequentially accessed. .SS PIO.A PIO.B PIO.ALL PIO.BYTE .I read-write, yes-no .br State of the open-drain output ( .I PIO ) pin. 0 = non-conducting (off), 1 = conducting (on). .br Writing zero will turn off the switch, non-zero will turn on the switch. Reading the .I PIO state will return the switch setting (flipflop in the data sheet). To determine the actual logic level at the switch, refer to the .I sensed property. .br Note that the actual pin setting for the chip uses the opposite polarity -- 0 for conducting, 1 for non-conducting. However, to turn a connected device on (i.e. to deliver power) we use the software concept of 1 as conducting or "on". .br .I ALL references both channels simultaneously, comma separated. .br .I BYTE references both channels simultaneously as a single byte, with channel A in bit 0. .SS power .I read-only, yes-no .br Is the .I DS2406 powered parasitically =0 or separately on the Vcc pin =1 .SS sensed.A sensed.B sensed.ALL sensed.BYTE .I read-only, yes-no .br Logic level at the .I PIO pin. 0 = ground. 1 = high (~2.4V - 5V ). Really makes sense only if the .I PIO state is set to zero (off), else will read zero. .br .I ALL references both channels simultaneously, comma separated. .br .I BYTE references both channels simultaneously as a single byte, with channel A in bit 0. .SS set_alarm .I read-write, unsigned integer (0-331) .br A number consisting of three digits XYZ, where: .TP X channel selection .br .I 0 neither .br .I 1 A only .br .I 2 B only .br .I 3 A or B .TP Y source selection .br .I 0 undefined .br .I 1 latch .br .I 2 PIO .br .I 3 sensed .TP Z polarity selection .br .I 0 low .br .I 1 high .PP All digits will be truncated to the 0-3 (or 0-1) range. Leading zeroes are optional (and may be problematic for some shells). .PP Example: .TP 311 Responds on Conditional Search when either latch.A or latch.B (or both) are set to 1. .TP <100 Never responds to Conditional Search. .SS TAI8570/ .I subdirectory .br Properties when the .I DS2406 (3) is built into a .I TAI8570. .br If the .I DS2406 (3) is not part of a .I TAI8570 or is not the controlling switch, attempts to read will result in an error. .SS TAI8570/pressure .I read-only, floating point .br Barometric .I pressure in millibar. .SS TAI8570/sibling .I read-only, ascii .br Hex address of the .I DS2406 (3) paired with this chip in a .I TAI8570. .SS TAI8570/temperature .I read-only, floating-point .br Ambient .I temperature measured by the .I TAI8570 in prevailing temperature units (Centigrade is the default). .SS T8A/volt.[0-7|ALL] .I read-only, floating-point .br Uses the T8A (by .I Embedded Data Systems ) 8 channel voltage converter. Units in volts, 0 to 5V range. 12 bit resolution. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS Use the .I set_alarm property to set the alarm triggering criteria. .SH DESCRIPTION .so description.3so .SS DS2406 The .B DS2406 (3) allows control of other devices, like LEDs and relays. It superceeds the .B DS2405 and .B DS2407 Alternative switches include the .B DS2408 or even .B DS2450 .br The .B DS2407 is practically identical to the .I DS2406 except for a strange .I hidden mode. It is supported just like the .B DS2406 .SS TAI8570 The .I TAI-8570 Pressure Sensor is based on a 1-wire composite device by .I AAG Electronica. The .I TAI8570 uses 2 .I DS2406 (3) chips, paired as a reader and writer to synthesize 3-wire communication. Only 1 of the .I DS2406 (3) will allow .I temperature or .I pressure readings. It's mate's address can be shown as .I sibling. .PP The .I TAI8570 uses the .I Intersema MS5534a pressure sensor, and stores calibration and temperature compensation values internally. .PP Design and code examples are available from AAG Electronica http://aag.com.mx , specific permission to use code in a GPL product was given by Mr. Aitor Arrieta of AAG and Dr. Simon Melhuish of OWW. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2406.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2407.pdf .br http://www.embeddeddatasystems.com/page/EDS/PROD/IO/T8A .br http://oww.sourceforge.net/hardware.html#bp .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/libownet.10000664000175000017500000000002111542520452013052 00000000000000.so man1/ownet.1 owfs-2.8p15/src/man/Makefile.in0000664000175000017500000005765711756250031013245 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \ "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(manndir)" man3dir = $(mandir)/man3 man5dir = $(mandir)/man5 manndir = $(mandir)/mann NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = owfs.1 \ owhttpd.1 \ owserver.1 \ owftpd.1 \ owcapi.1 libowcapi.1 \ ownet.1 ownetapi.1 libownet.1 ownetlib.1 \ owshell.1 owdir.1 owread.1 owwrite.1 owget.1 owpresent.1 \ owtap.1 owmon.1 \ DS1427.3 \ DS1821.3 DS1822.3 DS1825.3 DS18B20.3 DS18S20.3 DS28EA00.3 \ DS1904.3 DS1920.3 DS1921.3 DS1963L.3 DS1963S.3 DS1971.3 DS1977.3 \ DS1982.3 DS1982U.3 DS1985.3 DS1985U.3 DS1986.3 DS1986U.3 \ DS1990A.3 DS1991.3 DS1992.3 DS1993.3 DS1994.3 DS1995.3 DS1996.3 \ DS2401.3 DS2404.3 DS2404S.3 DS2405.3 DS2406.3 DS2407.3 DS2408.3 DS2409.3 \ DS2411.3 DS2413.3 DS2415.3 DS2417.3 \ DS2423.3 \ DS2430A.3 DS2431.3 DS2433.3 DS2436.3 DS2437.3 DS2438.3 \ DS2450.3 \ DS2502.3 DS2502-E48.3 DS2502-UNW.3 DS2505.3 DS2505-UNW.3 DS2506.3 DS2506-UNW.3 \ DS2720.3 DS2740.3 DS2751.3 DS2755.3 DS2756.3 DS2760.3 DS2761.3 DS2762.3 DS2770.3 \ DS2780.3 DS2781.3 DS2788.3 \ DS2804.3 DS28E04.3 DS28EA00.3 DS28EC20.3 \ DS2890.3 \ EEEF.3 UVI.3 \ EDS.3 EDS0064.3 EDS0065.3 EDS0066.3 EDS0067.3 EDS0068.3 EDS0071.3 EDS0072.3 \ Thermachron.3 \ LCD.3 \ OWNet.3 \ owperl.3 \ owtcl.n \ owfs.5 owfs.conf.5 \ ow.n EXTRA_DIST = ${man_MANS} *.?so 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 src/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/man/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man3: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list=''; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)" @list=''; test -n "$(man5dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-mann: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(manndir)" || $(MKDIR_P) "$(DESTDIR)$(manndir)" @list=''; test -n "$(manndir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.n[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^n][0-9a-z]*$$,n,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(manndir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(manndir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(manndir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(manndir)" || exit $$?; }; \ done; } uninstall-mann: @$(NORMAL_UNINSTALL) @list=''; test -n "$(manndir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.n[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^n][0-9a-z]*$$,n,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(manndir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(manndir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-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-man1 install-man3 install-man5 install-mann 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: uninstall-man uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5 \ uninstall-mann .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-man1 \ install-man3 install-man5 install-mann 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 \ uninstall-man uninstall-man1 uninstall-man3 uninstall-man5 \ uninstall-mann install-data-am: install-man install-so-man install-so-man: for i in $(man_MANS); do \ case $$i in \ *.1*) mandirr=$(man1dir) ;; \ *.3*) mandirr=$(man3dir) ;; \ *.5*) mandirr=$(man5dir) ;; \ *.n*) mandirr=$(manndir) ;; \ esac; \ i=$$mandirr/$$i; \ list="$$list $$i"; \ done; \ for manfile in $$list; do \ for i in `sed -n '2,$$ s/^.so //p' $(DESTDIR)/$$manfile | tac`; do \ printf "%s\n" H /$$i/d - ".r $(srcdir)/$$i" g/^.\\\\\"/d ",w" | ed -s $(DESTDIR)/$$manfile ; \ done; \ done; \ for manfile in $$list; do \ for i in `sed -n '2,$$ s/^.so //p' $(DESTDIR)/$$manfile | tac`; do \ printf "%s\n" H /$$i/d - ".r $(srcdir)/$$i" g/^.\\\"/d ",w" | ed -s $(DESTDIR)/$$manfile ; \ done; \ done clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/man/DS1921.30000664000175000017500000002127711535563402012100 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1921.3,v 1.20 2011/03/09 02:33:38 alfille Exp $ '\" .TH DS1921-Thermachron 3 2005 "OWFS Manpage" "One-Wire File System" .SH NAME DS1921 \- Thermachron temperature logging iButton. .SH SYNOPSIS Temperature logging iButton. .PP .B 21 [.]XXXXXXXXXXXX[XX][/[ .br .B about/[measuring| resolution| samples| templow| temphigh| version] | .br .B clock/[date| running| udate] | .br .B histotgram/[counts[0-62|ALL]| gap| temperature[counts[0-62|ALL]] | .br .B log[date[0-2047|ALL]| elements| temperature[0-2047|ALL]| udate[0-2047|ALL]] | .br .B memory | .br .B mission/[date| delay| easystart| frequency| rollover| running| samples| sampling| udate] | .br .B overtemp/[date[0-11|ALL]| elements| end[0-11|ALL]| count[0-11|ALL]| temperature[0-11|ALL]| udate[0-11|ALL]] | .br .B pages/page.[0-15|ALL] | .br .B temperature | .br .B undertemp/[date[0-11|ALL]| elements|end[0-11|ALL]| count[0-11|ALL]| temperature[0-11|ALL]| udate[0-11|ALL]] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 21 .SH SPECIAL PROPERTIES .SS about/measuring .I read-only, yes-no .br Is this .I DS1921 currently .I measuring a temperature? .SS about/resolution .I read-only, floating point .br What is the .I resolution of the temperature measurments (in the current temperature scale). .SS about/samples .I read-only, unsigned integer .br How many total temperature measurements has this .I DS1921 performed? .SS about/temphigh .I read-only, floating point .br Highest temperature this .I DS1921 can measure (in the current temperature scale). .SS about/templow .I read-only, floating point .br Lowest temperature this .I DS1921 can measure (in the current temperature scale). .SS abount/version .I read-only, ascii .br Specific .I version of this .I DS1921. .SS clock/date .I read-write, ascii .br 26 character date representation of the internal time stored in this .I DS1921. Increments once per second while .I clock/running .br Setting .I date to a null string will put the current system time. .br Accepted date formats are: .br Sat[urday] March 12 12:23:59 2001 .br Apr[il] 4 9:34:56 2002 .br 3/23/04 23:34:57 .br current locale setting (your system's format) .SS clock/running .I read-write, yes-no .br Whether the internal clock is running. This can be explicitly set, and is automatically started by setting .I clock/date or .I clock/udate or by starting a mission with .I mission/easystart or .I mission/frequency .PP The main reason to stop the clock is to conserve the internal battery. The clock cannot be stopped during a mission, and the clock is essential for a mission. .SS clock/udate .I read-write, unsigned integer .br A numeric representation of .I clock/date .br The number of seconds in UNIX time (since Jan 1, 1970). .SS histogram/counts.0 ... histogram/counts.62 histogram/counts.ALL .I read-only, unsigned integer .br The number of samples in the current mission whose temperature fell within the .I histogram/temperature to .I histogram/temperature+histogram/gap range. .SS histogram/elements .I read-only, unsigned integer .br The number of bins in the histogram. Always 63. .SS histogram/gap .I read-only, floating point .br The size of the histogram bin. Depends on the Thermochron version ( .I about/version ) and is usually 4 times .I about/resolution .PP Given in the current temperatature scale. .SS histogram/temperature.0 ... histogram/temperature.62 histogram/temperature.ALL .I read-only, floating point .br Lower limit of the temperature range for the corresponding histogram bin. In the current temperature scale. .SS log/date.0 ... log/date.2047 log/date.ALL .I read-only, ascii .br Date that the corresponding .I log/temperature was taken, in ascii format. (See .I clock/date for more on the format). The number of valid entries is actually .I log/elements since the log may not be full. .PP .I mission/samples gives the total number of samples that have been taken but there is only room in the log for 2048 entries. Once the log is full, .I mission/rollover determines the Thermochron's behavior. .PP If .I mission/rollover is false(0), the log will hold the .B first 2048 samples and .I log/date.0 will always be the same as .I mission/date .PP If .I mission/rollover is true (1) then the log will hold the .B last 2048 samples and the entries will be shifted down with each new sample. .PP Note the .I OWFS code "untwists" the rollover behavior. The data will always be a linear array of earliest to latest. .PP .I ALL is the all data elements comma separated. .SS log/elements .I read-only, unsigned integer .br Number of valid entries in the log. .I OWFS offers the full 2048 values in the log memory, but not that many samples may yet have been taken. .I log/elements will range from 0 to 2048 and always be less than or equal to .I mission/samples .SS log/temperature.0 ... log/temperature.2047 log/temperature.ALL .I read-write, floating point .br The temperature readings (in the current temperature scale) that correspond to the .I log/date sample. See .I log/date for details on the indexing scheme and rollover behavior. .SS log/udate.0 ... log/udate.2047 log/udate.ALL .I read-write, unsigned integer .br A numeric representation of .I log/date .br The number of seconds in UNIX time (since Jan 1, 1970). .SS memory .I read-write, binary .br User available storage space. 512 bytes. Can also be accessed as 16 pages of 32 bytes with the .I pages/page.x properties. .SS overtemp/count.0 ... overtemp/count.11 overtemp/count.ALL .SS undertemp/count.0 ... undertemp/count.11 undertemp/count.ALL .I read-only, unsigned integer .br Number of sampling periods that the Thermochron stayed out of range durring a mission. Each sampling period is .I mission/frequency minutes long. .SS overtemp/end.0 ... overtemp/end.11 overtemp/end.ALL .SS undertemp/end.0 ... undertemp/end.11 undertemp/end.ALL .I read-only, ascii .br End of time that the Thermochron went out of range during the current mission. See .I clock/date for format. .PP Each period can be up to 255 samples in length, and span the time .I overtemp/date to .I overtemp/end ( or .I undertemp/date to .I undertemp/end ). .SS overtemp/date.0 ... overtemp/date.11 overtemp/date.ALL .SS undertemp/date.0 ... undertemp/date.11 undertemp/date.ALL .I read-only, ascii .br Time that the Thermochron went out of range during the current mission. See .I clock/date for format. .SS overtemp/elements .SS undertemp/elements .I read-only, unsigned integer .br Number of entries (0 to 12) in the .I overtemp or .I undertemp array. .SS overtemp/temperature .SS undertemp/temperature .I read-write, floating point .br Temperature limit to trigger alarm and error log. .I overtemp/temperature gives upper limit and .I undertemp/temperature gives lower limit. .br In current temperature scale. .SS overtemp/udate.0 ... overtemp/udate.11 overtemp/udate.ALL .SS undertemp/udate.0 ... undertemp/udate.11 undertemp/udate.ALL .I read-only, unsigned integer .br A numeric representation of .I overtemp/date or .I undertemp/date .br The number of seconds in UNIX time (since Jan 1, 1970). .SS pages/page.0 ... pages/page.15 pages/page.ALL .I read-write, binary .br Memory is split into 16 pages of 32 bytes each. User available. The log memory, register banks and histogram data area are all separate from this memory area. .br .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS temperature .I read-only, floating point .br Last temperature explicitly requested. Only available when the mission is not in progress. Value returned in in the current temperature scale. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1921 Thermochron The .B DS1921 (3) is an iButton device with many intriguing functions. Essentially it monitors temperature, giving both a log of readings, and a histogram of temperature ranges. The specification is somewhat complex, but OWFS hides many of the implementation details. .PP While on a .I mission the .B DS1921 (3) records temperature readings in a 2048-sample log and adds the to 62-bin histogram. more complete form of the .B DS2438 (3) battery chip. Current sensing is available, but not implemented. The major advantage compared to the .B DS2436 (3) is that two voltages can be read, allowing correcting circuit nmeasurements to supply voltage and temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2438.pdf .br http://pdfserv.maxim-ic.com/en/an/humsensor.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owftpd.10000664000175000017500000000371111542520452012543 00000000000000'\" '\" Copyright (c) 2003-2006 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owftpd.1,v 1.23 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWFTPD 1 2004 "OWFS Manpage" "One-Wire File System" .SH NAME .B owftpd \- Anoymous FTP server for 1-wire access .SH SYNOPSIS .B owftpd .so cmdline_mini.1so [ .I \-p host:tcp-port ] .SH "DESCRIPTION" .so description.1so .SS owftpd .B owhttpd (1) is an anonymous ftp (file-transfer-protocol) server that shows the Dallas/Maxim 1-Wire bus attached to a computer. The main directory shows the devices found, You can then navigate to individual devices, view and set their properties. .PP .B owftpd (1) uses the same naming convention as .B owfs (1) and .B owhppt (1) , where the URL corresponds to the filename. .PP The ftp server is a modified version of oftpd by Shane Kerr. It serves no files from the disk, only virtual files from the 1-wire bus. Security should therefore be good. Only the 1-wire bus is at risk. .so device.1so .SH SPECIFIC OPTIONS .SS \-p host:portnum (Optional) Sets the tcp port the ftp server runs on. Access with the URL ftp://anonymous@servernameoripaddress:portnum .PP The well known ftp port, 21, will be used by default. Since this port number is in the restricted range, special permission is usually required. .so temperature.1so .so pressure.1so .so format.1so .so job_control.1so .so configuration.1so .so help.1so .so timeout.1so .SH EXAMPLE .TP owftpd \-d /dev/ttyS0 Ftp server runs on default tcp port 21, serial adapter at ttyS0 .TP owftpd \-s littlehost:4304 \-\-error_level=3 Ftp server on default port 21, from .B owserver (1) process on host "littlehost", extensive error messages. .SH AVAILABILITY http://www.owfs.org .SH SEE ALSO .so seealso.1so .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/persistent_thresholds.1so0000664000175000017500000000274211152550602016241 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: persistent_thresholds.1so,v 1.1 2009/03/01 18:18:42 alfille Exp $ '\" .SH PERSISTENT THRESHOLD OPTIONS These settings control the behavior of .B owserver (1) in granting and dropping persistent tcp connections. The default settings are shown. .PP In general no changes should be needed. In general the purpose is to limit total resource usage from an errant or rogue client. .SS --timeout_persistent_low=600 Minimum seconds that a persistent tcp connection to .B owserver (1) is kept open. This is the limit used when the number of connections is above .I --clients_persistent_low .SS --timeout_persistent_high=3600 Maximum seconds that a persistent tcp connection to .B owserver (1) is kept open. This is the limit used when the number of connections is below .I --clients_persistent_low .SS --clients_persistent_low=10 Maximum number of persistent tcp connections to .B owserver (1) before connections start getting the more stringent time limitation .I --timeout_persistent_low .SS --clients_persistent_high=20 Maximum number of persistent tcp connections to before no more are allowed (only non-persistent at this point). .B owserver (1) before no more are allowed (only non-persistent at this point). owfs-2.8p15/src/man/DS2761.30000664000175000017500000000001510244633637012072 00000000000000.so DS2760.3 owfs-2.8p15/src/man/DS2502-E48.30000664000175000017500000000001510244633637012421 00000000000000.so DS2502.3 owfs-2.8p15/src/man/DS1986.30000664000175000017500000000001510244633637012102 00000000000000.so DS2506.3 owfs-2.8p15/src/man/DS2502.30000664000175000017500000000527411535561503012073 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2502.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2502 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2502 \- Add-Only Memory (1 kBit) .br DS2502-E48 \- 48-bit Node Address Chip .br DS2502-UNW \- UniqueWare Add-Only Memory (1 kBit) .br DS1982 \- Add-Only iButton (1 kBit) .br DS1982U \- UniqueWare iButton (1 kBit) .SH SYNOPSIS EPROM add-only memory. .PP .B 09 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-3|ALL] | .so standard_mini.3so ]] .PP .B 89 [.]XXXXXXXXXXXX[XX][/[ .B mac_e | .B mac_fw | .B memory | .B pages/page.[0-3|ALL] | .B project | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 09 DS2502 DS1982 .TP .I 89 DS2502-UNW DS2502-E48 DS1982U .SH SPECIAL PROPERTIES .SS mac_e mac_fw .I read-only, binary .br 64 bit or 80 bit .I media access control number. Unique, and unrelated to the 1-wire address. It is apparently used for ethernet or FireWire addressing, respectively. .SS memory .I read-write, binary .br 128 bytes of memory. Initially all bits are set to 1. Writing zero permanently alters the memory. .SS pages/page.0 ... pages/page.3 pages/page.ALL .I read-write, yes-no .br Memory is split into 4 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS project .I read-only, binary .br 32 bit .I project id. Constant 0x0000 for ethernet and 0x00001128 for firewire. See Datasheets. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2502 DS1982 The .B DS2502 (3) is used for write-once incremental storage. It's main advantage is for audit trails (i.e. a digital purse). .PP The .B DS2502-E48 and .B DS2502-UNW are some of the .I UniqueWare class of devices. Some of the memory was preprogramed at the factory. See the datasheet for specifics. The .B DS2502 , .B DS2505 , and .B DS2506 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2502.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2502-E48.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2502-UNW-DS2506S-UNW.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1982-F3-DS1982-F5.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1982U-DS1986U.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2436.30000664000175000017500000000444511535561503012100 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2436.3,v 1.18 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2436 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2436 \- Battery ID/Monitor Chip .SH SYNOPSIS Temperature Voltage and Memory. .PP .B 1B [.]XXXXXXXXXXXX[XX][/[ .B pages/page.[0-4|ALL] | .B temperature | .B volts | .B counter/cycles | .B counter/reset | .B counter/increment | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1B .SH SPECIAL PROPERTIES .SS pages/page.0 ... pages/page.4 pages/page.ALL .I read-write, binary .br Memory is split into 5 pages of 32 bytes each. Only the first 3 pages are really available, and some of that appears to be reserved. See the datasheet for details. .P .I pages/page.0 is locked and unlocked transparently for every write. .P .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. Conversion takes ~20 msec. .SS volts .I read-only, floating point .br Voltage read (~10 bits) at the chip's supply voltage Vdd. Range 2.4V to 10V. .SS counter/ A resettable non-volatile counter intended for counting battery discharge cycles. .SS counter/cycles .I read-only, unsigned integer .br Cycle counter value. Stored at memory location 0x82. .SS counter/increment .I write-only, yes/no .br Any non-zero (true) value will increment .I counter/cycles by one. .SS counter/reset .I write-only, yes/no .br Any non-zero (true) value will reset .I counter/cycles to zero. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2436 The .B DS2436 (3) is a simpler form of the .B DS2438 battery chip. It has no counter, and only one voltage sensor. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2436.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/temperature_errata.3so0000664000175000017500000000207111174734155015505 00000000000000.SH TEMPERATURE ERRATA There are a group of obscure internal properties exposed to protect against an hardware defect in certain batches of the B7 die of some DS18x20 chips. See http://www.1wire.org/en-us/pg_18.html or request AN247.pdf from Dallas directly. .SS errata/die .I read-only,ascii .br Two character manufacturing die lot. "B6" "B7" or "C2" .SS errata/trim .I read-write,unsigned integer .br 32 bit trim value in the EEPROM of the chip. When written, it does not seem to read back. Used for a production problem in the B7 .I die. .PP Read allowed for all chips. Only the B7 chips can be written. .SS errata/trimblanket .I read-write,yes-no .br Writing non-zero (=1) puts a default trim value in the chip. Only applied to the B7 .I die. Reading will be true (non-zero) if trim value is the blanket value. Again, only B7 chips will register true, and since the written trim values cannot be read, this value may have little utility. .SS errata/trimvalid .I read-only,yes-no .br Is the .I trim value in the valid range? Non-zero if true, which includes all non-B7 chips. owfs-2.8p15/src/man/owfs.conf.50000664000175000017500000000001311306076141013135 00000000000000.so owfs.5 owfs-2.8p15/src/man/owfs.10000664000175000017500000000430711535515532012225 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owfs.1,v 1.43 2011/03/08 21:10:50 alfille Exp $ '\" .TH OWFS 1 2004 "OWFS Manpage" "One-Wire File System" .SH NAME .B owfs \- 1-wire filesystem .SH SYNOPSIS .B owfs .so cmdline_mini.1so .I \-m mountdir .SH "DESCRIPTION" .so description.1so .SS owfs .B owfs (1) is the filesystem client of the .I OWFS family of programs. It runs on linux, freebsd and Mac OS X, and requires the .I fuse kernel module and library. (http://fuse.sourceforge.net) which is a user-mode filesystem driver. .PP Essentially, the entire 1-wire bus is mounted to a place in your filesystem. All the 1-wire devices are accessible using standard file operations (read, write, directory listing). The system is safe, no actual files are exposed, these files are virtual. Not all operations are supported. Specifically, file creation, deletion, linking and renaming are not allowed. (You can link from outside to a owfs file, but not the other way around). .so device.1so .SH SPECIFIC OPTIONS .SS \-m \-\-mountpoint=directory_path Path of a directory to mount the 1-wire file system .PP The mountpoint is required. There is no default. .SS \-\-allow_other Shorthand for fuse mount option "\-o allow_other" Allows uther users to see the fuse (owfs) mount point and file system. Requires a setting in /etc/fuse.conf as well. .SS \-\-fuse-opt "options" Sends options to the fuse-mount process. Options should be quoted, e.g. "\"\-o allow_other\"" . .so temperature.1so .so pressure.1so .so format.1so .so job_control.1so .so configuration.1so .so help.1so .so timeout.1so .SH EXAMPLE .TP owfs \-d /dev/ttyS0 \-m /mnt/1wire Bus master on serial port .TP owfs \-F \-u \-m /mnt/1wire USB adapter, temperatures reported in Fahrenheit .TP owfs \-s 10.0.1.2:4304 \-m /mnt/1wire Connect to an .B owserver (1) process that was started on another machine at tcp port 4304 .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/seealso.3so0000664000175000017500000000244311531345773013251 00000000000000.SS Programs .B owfs (1) owhttpd (1) owftpd (1) owserver (1) .B owdir (1) owread (1) owwrite (1) owpresent (1) .B owtap (1) .SS Configuration and testing .B owfs (5) owtap (1) owmon (1) .SS Language bindings .B owtcl (3) owperl (3) owcapi (3) .SS Clocks .B DS1427 (3) DS1904(3) DS1994 (3) DS2404 (3) DS2404S (3) DS2415 (3) DS2417 (3) .SS ID .B DS2401 (3) DS2411 (3) DS1990A (3) .SS Memory .B DS1982 (3) DS1985 (3) DS1986 (3) DS1991 (3) DS1992 (3) DS1993 (3) DS1995 (3) DS1996 (3) DS2430A (3) DS2431 (3) DS2433 (3) DS2502 (3) DS2506 (3) DS28E04 (3) DS28EC20 (3) .SS Switches .B DS2405 (3) DS2406 (3) DS2408 (3) DS2409 (3) DS2413 (3) DS28EA00 (3) .SS Temperature .B DS1822 (3) DS1825 (3) DS1820 (3) DS18B20 (3) DS18S20 (3) DS1920 (3) DS1921 (3) DS1821 (3) DS28EA00 (3) DS28E04 (3) EDS0064 (3) EDS0065 (3) EDS0066 (3) EDS0067 (3) EDS0068 (3) EDS0071 (3) EDS0072 (3) .SS Humidity .B DS1922 (3) DS2438 (3) EDS0065 (3) EDS0068 (3) .SS Voltage .B DS2450 (3) .SS Resistance .B DS2890 (3) .SS Multifunction (current, voltage, temperature) .B DS2436 (3) DS2437 (3) DS2438 (3) DS2751 (3) DS2755 (3) DS2756 (3) DS2760 (3) DS2770 (3) DS2780 (3) DS2781 (3) DS2788 (3) DS2784 (3) .SS Counter .B DS2423 (3) .SS LCD Screen .B LCD (3) DS2408 (3) .SS Crypto .B DS1977 (3) .SS Pressure .B DS2406 (3) -- TAI8570 EDS0066 (3) EDS0068 (3) owfs-2.8p15/src/man/owfs.50000664000175000017500000001376711535563402012242 00000000000000'\" '\" Copyright (c) 2003-2008 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owfs.5,v 1.15 2011/03/09 02:33:38 alfille Exp $ '\" .TH OWFS 5 2006 "OWFS Configuration File Manpage" "One-Wire File System" .SH NAME .B owfs.conf \- owfs programs configuration file .SH SYNOPSIS An OWFS configuration file is specified on the command line: .TP .B owfs -c config_file [other options] The file name is arbitrary, there is no default configuration file used. .SH USAGE A configuration file can be invoked for any of the OWFS programs ( .B owfs (1) owhttpd (1) owserver (1) owftpd (1) ) or any of the language bindings ( .B owperl (1) owcapi (1) owtcl (1) owphp owpython ) to set command line parameters. .SH SYNTAX .P Similar to Unix shell script or perl syntax .TP Comments # Any .I # marks the start of a comment .br # blank lines are ignored .TP Options .B option # some options (like 'foreground') take no values .br .B option = value # other options need a value .br .B option value # '=' can be omitted if whitespace separates .br .B Option # Case is ignored (for options, not values) .br .B opt # non-ambiguous abbreviation allowed .br .B -opt --opt # hyphens ignored .TP .I owserver .B server: opt = value # only .I owserver effected by this line .br .B ! server: opt = value # .I owserver NOT effected by this line .TP .I owhttpd .B http: opt = value # only .I owhttpd effected by this line .br .B ! http: opt = value # .I owhttpd NOT effected by this line .TP .I owftpd .B ftp: opt = value # only .I owftpd effected by this line .br .B ! ftp: opt = value # .I owftpd NOT effected by this line .TP .I owfs .B owfs: opt = value # only .I owfs effected by this line .br .B ! owfs: opt = value # .I owfs NOT effected by this line .TP Limits # maximum line length of 250 characters .br # no limit on number of lines .SH "DESCRIPTION" .so description.5so .SS Configuration .B owfs.conf (5) allows a uniform set of command line parameters to be set. .P Not all OWFS programs use the same command line options, but the non-relevant ones will be ignored. .P Command line and configuration options can mixed. They will be invoked in the order presented. Left to right for the command line. Top to bottom for the configuration file. .P Configuration files can call other configuration files. There is an arbitrary depth of 5 levels to prevent infinite loops. More than one configuration file can be specified. .SH SAMPLE .TP Here is a sample configuration file with all the possible parameters included. # .B Sources .br .I device = /dev/ttyS0 # serial port: DS9097U DS9097 ECLO or LINK .br .I device = /dev/i2c-0 # i2c port: DS2482-100 or DS2482-800 .br .I usb # USB device: DS9490 PuceBaboon .br .I usb = 2 # Second DS9490 .br .I usb = all # All DS9490s .br .I altUSB # Willy Robison's tweaks .br .I LINK = /dev/ttyS0 # serial LINK in ascii mode .br .I LINK = [address:]port # LINK-HUB-E (tcp access) .br .I HA7 # HA7Net autodiscovery mode .br .I HA7 = address[:port] # HA7Net at tcp address (port 80) .br .I etherweather = address[:port] # Etherweather device .br .I server = [address:]port # .B owserver tcp address .br .I FAKE = 10,1B # Random simulated device with family codes (hex) .br .I TESTER = 28,3E # Predictable simulated device with family codes .br # .br # .B Sinks .br # # .B owfs specific .br .I mountpoint = filelocation # .I FUSE mount point .br .I allow_other # Short hand for .I FUSE mount option "\"\-o allow_other\"" .br # # .B owhttpd owserver owftpd specific .br .I port = [address:]port # tcp out port .br # .br # .B Temperature scales .br .I Celsius # default .br .I Fahrenheit .br .I Kelvin .br .I Rankine .br # .br # .B Timeouts (all in seconds) .br # cache for values that change on their own .br .I timeout_volatile = value # seconds "volatile" values remain in cache .br # cache for values that change on command .br .I timeout_stable = value # seconds "stable" values remain in cache .br # cache for directory lists (non-alarm) .br .I timeout_directory = value # seconds "directory" values remain in cache .br # cache for 1-wire device location .br .I timeout_presence = value # seconds "device presence" (which bus) .br .I timeout_serial = value # seconds to wait for serial response .br .I timeout_usb = value # seconds to wait for USB response .br .I timeout_network = value # seconds to wait for tcp/ip response .br .I timeout_ftp = value # seconds inactivity before closing ftp session .br # .br # .B Process control .br .I configuration = filename # file (like this) of program options .br .I pid_file = filename # file to store PID number .br .I foreground .br .I background # default .br .I readonly # prevent changing 1-wire device contents .br .I write # default .br .I error_print = 0-3 # 0-mixed 1-syslog 2-stderr 3-suppressed .br .I error_level = 0-9 # increasing noise .br # .br # .B zeroconf / Bonjour .br .I zero # turn on zeroconf announcement (default) .br .I nozero # turn off zeroconf announcement .br . I annouce = name # name of announced service (optional) .br .I autoserver # Add owservers descovered by zeroconf/Bonjour .br .I noautoserver # Don't use zeroconf/Bonjour owservers (default) .br # .br # .B tcp persistence .br .I timeout_persistent_low = 600 # minimum time a persistent socket will stay open .br .I timeout_persistent_high = 3600 # max time an idle client socket will stay around .br .I .br # .br # .B Display .br .I format = f[.]i[[.]c] # 1-wire address .I f amily .I i d code .I c rc .br # .br # .B Cache .br .I cache_size = 1000000 # maximum cache size (in bytes) or 0 for no limit (default 0) # .br # .B Information .br # (silly in a configuration file) .br .I version .br .I help .br .I morehelp .SH SEE ALSO .so seealso.5so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2404S.30000664000175000017500000000001510361353662012204 00000000000000.so DS2404.3 owfs-2.8p15/src/man/DS1904.30000664000175000017500000000001510244633637012070 00000000000000.so DS2415.3 owfs-2.8p15/src/man/DS1985U.30000664000175000017500000000001510244633637012226 00000000000000.so DS2505.3 owfs-2.8p15/src/man/DS2756.30000664000175000017500000000001510453323355012071 00000000000000.so DS2755.3 owfs-2.8p15/src/man/seealso.nso0000664000175000017500000000222411152551115013325 00000000000000.SS Programs .B owfs (1) owhttpd (1) owftpd (1) owserver (1) .B owdir (1) owread (1) owwrite (1) owpresent (1) .B owtap (1) .SS Configuration and testing .B owfs (5) owtap (1) owmon (1) .SS Language bindings .B owtcl (3) owperl (3) owcapi (3) .SS Clocks .B DS1427 (3) DS1904(3) DS1994 (3) DS2404 (3) DS2404S (3) DS2415 (3) DS2417 (3) .SS ID .B DS2401 (3) DS2411 (3) DS1990A (3) .SS Memory .B DS1982 (3) DS1985 (3) DS1986 (3) DS1991 (3) DS1992 (3) DS1993 (3) DS1995 (3) DS1996 (3) DS2430A (3) DS2431 (3) DS2433 (3) DS2502 (3) DS2506 (3) DS28E04 (3) DS28EC20 (3) .SS Switches .B DS2405 (3) DS2406 (3) DS2408 (3) DS2409 (3) DS2413 (3) DS28EA00 (3) .SS Temperature .B DS1822 (3) DS1825 (3) DS1820 (3) DS18B20 (3) DS18S20 (3) DS1920 (3) DS1921 (3) DS1821 (3) DS28EA00 (3) DS28E04 (3) .SS Humidity .B DS1922 (3) .SS Voltage .B DS2450 (3) .SS Resistance .B DS2890 (3) .SS Multifunction (current, voltage, temperature) .B DS2436 (3) DS2437 (3) DS2438 (3) DS2751 (3) DS2755 (3) DS2756 (3) DS2760 (3) DS2770 (3) DS2780 (3) DS2781 (3) DS2788 (3) DS2784 (3) .SS Counter .B DS2423 (3) .SS LCD Screen .B LCD (3) DS2408 (3) .SS Crypto .B DS1977 (3) .SS Pressure .B DS2406 (3) -- TAI8570 owfs-2.8p15/src/man/standard.3so0000664000175000017500000000373411535563402013415 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: standard.3so,v 1.3 2011/03/09 02:33:38 alfille Exp $ '\" .SS address .SS r_address .I read-only, ascii .br The entire 64-bit unique ID. Given as upper case hexidecimal digits (0-9A-F). .br .I address starts with the .I family code .br .I r address is the .I address in reverse order, which is often used in other applications and labeling. .SS crc8 .I read-only, ascii .br The 8-bit error correction portion. Uses cyclic redundancy check. Computed from the preceding 56 bits of the unique ID number. Given as upper case hexidecimal digits (0-9A-F). .SS family .I read-only, ascii .br The 8-bit family code. Unique to each .I type of device. Given as upper case hexidecimal digits (0-9A-F). .SS id .SS r_id .I read-only, ascii .br The 48-bit middle portion of the unique ID number. Does not include the family code or CRC. Given as upper case hexidecimal digits (0-9A-F). .br .I r id is the .I id in reverse order, which is often used in other applications and labeling. .SS locator .SS r_locator .I read-only, ascii .br Uses an extension of the 1-wire design from iButtonLink company that associated 1-wire physical connections with a unique 1-wire code. If the connection is behind a .B Link Locator the .I locator will show a unique 8-byte number (16 character hexidecimal) starting with family code FE. .br If no .B Link Locator is between the device and the master, the .I locator field will be all FF. .br .I r locator is the .I locator in reverse order. .SS present (DEPRECATED) .I read-only, yes-no .br Is the device currently .I present on the 1-wire bus? .SS type .I read-only, ascii .br Part name assigned by Dallas Semi. E.g. .I DS2401 Alternative packaging (iButton vs chip) will not be distiguished. owfs-2.8p15/src/man/DS2450.30000664000175000017500000001377711607632732012107 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2450.3,v 1.24 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2450 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2450 \- Quad A/D Converter .SH SYNOPSIS .SS Voltage * 4 and Memory. .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .B PIO.[A-D|ALL] | .B volt.[A-D|ALL] | .B volt2.[A-D|ALL] ]] .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .B 8bit/volt.[A-D|ALL] | .B 8bit/volt2.[A-D|ALL] ]] .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-3|ALL] | .B power ] .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .B alarm/high.[A-D|ALL] | .B alarm/low.[A-D|ALL] | .B set_alarm/high.[A-D|ALL] | .B set_alarm/low.[A-D|ALL] | .B set_alarm/unset | .B set_alarm/volthigh.[A-D|ALL] | .B set_alarm/volt2high.[A-D|ALL] | .B set_alarm/voltlow.[A-D|ALL] | .B set_alarm/volt2low.[A-D|ALL] ] .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .so standard_mini.3so ]] .SS CO2 sensor .PP .B 20 [.]XXXXXXXXXXXX[XX][/[ .B CO2/ppm | .B CO2/power | .B CO2/status ] .SH FAMILY CODE .PP .I 20 .SH SPECIAL PROPERTIES .SS alarm/high.A ... alarm/high.D alarm.high.ALL .SS alarm/high.A ... alarm/high.D alarm.high.ALL .I read-write, binary .br The alarm state of the voltage channel. The alarm state is set one of two ways: .TP voltage conversion Whenever the .I DS2450 measures a voltage on a channel, that voltage is compared to the high and low limits .I set_alarm/volthigh and/or .I set_alarm/voltlow and if the alarm is enabled .I set_alarm/high and/or .I set_alarm/low the corresponding flag is set in .I alarm/high and/or .I alarm/low .TP manual set The flag can be set by a direct write to .I alarm/high or .I alarm/low .SS memory .I read-write, binary .br 32 bytes of data. Much has special implications. See the datasheet. .SS pages/page.0 ... pages/page.3 pages/page.ALL .I read-write, binary .br Memory is split into 4 pages of 8 bytes each. Mostly for reading and setting device properties. See the datasheet for details. .br .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS PIO.A ... PIO.D PIO.ALL .I read-write, yes-no .br Pins used for digital control. 1 turns the switch on (conducting). 0 turns the switch off (non-conducting). .br Control is specifically enabled. Reading .I volt will turn off this control. .br .I ALL is an aggregate of the voltages. Readings are made separately. .SS power .I read-write, yes-no .br Is the .I DS2450 externally powered? (As opposed to parasitically powered from the data line). .br The analog A/D will be kept on continuously. And the bus will be released during a conversion allowing other devices to communicate. .br Set true (1) only if Vcc powered (not parasitically powered). Unfortunately, the .I DS2450 cannot sense it's powered state. This flag must be explicitly written, and thus is a potential source of error if incorrectly set. .br It is always safe to leave .I power set to the default 0 (off) state. .SS set_alarm/high.A ... set_alarm/high.D set_alarm/high.ALL .SS set_alarm/low.A ... set_alarm/low.D set_alarm/low.ALL .I read-write, yes-no .br Enabled status of the voltage threshold. 1 is on. 0 is off. .SS set_alarm/volthigh.A ... set_alarm/volthigh.D set_alarm/volthigh.ALL .SS set_alarm/volt2high.A ... set_alarm/volt2high.D set_alarm/volt2high.ALL .SS set_alarm/voltlow.A ... set_alarm/voltlow.D set_alarm/voltlow.ALL .SS set_alarm/volt2low.A ... set_alarm/volt2low.D set_alarm/volt2low.ALL .I read-write, floating point .br The upper or lower limit for the voltage measured before triggering an alarm. .br Note that the alarm must be enabled .I alarm/high or .I alarm.low and an actual reading must be requested .I volt for the alarm state to actually be set. The alarm state can be sensed at .I alarm/high and .I alarm/low .SS set_alarm/unset .I read-write, yes-no .br Status of the power-on-reset (POR) flag. .br The POR is set when the .I DS2450 is first powered up, and will match the alarm state until explicitly cleared. (By writing 0 to it). .br The purpose of the POR is to alert the user that the chip is not yet fully configured, especially alarm thresholds and enabling. .SS volt.A ... volt.D volt.ALL .SS 8bit/volt.A ... 8bit/volt.D 8bit/volt.ALL .I read-only, floating point .br Voltage read, 16 bit resolution (or 8 bit for the .I 8bit directory). Range 0 - 5.10V. .br Output ( .I PIO ) is specifically disabled. .br .I ALL is an aggregate of the voltages. Readings are made separately. .SS volt2.A ... volt2.D volt2.ALL .SS 8bit/volt2.A ... 8bit/volt2.D 8bit/volt2.ALL .I read-only, floating point .br Voltage read, 16 bit resolution (or 8 bit for the .I 8bit directory). Range 0 - 2.55V. .br Output ( .I PIO ) is specifically disabled. .br .I ALL is an aggregate of the voltages. Readings are made separately. .SH CO2 (Carbon Dioxide) SENSOR PROPERTIES The CO2 sensor is a device constructed from a SenseAir K30 and a .I DS2450 .SS CO2/power .I read-only, floating point .br Supply voltage to the CO2 sensor (should be around 5V) .SS CO2/ppm .I read-only, unsigned .br CO2 level in ppm (parts per million). Range 0-5000. .SS CO2/status .I read-only, yes-no .br Is the internal voltage correct (around 3.2V)? .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2450 The .B DS2450 (3) is a (supposedly) high resolution A/D converter with 4 channels. Actual resolutin is reporterd to be 8 bits. The channels can also function as switches. Voltage sensing (with temperature and current, but sometimes restricted voltrage ranges) can also be obtained with the .B DS2436 , .B DS2438 and .B DS276x .SH ADDRESSING .so addressing.3so .SH DATASHEET .TP DS2450 http://pdfserv.maxim-ic.com/en/ds/DS2450.pdf .TP CO2 sensor http://www.senseair.se/Datablad/k30%20.pdf .TP CO2 device https://www.m.nu/co2meter-version-2-p-259.html?language=en .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1977.30000664000175000017500000000575111535561503012112 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1977.3,v 1.14 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1977 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1977 \- Password Protected 32kbit Memory iButton .SH SYNOPSIS Non-volatile memory. .PP .B 37 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-510|ALL] | .B set_number/full | .B set_number/read | .B set_password/enabled | .B set_password/full | .B set_password/read | .B use_number/full | .B use_number/read | .B use_password/full | .B use_password/read | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 37 DS1977 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 32704 bytes of memory. Possibly protected by a password. .SS pages/page.0 ... pages/page.510 pages/page.ALL .I read-write, binary .br Memory is split into 511 pages of 64 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS set_number/full set_number/read .I write-only, ascii .br Passwords entered as numbers, either decimal, or hex of form 0x0123456789ABCDEF. Handled the same as .I set_password/xxx .SS set_password/enable .I read-write, yes-no .br Turn on/off password protection for the DS1977, or return the current state. .SS set_password/full set_password/read .I write-only, binary .br Passwords (8 byte values) that allow read or full access to the DS1977 memory. The password set by .I set_password/xxx are stored in the DS1977 and locally in the program as well (as if .I use_password/xxx was also called). .SS use_password/full use_password/read .I write-only, binary .br Passwords (8 byte values) that allow read or full access to the DS1977 memory. The password set by .SS use_number/full use_number/read .I write-only, ascii .br Passwords entered as numbers, either decimal, or hex of form 0x0123456789ABCDEF. Handled the same as .I use_password/xxx .SS use_password/full use_password/read .I write-only, binary .br Passwords (8 byte values) that allow read or full access to the DS1977 memory. The password set by .I use_password/xxx are stored in the program and must match the passwords stored in the DS1977. Changing the DS1977 passwords using .I set_password/xxx will change these values as well. .I use_password/xxx are stored in the program and must match the passwords stored in the DS1977. Changing the DS1977 passwords using .I set_password/xxx will change these values as well. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1977 The .B DS1977 (3) is an iButton with static memory that is optionally protected by a password. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1977.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2404.30000664000175000017500000001366311535563402012075 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2404.3,v 1.16 2011/03/09 02:33:38 alfille Exp $ '\" .TH DS2404 3 2006 "OWFS Manpage" "One-Wire File System" .SH NAME DS2404 \- EconoRAM time chip .br DS2404S \- Dual port memory plus time .br DS1994 \- 4k plus time iButton .br DS1427 \- Time iButton .SH SYNOPSIS Real time clock, 4kbit memory. 3-wire interface, too. .P .B 04.XXXXXXXXXXXX / .B alarm | .B auto | .B cycle | .B date | .B delay | .B interval | .B memory | .B pages/page.[0-15|ALL] | .B readonly/[memory|clock|cycle|interval] | .B memory | .B pages/page.[0-15|ALL] | .B readonly/[memory|clock|cycle|interval] | .B running | .B set_alarm | .B start | .B trigger/[cycle,date,interval,udate,uinterval] | .B udate | .B uinterval | .so standard_mini.3so .P .B 84.XXXXXXXXXXXX / .B alarm | .B auto | .B cycle | .B date | .B delay | .B interval | .B memory | .B pages/page.[0-15|ALL] | .B readonly/[memory|clock|cycle|interval] | .B running | .B set_alarm | .B start | .B trigger/[cycle,date,interval,udate,uinterval] | .B udate | .B uinterval | .B address | .B crc8 | .B id | .B present | .B type .SH FAMILY CODE .TP .I 04 DS2404 DS1994 .TP .I 84 DS1427 DS2404S .SH SPECIAL PROPERTIES .SS alarm .I read-write, unsigned integer (0-111) .br .I Alarm state of the .I DS2404 (3) triggered by time or counter events. Reading the alarm state clears the alarm. .br The .I alarm value is of the form CIR, where: .TP C .I cycle counter alarm .br .I 0 no .br .I 1 yes .TP I .I interval timer alarm .br .I 0 no .br .I 1 yes .TP R real-time clock alarm .br .I 0 no .br .I 1 yes .SS auto .I read-write, yes-no .br Flag for mode of .I interval counter operation. 0=manual 1=auto .br See the .I datasheet for details. .SS date .I read-write, ascii .br 26 character date representation of the .I udate value. Increments once per second while .I running .br Actual internal representation has higher precision. .br Cannot be altered if .I readonly/clock is set. .br Setting .I date to a null string will put the current system time. .br Accepted date formats are: .br Sat[urday] March 12 12:23:59 2001 .br Apr[il] 4 9:34:56 2002 .br 3/23/04 23:34:57 .br current locale setting (your system's format) .SS delay .I read-write, yes-no .br Flag for adding a delay to .I cycle counter. 0=short 1-long .br See the .I datasheet under "IDEL" for details. .SS interval .I read-write, date .br Interval timer value, represented as a .I date string. More typically will be used as .I uinterval to read the actual elapsed seconds. .SS memory .I read-write, binary .br 512 bytes of memory. The .I readonly/memory flag prevents further change. .SS pages/page.0 ... pages/page.15 pages/page.ALL .I read-write, yes-no .br Memory is split into 16 pages of 32 bytes each. The .I readonly/memory flag prevents further change. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS readonly/[memory|clock|interval|cycle] .I read-write, yes-no .br Permanently protect part of the chip's function from alteration. .TP .I readonly/memory .I page.X and . I memory .TP .I readonly/clock .I date and .I udate .TP .I readonly/interval .I interval .TP .I readonly/cycle .I cycle .SS running .I read-write, yes-no .br State of the clock. 0=off 1=running. .SS set_alarm .I read-write, unsigned integer (0-111) .br Which of the .I alarm triggers are enabled in the .I DS2404 (3) .br The .I set_alarm value is of the form CIR, where: .TP C .I cycle counter alarm .br .I 0 no .br .I 1 yes .TP I .I interval timer alarm .br .I 0 no .br .I 1 yes .TP R real-time clock alarm .br .I 0 no .br .I 1 yes .SS start .I read-write, yes-no .br Flag for starting the .I interval counter operation if not in .I auto mode. 0=stop 1=start .br See the .I datasheet for details. .SS trigger/[cycle,date,interval,udate,uinterval] .I read-write,varies .br Target value that will .I trigger the .I alarm if the corresponding .I set_alarm field is set. .br The format is the same as the similarly named field (i.e. .I date for .I trigger/date ) .SS udate .I read-write, unsigned integer .br Time represented as a number. .I udate increments once per second, while .I running is on. .br Usually set to unix time standard: number of seconds since Jan 1, 1970. The .I date field will be the unix representation of .I udate and setting either will change the other. .SS uinterval .I read-write, unsigned interval .br Similar to the .I udate field, except corresponds to the .I interval value. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None implemented. .SH DESCRIPTION .so description.3so .SS DS1427 DS1994 DS2404 DS2404S The .B DS1427 (3), DS1994 (3), DS2404 (3), and .B DS2404S (3) family of 1-wire devices includes clock functions, with timers, memory, counters and alarms. It is possible to write-protect regians of memory. Uses include software or hardware timing and control. .P .SS Chips Both the .B DS2404 (3) and .B DS2404S (3) have 1-wire and 3-wire interfaces, which might be useful for transferring data between the 2 buses. They act as a passive slave to both busses. The .B DS2404 (3) and .B DS2404S (3) require an external source of power and an external crystal. They also offer a reset and 1HZ clock pin. .P .SS iButtons Both the .B DS1427 and .B DS1994 offer the memory, alarms, and clock function in iButton format. Because the iButton is a complete sealed package, battery and crystal are internal. Everything is access via the 1-wire interface. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2404.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2404S-C01.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1994.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1427.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owcapi.10000664000175000017500000001626411542520452012531 00000000000000'\" '\" Copyright (c) 2003-2006 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Library manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owcapi.1,v 1.10 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWCAPI 1 2004 "OWFS Manpage" "One-Wire File System" .SH NAME .B owcapi \- easy C-language 1-wire interface .SH SYNOPSIS .B libowcapi library to link with your program .SS Initialization .B ssize_t OW_init( .I device name or full parameter string .B ) .br .B ssize_t OW_init_args( .I int argc, char ** args .B ) .PP The full set of initialization options is extensive. They correspond roughly to the command line options of .B owfs (1) .B owhttpd (1) and .B owftpd (1) .SS Get data .B int OW_present( .I const char * path .B ) .br .B int OW_get( .I const char * path, char ** buffer, size_t * buffer_length .B ) .br .B ssize_t OW_lread( .I const char * path, unsigned char * buffer, const size_t size, const off_t offset .B ) .SS Set data .B ssize_t OW_put( .I const char * path, const char * buffer, size_t * buffer_length .B ) .br .B ssize_t OW_lwrite( .I const char * path, const unsigned char * buffer, const size_t size, const off_t offset .B ) .SS Debug .B void OW_set_error_level( .I const char *param .B ) .br .B void OW_set_error_print( .I const char *param .B ) .SS Close .B void OW_finish( .I void .B ) .SH FUNCTIONS .SS OW_init .I OW_init_string offers the full flexibility of the .B owfs (1) and .B owhttpd (1) command line. .TP .I Arguments Can be as simple as jus the device name, a full parameter specification. One or more device names (includes tcp, serial, usb...) and command line switches. See .B owfs (1) for full syntax. .TP .I Returns 0 for success. \-1 on error and .I errno will be set. .I OW_finish does not need to be called if .I OW_init fails. .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_init_args .I OW_init_args offers the full flexibility of the .B owfs (1) and .B owhttpd (1) command line. .TP .I Arguments One or more device names (includes tcp, serial, usb...) and command line switches. See .B owfs (1) for full syntax. Unlike .I OW_init_string the arguments are in argv/argc format. .TP .I Returns 0 for success. \-1 on error and .I errno will be set. .I OW_finish does not need to be called if .I OW_init fails. .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_present .I OW_present is used to check presence of a 1-wire device. .TP .I Arguments .I path is the path to the directory or file (property). .TP .I Returns 0 on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_get .I OW_get is used to get directory listings and file contents. The results are put in a dynamically allocated buffer. .TP .I Arguments .I path is the path to the directory or file (property). .I *buffer returns a pointer to a buffer containing the directory (comma separated) or value. .I buffer_length returns the length of the value/string in .I buffer .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .TP .I Important note .I buffer is allocated ( with malloc ) by .I OW_get but must be freed in your program. See .B malloc (3) and .B free (3) .SS OW_lread .I OW_lread is used to read 1-wire memory chips. Think of it as a combination of .I lseek and .I read It allows random-access to the memory, specifying location and length. Unlike .I OW_get directories cannot be obtained and the buffer must be pre-allocated rather than allocated by the routine. .I buffer must be at least .I size length. .TP .I Arguments .I path is the path to the file (property). .I buffer is the (pre-allocated) memory area where the value will be placed. .I size is the length of bytes requested. .I offset is the position in file to start reading. .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_put .I OW_put is an easy way to write to 1-wire chips. .TP .I Arguments .I path is the path to the file (property). .I buffer is the value to be written. .I buffer_length is the length of the value .I buffer. .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_lwrite .I OW_lwrite is the companion of .I OW_lread. It allows writing to arbitrary positions in 1-wire memory. Think of it as a combination of .I lseek and .I write. .I buffer must be at least .I size length. .TP .I Arguments .I path is the path to the file (property). .I buffer is the data to be written. .I size is the length of bytes to be written. .I offset is the position in file to start writing. .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_set_error_level .I OW_set_error_level sets the debug output to a certain level. 0 is default, and higher value gives more output. .br (0=default, 1=err_connect, 2=err_call, 3=err_data, 4=err_detail, 5=err_debug, 6=err_beyond) .TP .I Arguments .I params is the level. Should be an integer. .TP .I Returns None .TP .I Sequence One of the .I init functions must be called before setting the level, since .I init defaults to level 0. .SS OW_set_error_print .I OW_set_error_print sets where the debug output should be directed. 0=mixed output, 1=syslog, 2=console. .TP .I Arguments .I params is the level. Should be an integer between 0 and 2. .TP .I Returns None .TP .I Sequence One of the .I init functions must be called before setting the level, since .I init defaults to 0 (mixed output). .SS OW_finish .I OW_finish cleans up the .I OWFS 1-wire routines, releases devices and memory. .TP .I Arguments None. .TP .I Returns None .TP .I Sequence .I OW_finish is optional since cleanup is automatic on program exit. .SH "DESCRIPTION" .so description.1so .SS libowcapi .B libowcapi (1) is an encapsulation of the full .B libow library for C programs. .PP .B libowcapi (1) allows a C program to use .I OWFS principles (consistent naming scheme, multiple adapters, devices, and compatibility) directly from a C program. There are analogous modules for other programming languages: .TP .I C libowcapi .TP .I perl owperl .TP .I php owphp .TP .I python owpython .TP .I tcl owtcl .SH EXAMPLE /* Simple directory listing -- no error checking */ .br #include .br unsigned char * buf; .br size_t s ; .br OW_init("/dev/ttyS0"); .br OW_set_error_print("2"); .br OW_set_error_level("6"); .br OW_get("/",&buf,&s) ; .br printf("Directory %s\n",buf); .br free(buf); .br OW_finish() ; .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/temperatures_mini.3so0000664000175000017500000000015011152552464015337 00000000000000.B fasttemp | .B temperature | .B temperature9 | .B temperature10 | .B temperature11 | .B temperature12 owfs-2.8p15/src/man/DS1986U.30000664000175000017500000000001510244633637012227 00000000000000.so DS2506.3 owfs-2.8p15/src/man/seealso.5so0000664000175000017500000000222411152551115013234 00000000000000.SS Programs .B owfs (1) owhttpd (1) owftpd (1) owserver (1) .B owdir (1) owread (1) owwrite (1) owpresent (1) .B owtap (1) .SS Configuration and testing .B owfs (5) owtap (1) owmon (1) .SS Language bindings .B owtcl (3) owperl (3) owcapi (3) .SS Clocks .B DS1427 (3) DS1904(3) DS1994 (3) DS2404 (3) DS2404S (3) DS2415 (3) DS2417 (3) .SS ID .B DS2401 (3) DS2411 (3) DS1990A (3) .SS Memory .B DS1982 (3) DS1985 (3) DS1986 (3) DS1991 (3) DS1992 (3) DS1993 (3) DS1995 (3) DS1996 (3) DS2430A (3) DS2431 (3) DS2433 (3) DS2502 (3) DS2506 (3) DS28E04 (3) DS28EC20 (3) .SS Switches .B DS2405 (3) DS2406 (3) DS2408 (3) DS2409 (3) DS2413 (3) DS28EA00 (3) .SS Temperature .B DS1822 (3) DS1825 (3) DS1820 (3) DS18B20 (3) DS18S20 (3) DS1920 (3) DS1921 (3) DS1821 (3) DS28EA00 (3) DS28E04 (3) .SS Humidity .B DS1922 (3) .SS Voltage .B DS2450 (3) .SS Resistance .B DS2890 (3) .SS Multifunction (current, voltage, temperature) .B DS2436 (3) DS2437 (3) DS2438 (3) DS2751 (3) DS2755 (3) DS2756 (3) DS2760 (3) DS2770 (3) DS2780 (3) DS2781 (3) DS2788 (3) DS2784 (3) .SS Counter .B DS2423 (3) .SS LCD Screen .B LCD (3) DS2408 (3) .SS Crypto .B DS1977 (3) .SS Pressure .B DS2406 (3) -- TAI8570 owfs-2.8p15/src/man/DS1994.30000664000175000017500000000001510361353662012076 00000000000000.so DS2404.3 owfs-2.8p15/src/man/DS1982U.30000664000175000017500000000001510244633637012223 00000000000000.so DS2502.3 owfs-2.8p15/src/man/DS2780.30000664000175000017500000001263311607632732012103 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2780.3,v 1.12 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2760 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2780 \- Stand-alone Fuel Gauge IC .br DS2788 \- Stand-alone Fuel Gauge with LED Drivers .SH SYNOPSIS .SS Temperature Voltage Current Memory and Switch. .PP .B 32 [.]XXXXXXXXXXXX[XX][/[ .B lock.[0-1|ALL] | .B memory | .B pages/page.[0-1|ALL] | .B PIO | .B sensed | .B temperature | .B vbias | .B vis | .B volt | .B volthours | .br .B aef | .B chgtf | .B ds | .B learnf | .B pmod | .B porf | .B rnaop | .B sef | .B uven | .B uvf | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 32 [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature .SH FAMILY CODE .PP .I 32 .SH SPECIAL PROPERTIES .SS lock.[0-1|ALL] .I read-write, yes-no .br Lock either of the two eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-1|ALL] .I read-write, binary Two 16 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2680 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .I DS2780 to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH OBSCURE PROPERTIES .SS aef chgtf dc learnf pmod porf rnaop sef uven uvf .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2780 The .B DS2780 (3) is a battery charging controller. It has elaborate algorithms for estimating battery capacity. .PP A number of interesting devices can be built with the .B DS2780 including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2780.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2788.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS28E04.30000664000175000017500000001000411535561503012170 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS28E04.3,v 1.8 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS28E04-100 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS28E04 \- 1-Wire EEPROM chip (4096-bit) with seven address inputs .SH SYNOPSIS 4096-bit EEPROM, 2 port switch .PP .B 1C [.]XXXXXXXXXXXX[XX][/[ .B latch.[0-1|ALL|BYTE] | .B PIO.[0-1|ALL|BYTE] | .B power | .B sensed.[0-1|ALL|BYTE] | .B polarity | .B por | .B set_alarm | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1C .SH SPECIAL PROPERTIES .SS latch.0 latch.1 latch.ALL latch.BYTE .I read-write, binary .br The 2 pins (PIO) latch a bit when their state changes, either externally, or through a write to the pin. .br Reading the .I latch property indicates that the latch has been set. .br Writing any data to ANY .I latch will reset them all. (This is the hardware design). .br .I ALL is all .I latch states, accessed simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS PIO.0 PIO.1 PIO.ALL PIO.BYTE .I read-write, yes-no .br State of the open-drain output ( .I PIO ) pin. 0 = non-conducting = off, 1 = conducting = on. .br Writing zero will turn off the switch, non-zero will turn on the switch. Reading the .I PIO state will return the switch setting. To determine the actual logic level at the switch, refer to the .I sensed.0 sensed.1 sensed.ALL sensed.BYTE property. .br .I ALL references all channels simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS power .I read-only, yes-no .br Is the .I DS28E04 powered parasitically (=0) or separately on the Vcc pin (=1)? .SS sensed.0 sensed.1 sensed.ALL sensed.BYTE .I read-only, yes-no .br Logic level at the .I PIO pin. 0 = ground. 1 = high (~2.4V - 5V ). Really makes sense only if the .I PIO state is set to zero (off), else will read zero. .br .I ALL references all channels simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS polarity .I read-only, yes-no .br Reports the state of the POL pin. The state of the POL pin specifies whether the PIO pins P0 and P1 power up high or low. The polarity of a pulse generated at a PIO pin is the opposite of the pin's power-up state. .TP .I 0 PIO powers up 0 .TP .I 1 PIO powers up 1 .PP .SS por .I read-write, yes-no .br Specifies whether the device has performed power-on reset. This bit can only be cleared to 0 under software control. As long as this bit is 1 the device will allways respond to a conditional search. .SS set_alarm .I read-write, integer unsigned (0-333) .br A number consisting of 3 digits XYY, where: .TP X select source and logical term .br .I 0 PIO OR .br .I 1 latch OR .br .I 2 PIO AND .br .I 3 latch AND .TP Y select channel and polarity .br .I 0 Unselected (LOW) .br .I 1 Unselected (HIGH) .br .I 2 Selected LOW .br .I 3 Selected HIGH .PP All digits will be truncated to the 0-3 range. Leading zeroes are optional. Low-order digit is channel 0. .PP Example: .TP 133 Responds on Conditional Search when latch.1 or latch.0 are set to 1. .TP 222 Responds on Conditional Search when sensed.1 and sensed.0 are set to 0. .TP 000 (0) Never responds to Conditional Search. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS Use the .I set_alarm property to set the alarm triggering criteria. .SH DESCRIPTION .so description.3so .SS DS28E04 The .B DS28E04 (3) is a memory chip that bends the unique addressing capabilities of the .I 1-wire design. Some of the ID bits can be assigned by hardware. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS28E04.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/ownetlib.10000664000175000017500000000002111542520452013052 00000000000000.so man1/ownet.1 owfs-2.8p15/src/man/temperature_threshold.3so0000664000175000017500000000137011152552464016221 00000000000000.SH TEMPERATURE ALARM LIMITS When the device exceeds either .I temphigh or .I templow temperature threshold the device is in the alarm state, and will appear in the alarm directory. This provides an easy way to poll for temperatures that are unsafe, especially if .I simultaneous temperature conversion is done. .PP Units for the temperature alarms are in the same .I temperature scale that was set for .I temperature measurements. .PP Temperature thresholds are stored in non-volatile memory and persist until changed, even if power is lost. .SS temphigh .I read-write, integer .br Shows or sets the lower limit for the high temperature alarm state. .SS templow .I read-write, integer .br Shows or sets the upper limit for the low temperature alarm state. owfs-2.8p15/src/man/DS2401.30000664000175000017500000000240211535561503012057 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2401.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2401 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME .B DS2401 - Silicon Serial Number .br DS1990A \- Serial Number iButton .PP .B 01 [.]XXXXXXXXXXXX[XX][/[ .so standard_mini.3so ]] .SH SYNOPSIS Unique serial number only. .SH FAMILY CODE .PP .I 01 .SH SPECIAL PROPERTIES None. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2401 DS1990A The .B DS2401 (3) and .B DS1990A (3) are the most basic of 1-wire devices. Their sole property is it's unique address. It can be used for unique identification. Nonetheless, many keylocks, night watchman systems, and tracking systems use this device. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2401.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1990A-F3-DS1990A-F5.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/LCD.30000664000175000017500000000707711535561503011661 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: LCD.3,v 1.16 2011/03/09 02:17:39 alfille Exp $ '\" .TH LCD 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME LCD \- LCD controller .SH SYNOPSIS 1-wire LCD controller by Louis Swart .PP .B FF [.]XXXXXXXXXXXX[XX][/[ .B backlight | .B counters.[0-3|ALL] | .B cumulative.[0-3|ALL] | .B branch.[0-1|ALL] | .B data | .B gpio.[0-3|ALL] | .B LCDon | .B line16.[0-3|ALL] | .B line20.[0-3|ALL] | .B line40.[0|1|ALL] | .B memory | .B register | .B screen16 | .B screen20 | .B screen40 | .B version | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I FF .SH SPECIAL PROPERTIES .SS backlight .I write-only,yes-no .br Write a non-zero value to turn on the LCD backlight. Write zero to turn off. .SS counters[0-3,ALL] .I read-only,unsigned integer .br Read the number of times the gpio has been externally changed. If wired to a push switch, will count twice per button press. The LCD firmware resets all the counter when any one is read. Use the .I ALL extension to read them all, simultaneously, or use the .I cumulative property instead. .br .I ALL is an aggregate of the properties, comma separated. Read atomically. .SS cumulative[0-3,ALL] .I read-write,unsigned integer .br Cumulative sum of the .I counters property. To reset, write a zero. The cumulative counter can have any value written, which allows preservation of counts accross program restarts if the value at program termination is stored. .br Reading .I cumulative will reset the .I counters property. All the cumulative counters will be updated so that no counts will be lost. Reads of .I counters can be interspersed without losing .I cumulative accuracy. .br Note: .I cumulative requires the .I caching system be compiled into libow. .br .I ALL is an aggregate of the properties, comma separated. .SS data .I read-write,unsigned int .br Contents of the LCD data byte (see datasheet). Not usually needed. .SS LCDon .I write-only,yes-no .br Write a non-zero value to turn on the LCD screen (also clears). Write a zero to turn off. .SS line16[0-3,ALL] line20[0-3,ALL] line40[0-1,ALL] .I write-only,ascii .br Write text to the LCD screen. Assumes 16/20/40 char width. (Cannot be determined from controller). .br .I ALL is an aggregate of the properties, comma separated. Each is set in turn. .SS memory .I read-write,binary .br 112 bytes of on-board memory. .SS register .I read-write,unsigned int .br Contents of the LCD register (see datasheet). Not usually needed. .SS screen16 screen20 screen40 .I write-only,ascii .br Write text to the LCD screen. Assumes 16/20/40 char width. (Cannot be determined from controller). .br .SS version .I read-only,ascii .br Self-reported LCD controller version. 16 bytes. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None implemented. .SH DESCRIPTION .so description.3so .SS LCD The .B LCD (3) controller is a microprocessor driven device that simulates the operation of 1-wire devices. It's creator has arbitrarily chosen the .I family code FF. The controller requires external power. Full details are available from the designer. .br The main draw of the .B LCD controller is as any easy way to provide output to users. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br Available from http://www.louisswart.co.za/1-Wire_index.html .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/standard_mini.3so0000664000175000017500000000070511367346473014436 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: standard_mini.3so,v 1.2 2010/05/02 19:06:35 alfille Exp $ '\" .B address | .B crc8 | .B id | .B locator | .B r_address | .B r_id | .B r_locator | .B type owfs-2.8p15/src/man/libowcapi.10000664000175000017500000000001510435456653013216 00000000000000.so owcapi.1 owfs-2.8p15/src/man/DS2751.30000664000175000017500000001410111607632732012071 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2751.3,v 1.12 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2751 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2751 \- Multichemistry Battery Fuel Gauge .SH SYNOPSIS .SS Temperature Voltage, Current, Memory, and Switch. .PP .B 51 [.]XXXXXXXXXXXX[XX][/[ .B amphours | .B current | .B currentbias | .B lock.[0-1|ALL] | .B memory | .B pages/page.[0-1|ALL] | .B PIO | .B sensed | .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature | .B vbias | .B vis | .B volt | .B volthours | .br .B defaultpmod | .B pmod | .B por | .B uven | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 51 [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature .SH FAMILY CODE .PP .I 51 .SH SPECIAL PROPERTIES .SS amphours .I read-write, floating point .br Accumulated amperage read by current sensor. Units are in .B Amp-hr (Assumes internal 25mOhm resistor). Derived from .I volthours / Rinternal. .br Formally .I amphours is the integral of .I current - currentbias over time. .SS current .I read-only, floating point .br Current reading. Units are in .B Amp (Assumes internal 25 mOhm resistor). Derived from .I vis / Rinternal. .SS currentbias .I read-write, floating point .br Fixed offset applied to each .I current measurement. Used in the .I amphours value. Assumes internal 25mOhm resistor. Units are .B Amp and range from -.08A to .08A. .br Derived from .I vbias / Rinternal. .SS lock.[0-1|ALL] .I read-write, yes-no .br Lock either of the two eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-1|ALL] .I read-write, binary Two 16 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2670 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .I DS2760 to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH OBSCURE PROPERTIES .SS pmod por uven .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SS defaultpmod .I read-write, yes-no .br Default power-on state for the corresponding properties. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2751 The .B DS2751 (3) is battery charging controllers similar to the .B DS2760 (3) .PP A number of interesting devices can be built with the .B DS2751 (3) including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2751.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/seealso.1so0000664000175000017500000000222411152551115013230 00000000000000.SS Programs .B owfs (1) owhttpd (1) owftpd (1) owserver (1) .B owdir (1) owread (1) owwrite (1) owpresent (1) .B owtap (1) .SS Configuration and testing .B owfs (5) owtap (1) owmon (1) .SS Language bindings .B owtcl (3) owperl (3) owcapi (3) .SS Clocks .B DS1427 (3) DS1904(3) DS1994 (3) DS2404 (3) DS2404S (3) DS2415 (3) DS2417 (3) .SS ID .B DS2401 (3) DS2411 (3) DS1990A (3) .SS Memory .B DS1982 (3) DS1985 (3) DS1986 (3) DS1991 (3) DS1992 (3) DS1993 (3) DS1995 (3) DS1996 (3) DS2430A (3) DS2431 (3) DS2433 (3) DS2502 (3) DS2506 (3) DS28E04 (3) DS28EC20 (3) .SS Switches .B DS2405 (3) DS2406 (3) DS2408 (3) DS2409 (3) DS2413 (3) DS28EA00 (3) .SS Temperature .B DS1822 (3) DS1825 (3) DS1820 (3) DS18B20 (3) DS18S20 (3) DS1920 (3) DS1921 (3) DS1821 (3) DS28EA00 (3) DS28E04 (3) .SS Humidity .B DS1922 (3) .SS Voltage .B DS2450 (3) .SS Resistance .B DS2890 (3) .SS Multifunction (current, voltage, temperature) .B DS2436 (3) DS2437 (3) DS2438 (3) DS2751 (3) DS2755 (3) DS2756 (3) DS2760 (3) DS2770 (3) DS2780 (3) DS2781 (3) DS2788 (3) DS2784 (3) .SS Counter .B DS2423 (3) .SS LCD Screen .B LCD (3) DS2408 (3) .SS Crypto .B DS1977 (3) .SS Pressure .B DS2406 (3) -- TAI8570 owfs-2.8p15/src/man/owhttpd.10000664000175000017500000000372511542520452012736 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owhttpd.1,v 1.28 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWHTTPD 1 2004 "OWFS Manpage" "One-Wire File System" .SH NAME .B owhttpd \- Tiny webserver for 1-wire control .SH SYNOPSIS .B owhttpd .so cmdline_mini.1so .I \-p tcp-port .SH "DESCRIPTION" .so description.1so .SS owhttpd .B owhttpd (1) is a small webserver that shows the Dallas/Maxim 1-Wire bus attached to a serial port. The main view shows the devices found, You can then navigate to individual devices, and view/alter their properties. .PP .B owhttpd (1) uses the same naming convention as .B owfs (1) , where the URL corresponds to the filename. .PP The web server is a modified version of chttpd by Greg Olszewski. It serves no files from the disk, only virtual files from the 1-wire bus. Security should therefore be good. Only the 1-wire bus is at risk. .SH SPECIFIC OPTIONS .SS \-p portnum Sets the tcp port the web server runs on. Access with the URL http://servernameoripaddress:portnum .PP If no port is specified, an ephemeral port is selected by the operating system. Use .I zeroconf (Bonjour) to discover the assigned port. .so device.1so .so temperature.1so .so pressure.1so .so format.1so .so job_control.1so .so configuration.1so .so help.1so .so timeout.1so .SH EXAMPLE .TP owhttpd \-p 3001 \-d /dev/ttyS0 Web server runs on tcp port 3001, serial adapter at ttyS0 .TP owhttpd \-p 3001 \-s littlehost:4304 \-\-error_level=3 Web server on port 3001, from .I owserver process on host "littlehost", extensive error messages. .TP owhttpd \-p 3001 \-u \-u2 \-r Read-only web server on port 3001, using two usb adapters. .SH AVAILABILITY http://www.owfs.org .SH SEE ALSO .so seealso.1so .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS28EC20.30000664000175000017500000000277211535561503012306 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS28EC20.3,v 1.9 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS28EC20 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS28EC20 \- EEPROM (20 kBit) .SH SYNOPSIS Erasable programmable read-only memory (EEPROM) .PP .B 43 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-79|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 23 DS28EC20 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 512 bytes of memory. Initially all bits are set to 1. Writing zero permanently alters the memory. .SS pages/page.0 ... pages/page.79 pages/page.ALL .I read-write, yes-no .br Memory is split into 80 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS28EC20 The .B DS28EC20 (3) is used for storing memory which should be available even after a reset or power off. It's main advantage is for audit trails (i.e. a digital purse). .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://datasheets.maxim-ic.com/en/ds/DS28EC20.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Christian Magnusson (mag@mag.cx) owfs-2.8p15/src/man/DS2411.30000664000175000017500000000001510452562000012044 00000000000000.so DS2401.3 owfs-2.8p15/src/man/DS1963L.30000664000175000017500000000306311542520452012207 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1963L.3,v 1.9 2011/03/24 01:40:58 alfille Exp $ '\" .TH DS1963L 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1963L \- 256 byte Monetary iButton .SH SYNOPSIS Non-volatile R/W memory with counters .PP .B 1A [.]XXXXXXXXXXXX[XX][/[ .B pages/count.[0-15|ALL] | .B memory | .B pages/page.[0-15|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1A .SH SPECIAL PROPERTIES .SS page/count.[0-15|ALL] .I read-only, unsigned .br Each write to the memory page increments the counter. An application can tell if the memory has been changed by another process. .P Only 4 pages are actually connected to counters: .TP Counter1 .I page/counter.12 .TP Counter2 .I page/counter.13 .TP Counter3 .I page/counter.14 .TP Counter4 .I page/counter.15 .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1963L The .B DS1963L (3) is used for read/write storage. It's main advantage is for audit trails (i.e. a digital purse). Each write to pages 12-15 will increment the read-only counter. .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://datasheets.maxim-ic.com/en/ds/DS1963L.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2408.30000664000175000017500000001730111535561503012072 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2408.3,v 1.26 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2408 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2408 \- 1-Wire 8 Channel Addressable Switch .SH SYNOPSIS 8 port switch .PP .B 29 [.]XXXXXXXXXXXX[XX][/[ .B latch.[0-7|ALL|BYTE] | .B LCD_M/[clear|home|screen|message] | .B LCD_H/[clear|home|yxscreen|screen|message|onoff] | .B PIO.[0-7|ALL|BYTE] | .B power | .B sensed.[0-7|ALL|BYTE] | .B strobe | .B por | .B set_alarm | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 29 .SH SPECIAL PROPERTIES .SS latch.0 ... latch.7 latch.ALL latch.BYTE .I read-write, binary .br The 8 pins (PIO) latch a bit when their state changes, either externally, or through a write to the pin. .br Reading the .I latch property indicates that the latch has been set. .br Writing "true" (non-zero) to ANY .I latch will reset them all. (This is the hardware design). .br .I ALL is all .I latch states, accessed simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS PIO.0 ... PIO.7 PIO.ALL PIO.BYTE .I read-write, yes-no .br State of the open-drain output ( .I PIO ) pin. 0 = non-conducting (off), 1 = conducting (on). .br Writing zero will turn off the switch, non-zero will turn on the switch. Reading the .I PIO state will return the switch setting. To determine the actual logic level at the switch, refer to the .I sensed.0 ... sensed.7 sensed.ALL sensed.BYTE property. .br .I ALL references all channels simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS power .I read-only, yes-no .br Is the .I DS2408 powered parasitically (0) or separately on the Vcc pin (1)? .SS sensed.0 ... sensed.7 sensed.ALL .I read-only, yes-no .br Logic level at the .I PIO pin. 0 = ground. 1 = high (~2.4V - 5V ). Really makes sense only if the .I PIO state is set to zero (off), else will read zero. .br .I ALL references all channels simultaneously, comma separated. .br .I BYTE references all channels simultaneously as a single byte. Channel 0 is bit 0. .SS strobe .I read-write, yes-no .br RSTZ Pin Mode Control. Configures RSTZ as either RST input or STRB output: .TP .I 0 configured as RST input (default) .TP .I 1 configured as STRB output .PP .SS por .I read-write, yes-no .br Specifies whether the device has performed power-on reset. This bit can only be cleared to 0 under software control. As long as this bit is 1 the device will allways respond to a conditional search. .SS set_alarm .I read-write, integer unsigned (0-333333333) .br A number consisting of 9 digits XYYYYYYYY, where: .TP X select source and logical term .br .I 0 PIO OR .br .I 1 latch OR .br .I 2 PIO AND .br .I 3 latch AND .TP Y select channel and polarity .br .I 0 Unselected (LOW) .br .I 1 Unselected (HIGH) .br .I 2 Selected LOW .br .I 3 Selected HIGH .PP All digits will be truncated to the 0-3 range. Leading zeroes are optional. Low-order digit is channel 0. .PP Example: .TP 100000033 Responds on Conditional Search when latch.1 or latch.0 are set to 1. .TP 222000000 Responds on Conditional Search when sensed.7 and sensed.6 are set to 0. .TP 000000000 (0) Never responds to Conditional Search. .SH LCD_H LCD SCREEN PROPERITES This mode uses the .I DS2408 attached to a Hitachi HD44780 LCD controller in 4-bit mode. See .I DATASHEET for published details. Based on a commercial product from .I HobbyBoards by Erik Vickery. .SS LCD_H/clear .I write-only, yes-no .br This will .I clear the screen and place the cursor at the start. .SS LCD_H/home .I write-only, yes-no .br Positions the cursor in the .I home (upper left) position, but leaves the current text intact. .SS LCD_H/screen .I write-only, ascii text .br Writes to the LCD .I screen at the current position. .SS LCD_H/screenyc .I write-only, ascii text .br Writes to an LCD screen at a specified location. The controller doesn't know the true LCD dimensions, but typical selections are: 2x16 2x20 4x16 and 4x20. .TP Y (row) range 1 to 2 (or 4) .TP X (column) range 1 to 16 (or 20) .P There are two formats allowed for the .I screenyx text, either ascii (readable text) or a binary form. .TP 2 binary bytes The two first characters of the passed string have the line and row: e.g. "\\x02\\x04string" perl string writes "string" at line 2 column 4. .TP ascii 2,12: Two numbers giving line and row: Separate with a comma and end with a colon e.g. "2,4:string" writes "string" at line 2 column 4. .TP ascii 12: Single column number on the (default) first line: End with a colon e.g. "12:string" writes "string" at line 1 column 12. .P The positions are 1-based (i.e. the first position is 1,1). .SS LCD_H/onoff .I write-only, unsigned .br Sets several screen display functions. The selected choices should be added together. .TP 4 Display on .TP 2 Cursor on .TP 1 Cursor blinking .SS LCD_H/message .I write-only, ascii text .br Writes a .I message to the LCD screen after clearing the screen first. This is the easiest way to display a message. .SH LCD_M LCD SCREEN PROPERITES This mode uses the .I DS2408 attached to a Hitachi HD44780 LCD controller in 8-bit mode. See .I DATASHEET for published details. Based on a design from Maxim and a commercial product from .I AAG. .SS LCD_M/clear .I write-only, yes-no .br This will .I clear the screen and place the cursor at the start. .SS LCD_M/home .I write-only, yes-no .br Positions the cursor in the .I home (upper left) position, but leaves the current text intact. .SS LCD_M/screen .I write-only, ascii text .br Writes to the LCD .I screen at the current position. .SS LCD_M/screenyc .I write-only, ascii text .br Writes to an LCD screen at a specified location. The controller doesn't know the true LCD dimensions, but typical selections are: 2x16 2x20 4x16 and 4x20. .TP Y (row) range 1 to 2 (or 4) .TP X (column) range 1 to 16 (or 20) .P There are two formats allowed for the .I screenyx text, either ascii (readable text) or a binary form. .TP 2 binary bytes The two first characters of the passed string have the line and row: e.g. "\\x02\\x04string" perl string writes "string" at line 2 column 4. .TP ascii 2,12: Two numbers giving line and row: Separate with a comma and end with a colon e.g. "2,4:string" writes "string" at line 2 column 4. .TP ascii 12: Single column number on the (default) first line: End with a colon e.g. "12:string" writes "string" at line 1 column 12. .P The positions are 1-based (i.e. the first position is 1,1). .SS LCD_M/onoff .I write-only, unsigned .br Sets several screen display functions. The selected choices should be added together. .TP 4 Display on .TP 2 Cursor on .TP 1 Cursor blinking .SS LCD_M/message .I write-only, ascii text .br Writes a .I message to the LCD screen after clearing the screen first. This is the easiest way to display a message. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS Use the .I set_alarm property to set the alarm triggering criteria. .SH DESCRIPTION .so description.3so .SS DS2408 The .B DS2408 (3) allows control of other devices, like LEDs and relays. It extends the .B DS2406 to 8 channels and includes memory. .br Alternative switches include the .B DS2406, DS2407 and even .B DS2450 .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2408.pdf .br http://www.hobby-boards.com/catalog/howto_lcd_driver.php .br http://www.maxim-ic.com/appnotes.cfm/appnote_number/3286 .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1821.30000664000175000017500000000701611535561503012072 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1821.3,v 1.11 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1821 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1821 \- Programmable Digital Thermostat and Thermometer .SH SYNOPSIS Thermostat. .PP .B thermostat [/[ .B temperature | .B temphigh | .B templow | .B temphighflag | .B templowflag | .B thermostatmode | .B polarity | .B 1shot ]] .SH FAMILY CODE .PP .I none .SH SPECIAL PROPERTIES .SS temperature .I read-only, floating point .br 9-bit resolution temperature. Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. Conversion takes 1 second. .SS temphigh templow .I read-write. floating point .br Temperature limits for alarms. Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Note that alarms are not implemented. .SS temphighflag, templowflag .I read-write. yes-no .br .B temphighflag goes to 1 when .B temperature exceeds .B temphigh and stays at 1 until it is reset by writing it to zero. This state persists across power cycles and operates in both 1-wire and thermostat modes. .B templowflag behaves in the same way, monitoring the temperature with respect to .B templow. .SS thermostatmode .I read-write. yes-no .br When this bit is set to 1 the chip will enter thermostat mode on the next power-up. See the datasheet for further information on thermostat mode. .B NOTE: Once the DS1821 has entered thermostat mode it cannot be taken out back to 1-wire mode using a 1-wire interface. Special electrical incantations on the power and data lines must be performed that are not possible with a normal 1-wire bus master. A special circuit is required - see the datasheet for complete details. .SS polarity .I read-write. yes-no .br Controls the output sense of the thermostat output (DQ) while in thermostat mode. If .B polarity is 0 the output is active low. If it is 1, active high. .SS 1shot .I read-write. yes-no .br If this bit is 1, a START CONVERT command will begin a conversion and the chip will enter a low power state when the conversion is complete. If the bit is 0 then START CONVERT will begin a conversion and start another one as soon as it is done. STOP CONVERSION must be performed to get the conversion cycle to stop. This interface automatically issues a STOP CONVERSION command when going out of continuous mode. .so temperature_threshold.3so .SH STANDARD PROPERTIES .SS type .I read-only, ascii .br Chip type: DS1821 .SH DESCRIPTION .so description.3so .SS DS1821 The .B DS1821 (3) is a unique 1-wire device. It is unaddressable, and therefore there can be only one on a given bus. It is meant to be programmed once using 1-wire and then permanently installed in a thermostat circuit. Once in thermostat mode, it is no longer programmable from a 1-wire interface. It is possible to recover it into 1-wire mode but only with a special circuit. .SH ADDRESSING Unlike all other 1-wire chips, the ,B DS1821 (3) has no unique address. It is addressed as .B thermostat and will not announce itself in device discovery (directory listing). .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1821.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2413.30000664000175000017500000000451011535561503012064 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2413.3,v 1.14 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2413 3 2005 "OWFS Manpage" "One-Wire File System" .SH NAME DS2413 \- Dual Channel Addressable Switch .SH SYNOPSIS Dual Switch .PP .B 3A [.]XXXXXXXXXXXX[XX][/[ .B PIO.[A|B|ALL|BYTE] | .B sensed.[A|B|ALL|BYTE] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 3A .SH SPECIAL PROPERTIES .SS PIO.A PIO.B PIO.ALL PIO.BYTE .I read-write, yes-no .br State of the open-drain output ( .I PIO ) pin. 0 = non-conducting (off), 1 = conducting (on). .br Writing zero will turn off the switch, non-zero will turn on the switch. Reading the .I PIO state will return the switch setting. To determine the actual logic level at the switch, refer to the .I sensed property. .br .I ALL references both channels simultaneously, comma separated. .br .I BYTE references both channels simultaneously as a single byte, with channel A in bit 0. .SS sensed.A sensed.B sensed.ALL sensed.BYTE .I read-only, yes-no .br Logic level at the .I PIO pin. 0 = ground. 1 = high (~2.4V - 5V ). Really makes sense only if the .I PIO state is set to zero (off), else will read zero. .br .I ALL references both channels simultaneously, comma separated. .br .I BYTE references both channels simultaneously as a single byte, with channel A in bit 0. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS Use the .I set_alarm property to set the alarm triggering criteria. .SH DESCRIPTION .so description.3so .SS DS2413 The .B DS2413 (3) allows control of other devices, like LEDs and relays. It differs from the .I DS2405 with a cleaner interface and two channels The .I DS2413 also has two channels like the .I DS2406 and .I DS2407 but has no memory, and no alarm. There is also varying types of switch and sensing in the .I DS2408, DS2409, LCD, DS276x, DS2450. .br Unique among the switches, the .I DS2413 can switch higher voltages, up to 28V. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://datasheets.maxim-ic.com/en/ds/DS2413.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1982.30000664000175000017500000000001510244633637012076 00000000000000.so DS2502.3 owfs-2.8p15/src/man/DS2431.30000664000175000017500000000275611535561503012076 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2431.3,v 1.9 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2431 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2431 \- EEPROM (1 kBit) .SH SYNOPSIS Erasable programmable read-only memory (EEPROM) .PP .B 2D [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-3|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 2D DS2431 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 128 bytes of EEPROM memory. Initially all bits are set to 1. Memory is non-volatile. .SS pages/page.0 ... pages/page.3 pages/page.ALL .I read-write, yes-no .br Memory is split into 4 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2431 The .B DS2431 (3) is used for storing memory which should be available even after a reset or power off. It is also switch to erase-only mode (EPROM) although this isn't implemented in OWFS. .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2431.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Christian Magnusson (mag@mag.cx) owfs-2.8p15/src/man/DS2755.30000664000175000017500000001364411607632732012110 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2755.3,v 1.14 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2755 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2755, DS2756 \- Multichemistry Battery Fuel Gauge .SH SYNOPSIS .SS Temperature Voltage, Current, Memory, and Switch. .PP .B 35 [.]XXXXXXXXXXXX[XX][/[ .B alarm_set/[volthigh|voltlow|temphigh|templow] | .B lock.[0-2|ALL] | .B memory | .B pages/page.[0-2|ALL] | .B PIO | .B sensed | .B temperature | .B vbias | .B vis | .B volt | .B volthours | .br .B defaultpmod | .B pie0 | .B pie1 | .B rnaop | .B ios | .B uben | .B ovd | .B pmod | .B por | .B uven | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 35 [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature .SH FAMILY CODE .PP .I 35 .SH SPECIAL PROPERTIES .SS alarm_set/templow alarm_set/temphigh .I read-write, integer .br High and low alarm settings for .I temperature .SS alarm_set/voltlow alarm_set/volthigh .I read-write, floating point .br High and low alarm settings for .I volts .SS lock.[0-2|ALL] .I read-write, yes-no .br Lock any of the three eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-2|ALL] .I read-write, binary Three 32 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2670 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .I DS2755 to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH OBSCURE PROPERTIES .SS pmod por uven pie0 pie1 ios uben ovd rnaop .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SS defaultpmod .I read-write, yes-no .br Default power-on state for the corresponding properties. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS Temperature and voltage. .SH DESCRIPTION .so description.3so .SS DS2755 DS2756 The .B DS2755 (3) and .B DS2756 (3) are battery charging controllers similar to the .B DS2751 (3) except no internal resistor option and a larger EEPROM memory. .PP The .B DS2756 (3) adds suspend modes ( .I pie0 pie1 ) to the .B DS2755 (3) .PP A number of interesting devices can be built with the .B DS2755 (3) and .B DS2756 (3) including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2755.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2756.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1427.30000664000175000017500000000001510361353662012065 00000000000000.so DS2404.3 owfs-2.8p15/src/man/ownetapi.10000664000175000017500000000002111542520452013055 00000000000000.so man1/ownet.1 owfs-2.8p15/src/man/owget.10000664000175000017500000000001511070534675012367 00000000000000.so owshell.1owfs-2.8p15/src/man/owperl.30000664000175000017500000000372711542520452012561 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owperl.3,v 1.9 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWPERL 3 2004 "OWFS Manpage" "One-Wire File System" .SH NAME .B owperl \- perl interface for the 1-wire filesystem .SH SYNOPSIS .B OW.pm .br .B use OW ; .br .B OW::init( .I interface .B ); .br .B OW::init( .I initialization string .B ); .PP The full set of initialization options is extensive. They correspond roughly to the command line options of ,B owfs (1) .B owhttpd (1) and .B owftpd (1) .br .B OW::get( .I path .B ); .br .B OW::put( .I path .B , .I value .B ); .br .B OW::finish(); .SH "DESCRIPTION" .so description.3so .SS owperl .B owperl (3) is a perl module that provides an interface to OWFS. The path to each 1-wire device is the same as .B owfs (1) \&. Only the top layer has been modified to return native perl strings. .PP .B owperl (3) is created by .B swig (1) (http://www.swig.org) which can be easily modified to support other programming languages. .SH FUNCTIONS .SS OW::init( interface ) .I interface .br Location of the 1-wire bus: .TP "u" Direct connection to the 1-wire interface on the USB port -- .I DS9490 .TP /dev/ttySx Direct connection to a 1-wire interface on the serial port -- .I DS9097U or .I DS9097 .TP port | :port | IPaddress:port Location of an .I owserver daemon that connects to the 1-wire bus. Multiple .I owperl as well as .I owfs and .I owhttpd programs can access the .I owserver process simultaneously. In fact, this will probably be the preferred mode of access to OWFS for .I owperl except in trivial applications. .SH EXAMPLE perl \-MOW \-e "OW::init('/dev/ttyS1'); printf OW::get('\');" .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2770.30000664000175000017500000001472111607632732012102 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2770.3,v 1.11 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2770 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2770 \- Battery Monitor and Charge Controller .SH SYNOPSIS .SS Temperature Voltage Current Memory and Switch. .PP .B 2E [.]XXXXXXXXXXXX[XX][/[ .B amphours | .B current | .B currentbias | .B lock.[0-2|ALL] | .B memory | .B pages/page.[0-2|ALL] | .B PIO | .B sensed | .B temperature | .B vbias | .B vis | .B volt | .B volthours | .br .B charge | .B cini | .B cstat0 | .B cstat1 | .B ctype | .B defaultpmod | .B pmod | .B refresh | .B timer | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 2E [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature .SH FAMILY CODE .PP .I 2E .SH SPECIAL PROPERTIES .SS amphours .I read-write, floating point .br Accumulated amperage read by current sensor. Units are in .B Amp-hr (Assumes internal 25mOhm resistor). Derived from .I volthours / Rinternal. .br Formally .I amphours is the integral of .I current - currentbias over time. .SS current .I read-only, floating point .br Current reading. Units are in .B Amp (Assumes internal 25 mOhm resistor). Derived from .I vis / Rinternal. .SS currentbias .I read-write, floating point .br Fixed offset applied to each .I current measurement. Used in the .I amphours value. Assumes internal 25mOhm resistor. Units are .B Amp and range from -.08A to .08A. .br Derived from .I vbias / Rinternal. .SS lock.[0-2|ALL] .I read-write, yes-no .br Lock either of the three eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-2|ALL] .I read-write, binary Two 16 byte and one 8 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2670 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .B DS2770 (3) to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH OBSCURE PROPERTIES .SS charge .I write-only, yes-no .br Trigger the start (1) or stop(0) of charging. see the .I DATASHEET for details. .SS cini cstat0 cstat1 ctype pmod .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SS defaultpmod .I read-write, yes-no .br Default power-on state for the corresponding properties. .SS refresh .I write-only, yes-no .br Writing anything to this file causes a refresh of parameters. See the .SS timer .I read-write, floating point .br A charge timer in units of .B hours. See the .I DATASHEET for details. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2770 The .B DS2770 (3) is a battery charging controller. It has elaborate charge estimation algorithms built in. .PP A number of interesting devices can be built with the .B DS2770 including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2770.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2405.30000664000175000017500000000333311535561503012067 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2405.3,v 1.15 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2405 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2405 \- Addressable Switch .SH SYNOPSIS 1-wire network branch controller. .PP .B 05 [.]XXXXXXXXXXXX[XX][/[ .B PIO | .B sensed | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 05 .SH SPECIAL PROPERTIES .SS PIO .I read-write, yes-no .br State of the open-drain output ( .I PIO ) pin. 0 = non-conducting (off), 1 = conducting (on). .br Writing zero will turn off the switch, non-zero will turn on the switch. Reading the .I PIO state will return the switch setting. To determine the actual logic level at the switch, refer to the .I sensed property. .SS sensed .I read-only, yes-no .br Logic level at the .I PIO pin. 0 = ground. 1 = high (~2.4V - 5V ). Really makes sense only if the .I PIO state is set to zero (off), else will read zero. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None implemented. .SH DESCRIPTION .so description.3so .SS DS2405 The .B DS2405 (3) allows control of other devices, like LEDs and relays. It is an early design and has been superceeded by the .B DS2406 and .B DS2408 or even .B DS2450 that have more PIO pins, and do not employ an arcane use the the alarm state to signal PIO status. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2405.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1971.30000664000175000017500000000002311542520452012063 00000000000000.so man3/DS2430A.3 owfs-2.8p15/src/man/Makefile.am0000664000175000017500000000441411572153434013220 00000000000000## $Id: Makefile.am,v 1.66 2011/06/03 12:44:12 oskin Exp $ mandir = @mandir@ man_MANS = owfs.1 \ owhttpd.1 \ owserver.1 \ owftpd.1 \ owcapi.1 libowcapi.1 \ ownet.1 ownetapi.1 libownet.1 ownetlib.1 \ owshell.1 owdir.1 owread.1 owwrite.1 owget.1 owpresent.1 \ owtap.1 owmon.1 \ DS1427.3 \ DS1821.3 DS1822.3 DS1825.3 DS18B20.3 DS18S20.3 DS28EA00.3 \ DS1904.3 DS1920.3 DS1921.3 DS1963L.3 DS1963S.3 DS1971.3 DS1977.3 \ DS1982.3 DS1982U.3 DS1985.3 DS1985U.3 DS1986.3 DS1986U.3 \ DS1990A.3 DS1991.3 DS1992.3 DS1993.3 DS1994.3 DS1995.3 DS1996.3 \ DS2401.3 DS2404.3 DS2404S.3 DS2405.3 DS2406.3 DS2407.3 DS2408.3 DS2409.3 \ DS2411.3 DS2413.3 DS2415.3 DS2417.3 \ DS2423.3 \ DS2430A.3 DS2431.3 DS2433.3 DS2436.3 DS2437.3 DS2438.3 \ DS2450.3 \ DS2502.3 DS2502-E48.3 DS2502-UNW.3 DS2505.3 DS2505-UNW.3 DS2506.3 DS2506-UNW.3 \ DS2720.3 DS2740.3 DS2751.3 DS2755.3 DS2756.3 DS2760.3 DS2761.3 DS2762.3 DS2770.3 \ DS2780.3 DS2781.3 DS2788.3 \ DS2804.3 DS28E04.3 DS28EA00.3 DS28EC20.3 \ DS2890.3 \ EEEF.3 UVI.3 \ EDS.3 EDS0064.3 EDS0065.3 EDS0066.3 EDS0067.3 EDS0068.3 EDS0071.3 EDS0072.3 \ Thermachron.3 \ LCD.3 \ OWNet.3 \ owperl.3 \ owtcl.n \ owfs.5 owfs.conf.5 \ ow.n EXTRA_DIST = ${man_MANS} *.?so install-data-am: install-man install-so-man install-so-man: for i in $(man_MANS); do \ case $$i in \ *.1*) mandirr=$(man1dir) ;; \ *.3*) mandirr=$(man3dir) ;; \ *.5*) mandirr=$(man5dir) ;; \ *.n*) mandirr=$(manndir) ;; \ esac; \ i=$$mandirr/$$i; \ list="$$list $$i"; \ done; \ for manfile in $$list; do \ for i in `sed -n '2,$$ s/^.so //p' $(DESTDIR)/$$manfile | tac`; do \ printf "%s\n" H /$$i/d - ".r $(srcdir)/$$i" g/^.\\\\\"/d ",w" | ed -s $(DESTDIR)/$$manfile ; \ done; \ done; \ for manfile in $$list; do \ for i in `sed -n '2,$$ s/^.so //p' $(DESTDIR)/$$manfile | tac`; do \ printf "%s\n" H /$$i/d - ".r $(srcdir)/$$i" g/^.\\\"/d ",w" | ed -s $(DESTDIR)/$$manfile ; \ done; \ done clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/man/timeout.1so0000664000175000017500000000334011152552464013273 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: timeout.1so,v 1.1 2009/03/01 18:34:28 alfille Exp $ '\" .SH TIME OPTIONS Timeouts for the bus masters were previously listed in .I Device options. Timeouts for the cache affect the time that data stays in memory. Default values are shown. .SS --timeout_volatile=15 Seconds until a .I volatile property expires in the cache. Volatile properties are those (like temperature) that change on their own. .PP Can be changed dynamically at .I /settings/timeout/volatile .SS --timeout_stable=300 Seconds until a .I stable property expires in the cache. Stable properties are those that shouldn't change unless explicitly changed. Memory contents for example. .PP Can be changed dynamically at .I /settings/timeout/stable .SS --timeout_directory=60 Seconds until a .I directory listing expires in the cache. Directory lists are the 1-wire devices found on the bus. .PP Can be changed dynamically at .I /settings/timeout/directory .SS --timeout_presence=120 Seconds until the .I presence and bus location of a 1-wire device expires in the cache. .PP Can be changed dynamically at .I /settings/timeout/presence .P .B There are also timeouts for specific program responses: .SS --timeout_server=5 Seconds until the expected response from the .B owserver (1) is deemed tardy. .PP Can be changed dynamically at .I /settings/timeout/server .SS --timeout_ftp=900 Seconds that an ftp session is kept alive. .PP Can be changed dynamically at .I /settings/timeout/ftp owfs-2.8p15/src/man/DS1995.30000664000175000017500000000302411535561503012101 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1995.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1995 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1995 \- 16kbit Memory iButton .SH SYNOPSIS Non-volatile memory. .PP .B 0A [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-63|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 0A DS1996 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 2048 bytes of memory. .SS pages/page.0 ... pages/page.63 pages/page.ALL .I read-write, binary .br Memory is split into 64 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1995 The .B DS1995 (3) is an iButton with static memory. Data is read/written with error checking (transparent to the user). The .B DS1992 , .B DS1993 , .B DS1995 , and .B DS1996 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically.) .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1995.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owshell.10000644000175000017500000001407511716525033012723 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: owshell.1,v 1.14 2012/02/14 18:38:19 alfille Exp $ '\" .TH OWSHELL 1 2004 "OWSHELL Manpage" "One-Wire File System" .SH NAME owdir, owread, owwrite, owget, owpresent \- lightweight owserver access .SH SYNOPSIS .SS Minimal options .B owdir .I -s [host:]port [directory] .br .B owread .I -s [host:]port filepath .br .B owwrite .I -s [host:]port filepath value .br .B owget .I -s [host:]port [directory] | filepath .br .SS Server discovery .B owdir .I --autoserver [directory] .br .B owread .I --autoserver filepath .br .B owwrite .I --autoserver filepath value .br .B owget .I --autoserver [directory] | filepath .br .SS Full options .B owdir .I -q --quiet .I -f --format f[.]i[[.]c] ] [ .I --dir ] .I -s [host:]port [directory] [directory2 ...] .PP .B owread .I -q --quiet .I -C --celsius .I -K --kelvin .I -F --fahrenheit .I -R --rankine [ .I --hex ] [ .I --start= offset ] [ .I --size= bytes ] .I -s [host:]port filepath [filepath2 ...] .PP .B owwrite .I -q --quiet .I -C --celsius .I -K --kelvin .I -F --fahrenheit .I -R --rankine [ .I --hex ] [ .I --start= offset ] .I -s [host:]port filepath value [filepath2 value2 ...] .PP .B owget .I -q --quiet .I -f --format f[.]i[[.]c] .I -C --celsius .I -K --kelvin .I -F --fahrenheit .I -R --rankine [ .I --hex ] [ .I --start= offset ] [ .I --size= bytes ] [ .I --dir ] .I -s [host:]port [directory] | filepath .br .SS Version .B owdir .I \-V \-\-version .br .B owread .I \-V \-\-version .br .B owwrite .I \-V \-\-version .br .B owget .I \-V \-\-version .br .SS Help .B owdir .I \-h | \-\-help .br .B owread .I \-h | \-\-help .br .B owwrite .I \-h | \-\-help .br .B owget .I \-h | \-\-help .br .SH "DESCRIPTION" .so description.1so .SS OWSHELL programs .B owdir owread owwrite and .B owget are collectively called the .B owshell programs. They allow lightweight access to an .B owserver (1) for use in command line scripts. .PP Unlike .B owserver (1) owhttpd (1) owftpd (1) owhttpd (1) there is not persistent connection with the 1-wire bus, no caching and no multithreading. Instead, each program connects to a running .B owserver (1) and performs a quick set of queries. .PP .B owserver (1) performs the actual 1-wire connection (to physical 1-wire busses or other .B owserver programs), performs concurrency locking, caching, and error collection. .PP .B owshell programs are intended for use in command line scripts. An alternative approach is to mount an .B owfs (1) filesystem and perform direct file lists, reads and writes. .SS owdir .B owdir performs a .I directory listing. With no argument, all the devices on the main 1-wire bus will be listed. Given the name of a 1-wire device, the available properties will be listed. It is the equivalent of .IP .I ls directory .P in the .B owfs (1) filesystem. .SS owread .B owread obtains for value of a 1-wire device property. e.g. 28.0080BE21AA00/temperature gives the DS18B20 temperature. It is the equivalent of .IP .I cat filepath .P in the .B owfs (1) filesystem. .SS owwrite .B owwrite performs a change of a property, changing a 1-wire device setting or writing to memory. It is the equivalent of .IP .I echo "value" > filepath .P in the .B owfs (1) filesystem. .SS owget .B owget (1) is a convenience program, combining the function of .B owdir (1) and .B owread (1) by first trying to read the argument as a directory, and if that fails as a 1-wire property. .SH STANDARD OPTIONS .SS \-\-autoserver Find an .I owserver using the Service Discovery protocol. Essentially Apple's Bonjour (aka zeroconf). Only the first .I owserver will be used, and that choice is probably arbitrary. .SS \-s [host:]port Connect via tcp (network) to an .I owserver process that is connected to a physical 1-wire bus. This allows multiple processes to share the same bus. The .I owserver process can be local or remote. .PP If the server option is not specified, the default is the local machine and the IANA allocated default port of 4304. Thus "-s localhost:4304" is the equivalent. .SH DATA OPTIONS .SH \-\-hex Hexidecimal mode. For reading data, each byte of character will be displayed as two characrters 0-9ABCDEF. Most useful for reading memory locations. No spaces between data. .P Writing data in hexidecimal mode just means that the data should be given as one long hexidecimal string. .SH \-\-start=offset Read or write memory locations starting at the offset byte rather than the beginning. An offset of 0 means the beginning (and is the default). .P .SH \-\-size=bytes Read up to the specified number of bytes of a memory location. .SH HELP OPTIONS .SS \-h \-\-help Shows (this) basic summary of options. .SS \-V \-\-version .I Version of this program. .SH DISPLAY OPTIONS .SS \-\-dir Modify the display of directories to indicate which entries are also directories. A directory member will have a trailing '/' if it is a directory itself. This aids recursive searches. .SS \-f \-\-format "f[.]i[[.]c]" Display format for the 1-wire devices. Each device has a 8 byte address, consisting of: .TP .I f family code, 1 byte .TP .I i ID number, 6 bytes .TP .I c CRC checksum, 1 byte .PP Possible formats are .I f.i (default, 01.A1B2C3D4E5F6), .I fi fic f.ic f.i.c and .I fi.c .PP All formats are accepted as input, but the output will be in the specified format. .SH EXAMPLE .TP owdir \-s 3000 \-\-format fic Get the device listing (full 16 hex digits, no dots) from the local .I owserver at port 3000 .TP owread \-F \-\-autoserver 51.125499A32000/typeK/temperature Read temperature from the DS2751-based thermocouple on an auto-discovered .I owserver Temperature in fahrenheit. .TP owwrite \-s 10.0.1.2:3001 32.000800AD23110/pages/page.1 "Passed" Connect to a OWFS server process ( .I owserver ) that was started on another machine at tcp port 3001 and write to the memory of a DS2780 .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS2760.30000664000175000017500000002206211607632732012076 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2760.3,v 1.23 2011/07/14 18:30:50 alfille Exp $ '\" .TH DS2760 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2760, DS2761, DS2762 \- High-Precision Li+ Battery Monitor .SH SYNOPSIS .SS Temperature Voltage and Current. .PP .B 30 [.]XXXXXXXXXXXX[XX][/[ .B amphours | .B current | .B currentbias | .B lock.[0-1|ALL] | .B memory | .B pages/page.[0-1|ALL] | .B PIO | .B sensed | .B temperature | .B vbias | .B vis | .B volt | .B volthours | .br .B cc | .B ce | .B coc | .B defaultpmod | .B defaultswen | .B dc | .B de | .B doc | . B mstr | .B ov | .B ps | .B pmod | .B swen | .B uv | .br .so standard_mini.3so ]] .SS Thermocouple .PP .B 30 [.]XXXXXXXXXXXX[XX][/[ .B temperature | .B typeX/range_low | .B typeX/range_high | .B typeX/temperature ]] .SS Weather Station .PP .B 30 [.]XXXXXXXXXXXX[XX][/[ .B WS603/temperature | .B WS603/wind_speed | .B WS603/direction | .B WS603/volt | .br .B WS603/LED/status | .B WS603/LED/control.ALL | .B WS603/LED/model | .br .B WS603/calibrationwind_speed | .B WS603/calibration/direction | .br .B WS603/light/intensity | .B WS603/light/threshold .SH FAMILY CODE .PP .I 30 .SH SPECIAL PROPERTIES .SS amphours .I read-write, floating point .br Accumulated amperage read by current sensor. Units are in .B Amp-hr (Assumes internal 25mOhm resistor). Derived from .I volthours / Rinternal. .br Formally .I amphours is the integral of .I current - currentbias over time. .SS current .I read-only, floating point .br Current reading. Units are in .B Amp (Assumes internal 25 mOhm resistor). Derived from .I vis / Rinternal. .SS currentbias .I read-write, floating point .br Fixed offset applied to each .I current measurement. Used in the .I amphours value. Assumes internal 25mOhm resistor. Units are .B Amp and range from -.08A to .08A. .br Derived from .I vbias / Rinternal. .SS lock.[0-1|ALL] .I read-write, yes-no .br Lock either of the two eprom pages to prevent further writes. Apparently setting .I lock is permanent. .SS memory .I read-write, binary .br Access to the full 256 byte memory range. Much of this space is reserved or special use. User space is the .I page area. .br See the .I DATASHEET for a full memory map. .SS pages/pages.[0-1|ALL] .I read-write, binary Two 16 byte areas of memory for user application. The .I lock property can prevent further alteration. .br NOTE that the .I page property is different from the common .I OWFS implementation in that all of .I memory is not accessible. .SS PIO .I write-only, yes-no .br Controls the PIO pin allowing external switching. .br Writing "1" turns the PIO pin on (conducting). Writing "0" makes the pin non-conducting. The logical state of the voltage can be read with the .I sensed property. This will reflect the current voltage at the pin, not the value sent to .I PIO .br Note also that .I PIO will also be altered by the power-status of the .I DS2670 See the datasheet for details. .SS sensed .I read-only, yes-no .br The logical voltage at the PIO pin. Useful only if the .I PIO property is set to "0" (non-conducting). .br Value will be 0 or 1 depending on the voltage threshold. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. .br Conversion is continuous. .SS vbias .I read-write, floating point .br Fixed offset applied to each .I vis measurement. Used for the .I volthours value. Units are in .B Volts. .br Range \-2.0mV to 2.0mV .SS vis .I read-only, floating point .br Current sensor reading (unknown external resistor). Measures the voltage gradient between the Vis pins. Units are in .B Volts .br The .I vis readings are integrated over time to provide the .I volthours property. .br The .I current reading is derived from .I vis assuming the internal 25 mOhm resistor is employed. There is no way to know this through software. .SS volt .I read-only, floating point .br Voltage read at the voltage sensor;. This is separate from the .I vis voltage that is used for .I current measurement. Units are .B Volts .br Range is between 0 and 4.75V .SS volthours .I read-write, floating point .br Integral of .I vis - vbias over time. Units are in .B volthours .SH THERMOCOUPLE .SS typeX/ .I directory .br Thermocouple circuit using the .I DS2760 to read the Seebeck voltage and the reference temperature. Since the type interpretation of the values read depends on the type of thermocouple, the correct directory must be chosen. Supported thermocouple types include types B, E, J, K, N, R, S and T. .SS typeX/range_low typeX/ranges_high .I read-only, flaoting point .br The lower and upper temperature supported by this thermocouple (at least by the conversion routines). In the globally chosen temperature units. .SS typeX/temperature .I read-only, floating point .br Thermocouple temperature. Requires a voltage and temperature conversion. Returned in globally chosen temperature units. .br Note: there are two types of temperature measurements possible. The .I temperature value in the main device directory is the reference temperature read at the chip. The .I typeX/temperature value is at the thermocouple junction, probably remote from the chip. .SH WEATHER STATION .SS WS603 .I directory .br Weather station from .I AAG electronica that includes temperature, wind speed, wind direction, light sensor and LED lights. .SS WS603/temperature .I read-only, floating-point .br Uses the .I DS2760 temperature sensor. This is equivalent to the .I temperature value. Again in the specificed temperature scale, default Celsius. .SS WS603/wind_speed .I read_only, floating-point .br Readings from the anometer, scaled using the .I WS603/calibration/wind_speed .SS WS603/direction .I read_only, unsigned integer .br Wind direction, using the following table .TP 1 N .TP 2 NNE .TP 3 NE .TP 4 NEE .TP 5 E .TP 6 EES .TP 7 ES .TP 8 ESS .TP 9 S .TP 10 SSW .TP 11 SW .TP 12 SWW .TP 13 W .TP 14 WWN .TP 15 WN .TP 16 WWN .PP Values are adjusted (internally) by the .I WS603/calibration/direction property .SS WS603/volt .I read-only, unsigned integer .br Voltage value from the .I WS603 device. Units and significance is unclear. .SS WS603/calibration/wind_speed .I read-write, unsigned integer .br Value between 1 and 200 for wind speed scaling. Values on of this range are ignored and the default value of 100 used. .SS WS603/calibration/direction .I read-write, unsigned integer .br Adjustment of wind direction. See datasheet. .SS WS603/light/intensity .I read-only, unsigned integer .br Uncalibrated value from an internal light sensor. Used for control of LED display (daytime vs nighttime). .SS WS603/light/threshold .I read-only, unsigned integer .br Threshold for internal light sensor. Used for control of LED display (daytime vs nighttime). .PP Value is set as value 4 of the array passed to .I WS603/LED/control .SS WS603/LED/status .I read-only, unsigned integer .br Status of LED lights intensities. See datasheet. .PP Value is set as values 2 and 3 of the array passed to .I WS603/LED/control .SS WS603/LED/model .I read-only, unsigned integer .br What factors control LED display. See datasheet. .PP Value is set as value 1 of the array passed to .I WS603/LED/control.ALL .SS WS603/LED/model .I write-only, unsigned integer array of 4 values .br Four integers sent to control LED display. All four values must be sent, comma separated. .TP 0 Light mode .TP 1 Light status .TP 2 Light level .TP 3 Light threshold .SH OBSCURE PROPERTIES .SS cc ce coc dc de doc mstr ov pmod swen uv .I varies, yes-no .br Bit flags corresponding to various battery management functions of the chip. See the .I DATASHEET for details of the identically named entries. .br In general, writing "0" corresponds to a 0 bit value, and non-zero corresponds to a 1 bit value. .SS defaultpmod defaultswen .I read-write, yes-no .br Default power-on state for the corresponding properties. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2760 DS2761 DS2762 The .B DS2760 (3) is a class of battery charging controllers. There are minor hardware difference between the .B DS2760, DS2761 and .B DS2762 battery chip, but they are indistiguishable to the software. .PP A number of interesting devices can be built with the .B DS276x including thermocouples. Support for thermocouples in built into the software, using the embedded thermister as the cold junction temperature. .PP For an explanation of the differences between the .B DS276x variants, see Dallas Application Note 221. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2760.pdf .br http://pdfserv.maxim-ic.com/en/an/app221.pdf .br http://www.aag.com.mx/aagusa/contents/en-us/Description%20of%20WSV3%20Interface%20(1-wire).pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/description.1so0000664000175000017500000000402611152544732014131 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: description.1so,v 1.1 2009/03/01 17:46:02 alfille Exp $ '\" .SS 1-Wire .I 1-wire is a wiring protocol and series of devices designed and manufactured by Dallas Semiconductor, Inc. The bus is a low-power low-speed low-connector scheme where the data line can also provide power. .PP Each device is uniquely and unalterably numbered during manufacture. There are a wide variety of devices, including memory, sensors (humidity, temperature, voltage, contact, current), switches, timers and data loggers. More complex devices (like thermocouple sensors) can be built with these basic devices. There are also 1-wire devices that have encryption included. .PP The 1-wire scheme uses a single .I bus master and multiple .I slaves on the same wire. The bus master initiates all communication. The slaves can be individually discovered and addressed using their unique ID. .PP Bus masters come in a variety of configurations including serial, parallel, i2c, network or USB adapters. .SS OWFS design .I OWFS is a suite of programs that designed to make the 1-wire bus and its devices easily accessible. The underlying priciple is to create a virtual filesystem, with the unique ID being the directory, and the individual properties of the device are represented as simple files that can be read and written. .PP Details of the individual slave or master design are hidden behind a consistent interface. The goal is to provide an easy set of tools for a software designer to create monitoring or control applications. There are some performance enhancements in the implementation, including data caching, parallel access to bus masters, and aggregation of device communication. Still the fundemental goal has been ease of use, flexibility and correctness rather than speed. owfs-2.8p15/src/man/DS2505.30000664000175000017500000000431211535561503012066 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2505.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS2505 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2505 \- Add-Only Memory (16 kBit) .br DS2505-UNW \- UniqueWare Add-Only Memory (16 kBit) .br DS1985 \- Add-Only iButton (16 kBit) .br DS1985U \- UniqueWare iButton (16 kBit) .SH SYNOPSIS EPROM add-only memory. .PP .B 0B [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-63|ALL] | .so standard_mini.3so ]] .PP .B 8B [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-63|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 0B DS2505 DS1985 .TP .I 8B DS2505-UNW DS1985U .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 2048 bytes of memory. Initially all bits are set to 1. Writing zero permanently alters the memory. .SS pages/page.0 ... pages/page.63 pages/page.ALL .I read-write, yes-no .br Memory is split into 64 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2505 DS1985 The .B DS2505 (3) is used for write-once incremental storage. It's main advantage is for audit trails (i.e. a digital purse). .PP The .B DS2505-UNW is one of the .I UniqueWare class of devices. Some of the memory was preprogramed at the factory. See the datasheet for specifics. The .B DS2502 , .B DS2505 , and .B DS2506 differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2505.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS2502-UNW-DS2506S-UNW.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1985-F3-DS1985-F5.pdf .br http://pdfserv.maxim-ic.com/en/ds/DS1982U-DS1986U.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1825.30000664000175000017500000000433611535561503012100 00000000000000'\" '\" Copyright (c) 2003-2006 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1825.3,v 1.12 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1825 3 2006 "OWFS Manpage" "One-Wire File System" .SH NAME DS1825 \- Programmable Resolution 1-Wire Digital Thermometer with ID .SH SYNOPSIS Thermometer with hardware address pins. .PP .B 3B [.]XXXXXXXXXXXX[XX][/[ .so temperatures_mini.3so | .B power | .B prog_addr | .B temphigh | .B templow | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 3B .SH SPECIAL PROPERTIES .SS power .I read-only,yes-no .br Is the chip powered externally (=1) or from the parasitically from the data bus (=0)? .SS prog_addr .I read-only, 0-15 .br A distiguishing feature of the .B DS1825 (3) is the ability to set hardware pins for an address (0-15). This is an alternative to the unique 64-bit .I address that is set in the factory. .SS temperature .I read-only, floating point .br Measured temperature with 12 bit resolution. .SS temperature9 temperature10 temperature11 temperature12 .I read-only, floating point Measured temperature at 9 to 12 bit resolution. There is a tradeoff of time versus accuracy in the temperature measurement. .SS fasttemp .I read-only, floating point .br Equivalent to .I temperature9 .so temperature_threshold.3so .SH STANDARD PROPERTIES .so standard.3so .SH DESCRIPTION .so description.3so .SS DS1825 The .B DS1825 (3) is one of several available 1-wire temperature sensors. Alternatives are the .B DS18S20 (3), .B DS18B20 (3), and .B DS1822 (3) as well as temperature/voltage measurements in the .B DS2436 (3) and .B DS2438 (3). For truly versatile temperature measurements, see the protean .B DS1921 (3) Thermachron (3). .PP Although the .B DS1825 (3) can select between 4 resolutions, this program simplifies the interface by only implementing the fastest/roughest and slowest/best. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1825.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/owtcl.n0000664000175000017500000002106711572153434012476 00000000000000'\" '\" The definitions below are for supplemental macros used in Tcl/Tk '\" manual entries. '\" '\" .AP type name in/out ?indent? '\" Start paragraph describing an argument to a library procedure. '\" type is type of argument (int, etc.), in/out is either "in", "out", '\" or "in/out" to describe whether procedure reads or modifies arg, '\" and indent is equivalent to second arg of .IP (shouldn't ever be '\" needed; use .AS below instead) '\" '\" .AS ?type? ?name? '\" Give maximum sizes of arguments for setting tab stops. Type and '\" name are examples of largest possible arguments that will be passed '\" to .AP later. If args are omitted, default tab stops are used. '\" '\" .BS '\" Start box enclosure. From here until next .BE, everything will be '\" enclosed in one large box. '\" '\" .BE '\" End of box enclosure. '\" '\" .CS '\" Begin code excerpt. '\" '\" .CE '\" End code excerpt. '\" '\" .VS ?br? '\" Begin vertical sidebar, for use in marking newly-changed parts '\" of man pages. If an argument is present, then a line break is '\" forced before starting the sidebar. '\" '\" .VE '\" End of vertical sidebar. '\" '\" .DS '\" Begin an indented unfilled display. '\" '\" .DE '\" End of indented unfilled display. '\" '\" .SO '\" Start of list of standard options for a Tk widget. The '\" options follow on successive lines, in four columns separated '\" by tabs. '\" '\" .SE '\" End of list of standard options for a Tk widget. '\" '\" .OP cmdName dbName dbClass '\" Start of description of a specific option. cmdName gives the '\" option's name as specified in the class command, dbName gives '\" the option's name in the option database, and dbClass gives '\" the option's class in the option database. '\" '\" .UL arg1 arg2 '\" Print arg1 underlined, then print arg2 normally. '\" '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. .if t .wh -1.3i ^B .nr ^l \n(.l .ad b '\" # Start an argument description .de AP .ie !'\\$4'' .TP \\$4 .el \{\ . ie !'\\$2'' .TP \\n()Cu . el .TP 15 .\} .ie !'\\$3'' \{\ .ta \\n()Au \\n()Bu \&\\$1 \\fI\\$2\\fP (\\$3) .\".b .\} .el \{\ .br .ie !'\\$2'' \{\ \&\\$1 \\fI\\$2\\fP .\} .el \{\ \&\\fI\\$1\\fP .\} .\} .. '\" # define tabbing values for .AP .de AS .nr )A 10n .if !'\\$1'' .nr )A \\w'\\$1'u+3n .nr )B \\n()Au+15n .\" .if !'\\$2'' .nr )B \\w'\\$2'u+\\n()Au+3n .nr )C \\n()Bu+\\w'(in/out)'u+2n .. .AS Tcl_Interp Tcl_CreateInterp in/out '\" # BS - start boxed text '\" # ^y = starting y location '\" # ^b = 1 .de BS .br .mk ^y .nr ^b 1u .if n .nf .if n .ti 0 .if n \l'\\n(.lu\(ul' .if n .fi .. '\" # BE - end boxed text (draw box now) .de BE .nf .ti 0 .mk ^t .ie n \l'\\n(^lu\(ul' .el \{\ .\" Draw four-sided box normally, but don't draw top of .\" box if the box started on an earlier page. .ie !\\n(^b-1 \{\ \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .el \}\ \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .\} .fi .br .nr ^b 0 .. '\" # VS - start vertical sidebar '\" # ^Y = starting y location '\" # ^v = 1 (for troff; for nroff this doesn't matter) .de VS .if !'\\$1'' .br .mk ^Y .ie n 'mc \s12\(br\s0 .el .nr ^v 1u .. '\" # VE - end of vertical sidebar .de VE .ie n 'mc .el \{\ .ev 2 .nf .ti 0 .mk ^t \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' .sp -1 .fi .ev .\} .nr ^v 0 .. '\" # Special macro to handle page bottom: finish off current '\" # box/sidebar if in box/sidebar mode, then invoked standard '\" # page bottom macro. .de ^B .ev 2 'ti 0 'nf .mk ^t .if \\n(^b \{\ .\" Draw three-sided box if this is the box's first page, .\" draw two sides but no top otherwise. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .\} .if \\n(^v \{\ .nr ^x \\n(^tu+1v-\\n(^Yu \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c .\} .bp 'fi .ev .if \\n(^b \{\ .mk ^y .nr ^b 2 .\} .if \\n(^v \{\ .mk ^Y .\} .. '\" # DS - begin display .de DS .RS .nf .sp .. '\" # DE - end display .de DE .fi .RE .sp .. '\" # SO - start of list of standard options .de SO .SH "STANDARD OPTIONS" .LP .nf .ta 4c 8c 12c .ft B .. '\" # SE - end of list of standard options .de SE .fi .ft R .LP See the \\fBoptions\\fR manual entry for details on the standard options. .. '\" # OP - start of full description for a single option .de OP .LP .nf .ta 4c Command-Line Name: \\fB\\$1\\fR Database Name: \\fB\\$2\\fR Database Class: \\fB\\$3\\fR .fi .IP .. '\" # CS - begin code excerpt .de CS .RS .nf .ta .25i .5i .75i 1i .. '\" # CE - end code excerpt .de CE .fi .RE .. .de UL \\$1\l'|0\(ul'\\$2 .. .TH "Owtcl" TCL "20/January/2005" "Tcl" .HS table tk .BS .SH NAME Owtcl \- OWFS library access commands for Tcl .SH SYNOPSIS \fBpackage \fBrequire \fBow .sp \fBow\fI \fIoption \fR?\fIarg ...\fR? .sp \fB::OW::init\fI \fIinterface \fR?\fIinterface ...\fR? \fR?\fIarg ...\fR? .br \fB::OW::finish .br \fB::OW::isconnect .br \fB::OW::get\fI \fR?\fIpath\fR? \fR?\fIarg ...\fR? .br \fB::OW::put\fI \fIpath \fR?\fIvalue\fR? .br \fB::OW::isdirectory\fI \fIpath .br \fB::OW::isdir\fI \fIpath .br \fB::OW::exists\fI \fIpath \fR .SH DESCRIPTION .so description.nso .SS owtcl .B owtcl (3) is a Tcl extension that provides an interface to OWFS. The underlying interface to the 1-wire bus is identical to .B owfs (1) (filesystem view) and .B owhttpd (1) web server interface. Only the top layer has been modified to return native Tcl data. .SH COMMANDS Performs one of several operations, depending on \fIoption\fR. The legal \fIoption\fRs (which may be abbreviated) are: .TP \fBow open \fIarg ...\fR Connect to 1-wire adapter or \fIowserver\fR. \fIarg ...\fR defines a way of connection to the 1-wire bus. .br The full set of initialization args is extensive. They correspond roughly to the command line args of .B owfs (1) .B owhttpd (1) and .B owftpd (1) .TP \fBow close Close connection to 1-wire bus or owserver. .TP \fBow version\fR ?\fI-list\fR? Return version of the owtcl and owlib/ .TP \fBow opened Return 1 if connected to 1-wire adapter or \fIowserver\fR, otherwise 0. .TP \fBow error\fR \fIlevel\fR \fIvalue\fR Set debug options. See .B owfs (5) .TP \fBow error\fR \fIprint\fR \fIvalue\fR Set debug options. See .B owfs (5) .TP \fBow get\fR \fIpath\fR \fR?\fI-list\fR? Returns contents of OWFS directory as the list if path contains name OWFS directory. If path is name of OWFS file, returns of contents of this file. For files *.ALL returns a values list. .TP \fBow put \fIpath \fR\fIvalue\fR Puts \fIvalue\fR in OWFS file indicated in \fIpath\fR. For files *.ALL use a value list. .TP \fBow isdirectory \fIpath If \fIpath\fR is the directory return 1. Otherwise return 0. .TP \fBow isdir \fIpath Synonym of \fBow isdirectory .TP \fBow set \fIpath Creates a new \fBow\fR-like command with root in the \fIpath\fR. A new command allows options \fIget\fR, \fIput\fR, \fIisdirectory\fR, \fIisdir\fR and \fIset\fR. .SH LOW-LEVEL COMMANDS The following low-level commands are possible: .TP \fB::OW::init \fIinterface \fR?\fIinterface ...\fR? \fR?\fIarg ...\fR? Connect to 1-wire adapter or \fIowserver\fR. \fIinterface\fR and \fIarg ...\fR defines a way of connection to the 1-wire bus. .br The full set of initialization options is extensive. They correspond roughly to the command line options of ,B owfs (1) .B owhttpd (1) and .B owftpd (1) .TP \fB::OW::finish Close connection to 1-wire bus or owserver. .TP \fB::OW::isconnect Return 1 if connected to 1-wire adapter or \fIowserver\fR, otherwise 0. .TP \fB::OW::get \fR?\fIpath\fR? \fR?\fI-list\fR? Returns contents of OWFS directory as the list if path contains name OWFS directory. If path is name of OWFS file, returns of contents of this file. For files *.ALL returns a values list. If path is not defined, contents of root OWFS directory come back. .TP \fB::OW::put \fIpath \fR?\fIvalue\fR? Puts \fIvalue\fR in OWFS file indicated in \fIpath\fR. For files *.ALL use a value list. If /fIvalue\fR is not defined, puts a empty string. .TP \fB::OW::isdirectory \fIpath If \fIpath\fR is the directory - return 1. Otherwise return 0. .TP \fB::OW::isdir \fIpath Synonym of \fB::OW::isdirectory .TP \fB::OW::exists \fIpath If \fIpath\fR is exists - return 1. Otherwise return 0. .SH EXAMPLE .CS package require ow ow open \-d /dev/ttyS0 \-t 60 set save_templow [ow get /28.86BF80000000/templow] ow put /28.86BF80000000/templow 10 set room_sensor [ow set /28.86BF80000000] $room_sensor put temphigh 50 set room_temp [$room_sensor set temperature] set current_temp [$room_temp get] .CE .SH SEE ALSO .so seealso.nso .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Serg Oskin (serg@oskin.ru) .sp owfs-2.8p15/src/man/temperature.1so0000664000175000017500000000115511152552464014144 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: temperature.1so,v 1.1 2009/03/01 18:34:28 alfille Exp $ '\" .SH TEMPERATURE SCALE OPTIONS .SS \-C \-\-Celsius .SS \-F \-\-Fahrenheit .SS \-K \-\-Kelvin .SS \-R \-\-Rankine Temperature scale used for data output. Celsius is the default. .PP Can also be changed within the program at .I /settings/units/temperature_scale owfs-2.8p15/src/man/ownet.10000664000175000017500000001727011542520452012401 00000000000000'\" '\" Copyright (c) 2008 Paul H Alfille, MD '\" (palfille@gmail.com) '\" '\" Library manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: ownet.1,v 1.8 2011/03/24 01:40:58 alfille Exp $ '\" .TH OWNET 1 2008 "OWFS Manpage" "One-Wire File System" .SH NAME .B ownet , .B (libownet) \- easy C-language 1-wire interface to the owserver protocol .SH SYNOPSIS .B libownet library to link with your program .SS Handle .B OWNET_HANDLE .br Handle to each owserver connection .SS Initialization .B OWNET_HANDLE OWNET_init( const char * .I owserver_tcp_address_and_port .B ) .br Associate an .B owserver (1) tcp/ip address with a handle. .SS Directory listing .B int OWNET_dirlist( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , char ** .I comma_separated_list .B ) .br Create a comma-separated list of directory elements. .PP .B int OWNET_dirprocess( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , void (* .I dirfunc .B ) (void *, const char *), void * .I passed_on_value .B ) .br .B void .I dirfunc .B ( void * .I passed_on_value .B , const char * .I directory_element .B ) .br Apply function .I dirfunc to each directory element, along with an arbitrary passed_on_value. .SS Get data .B int OWNET_read( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , const char ** .I return_string .B ) .br Read a value (of specified size) from a 1-wire device. .PP .B int OWNET_lread( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , const char ** .I return_string .B , size_t .I size .B , off_t .I offset .B ) .br Read a value (of specified size and offset) from a 1-wire device. .PP .B int OWNET_present( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B ) .br Check if a 1-wire device is present. .SS Set data .B int OWNET_put( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , const char * .I value_string .B , size_t .I size .B ) .br Write a value (of specified size) to a 1-wire device. .PP .B int OWNET_lwrite( OWNET_HANDLE .I owserver_handle .B , const char * .I onewire_path .B , const char * .I value_string .B , size_t .I size .B , off_t .I offset .B ) .br Write a value (of specified size and offset) to a 1-wire device. .SS Close .B void OWNET_close( OWNET_HANDLE .I owserver_handle .B ) .br Close the connection to a particular owserver. .PP .B void OWNET_closeall( void ) .br Close all open owserver connections. .PP .B void OWNET_finish( void ) .br Close all open owserver connections and free all memory. .SS Temperature scale .B void OWNET_set_temperature_scale( char .I temperature_scale .B ) .br .B char OWNET_get_temperature_scale( void ) .br Set and retrieve the temperature scale used for all communications. .SS Device format .B void OWNET_set_device_format( const char * .I device_format .B ) .br .B const char * OWNET_get_device_format( void ) .br Set and retrieve the 1-wire device serial number format used for all communications. .SH FUNCTIONS .SS OW_init .I OW_init_string offers the full flexibility of the .B owfs (1) and .B owhttpd (1) command line. .TP .I Arguments Can be as simple as jus the device name, a full parameter specification. One or more device names (includes tcp, serial, usb...) and command line switches. See .B owfs (1) for full syntax. .TP .I Returns 0 for success. \-1 on error and .I errno will be set. .I OW_finish does not need to be called if .I OW_init fails. .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_init_args .I OW_init_args offers the full flexibility of the .B owfs (1) and .B owhttpd (1) command line. .TP .I Arguments One or more device names (includes tcp, serial, usb...) and command line switches. See .B owfs (1) for full syntax. Unlike .I OW_init_string the arguments are in argv/argc format. .TP .I Returns 0 for success. \-1 on error and .I errno will be set. .I OW_finish does not need to be called if .I OW_init fails. .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_get .I OW_get is used to get directory listings and file contents. The results are put in a dynamically allocated buffer. .TP .I Arguments .I path is the path to the directory or file (property). .I *buffer returns a pointer to a buffer containing the directory (comma separated) or value. .I buffer_length returns the length of the value/string in .I buffer .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .TP .I Important note .I buffer is allocated ( with malloc ) by .I OW_get but must be freed in your program. See .B malloc (3) and .B free (3) .SS OW_lread .I OW_lread is used to read 1-wire memory chips. Think of it as a combination of .I lseek and .I read It allows random-access to the memory, specifying location and length. Unlike .I OW_get directories cannot be obtained and the buffer must be pre-allocated rather than allocated by the routine. .I buffer must be at least .I size length. .TP .I Arguments .I path is the path to the file (property). .I buffer is the (pre-allocated) memory area where the value will be placed. .I size is the length of bytes requested. .I offset is the position in file to start reading. .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_put .I OW_put is an easy way to write to 1-wire chips. .TP .I Arguments .I path is the path to the file (property). .I buffer is the value to be written. .I buffer_length is the length of the value .I buffer. .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_lwrite .I OW_lwrite is the companion of .I OW_lread. It allows writing to arbitrary positions in 1-wire memory. Think of it as a combination of .I lseek and .I write. .I buffer must be at least .I size length. .TP .I Arguments .I path is the path to the file (property). .I buffer is the data to be written. .I size is the length of bytes to be written. .I offset is the position in file to start writing. .TP .I Returns number of bytes on success. \-1 on error (and .I errno is set). .TP .I Sequence One of the .I init functions must be called before accessing the 1-wire bus. .I OW_finish is optional. .SS OW_finish .I OW_finish cleans up the .I OWFS 1-wire routines, releases devices and memory. .TP .I Arguments None. .TP .I Returns None .TP .I Sequence .I OW_finish is optional since cleanup is automatic on program exit. .SH "DESCRIPTION" .so description.1so .SS libowcapi .B libowcapi (1) is an encapsulation of the full .B libow library for C programs. .PP .B libowcapi (1) allows a C program to use .I OWFS principles (consistent naming scheme, multiple adapters, devices, and compatibility) directly from a C program. There are analogous modules for other programming languages: .TP .I C libowcapi .TP .I perl owperl .TP .I php owphp .TP .I python owpython .TP .I tcl owtcl .SH EXAMPLE /* Simple directory listing -- no error checking */ .br #include .br char * buf; .br size_t s ; .br OWNET_init("localhost:4304"); .br OWNET_dirlist("/",&buf,&s) ; .br printf("Directory %s\n",buf); .br free(buf); .br OWNET_finish() ; .SH SEE ALSO .so seealso.1so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/DS1992.30000664000175000017500000000304711535561503012103 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1992.3,v 1.17 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1992 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1992 \- 1kbit Memory iButton .SH SYNOPSIS Non-volatile memory. .PP .B 08 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/page.[0-3|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .TP .I 08 DS1996 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 128 bytes of memory. .SS pages/page.0 ... pages/page.3 pages/page.ALL .I read-write, binary .br Memory is split into 4 pages of 32 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1992 The .B DS1992 (3) is an iButton with static memory. Data is read/written with error checking (transparent to the user). The .B DS1992 (3) , .B DS1993 (3) , .B DS1995 (3) , and .B DS1996 (3) differ in their function by the amount of on-board memory they possess. (The internal protocols are slightly different, but the .I OWFS system handles this automatically.) .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1992-DS1993.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/man/format.1so0000664000175000017500000000240011152545757013100 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (palfille@earthlink.net) '\" '\" Program manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: format.1so,v 1.1 2009/03/01 17:54:55 alfille Exp $ '\" .SH FORMAT OPTIONS Choose the representation of the 1-wire unique identifiers. OWFS uses these identifiers as unique directory names. .PP Although several display formats are selectable, all must be in .I family-id-crc8 form, unlike some other programs and the labelling on iButtons, which are .I crc8-id-family form. .SS \-f \-\-format="f[.]i[[.]c]" Display format for the 1-wire devices. Each device has a 8byte address, consisting of: .TP .I f family code, 1 byte .TP .I i ID number, 6 bytes .TP .I c CRC checksum, 1 byte .PP Possible formats are .I f.i (default, 01.A1B2C3D4E5F6), .I fi fic f.ic f.i.c and .I fi.c .PP All formats are accepted as input, but the output will be in the specified format. .PP The address elements can be retrieved from a device entry in owfs by the .I family, id and crc8 properties, and as a whole with .I address. The reversed id and address can be retrieved as .I r_id and .I r_address. owfs-2.8p15/src/man/DS1991.30000664000175000017500000001112211535561503012073 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS1991.3,v 1.12 2011/03/09 02:17:39 alfille Exp $ '\" .TH DS1991 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS1991 \- 1152bit MultiKey iButton .SH SYNOPSIS Non-volatile memory with password protection. .PP .B 02 [.]XXXXXXXXXXXX[XX][/[ .B memory | .B pages/ident.[0-2|ALL] | .B pages/page.[0-2|ALL] | .B pages/password.[0-2|ALL] | .B settings/ident.[0-2|ALL] | .B settings/page.[0-2|ALL] | .B settings/password.[0-2|ALL] | .B settings/change_password.[0-2|ALL] | .B settings/reset_password.[0-2|ALL] | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 02 .SH SPECIAL PROPERTIES .SS memory .I read-write, binary .br 144 bytes of non-volatile memory. Reading and writing (with offset) to the files will only work if currently used password is correct for all 3 pages. .SS pages/page.0 pages/page.1 pages/page.2 pages/page.ALL .I read-write, binary .br Memory is split into 3 pages of 48 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. If currently used password is incorrect, random data will be returned when reading a page. .SS pages/password.0 pages/password.1 pages/password.2 pages/password.ALL .I write, binary .br Memory is split into 3 pages and each page has a unique password (8 bytes). .I ALL is an aggregate of the password. Each page is accessed sequentially. Writing to this file will set the currently used password when accessing memory in corresponding page. If the password is wrong, random data will be returned when reading memory. .SS pages/ident.0 pages/ident.1 pages/ident.2 pages/ident.ALL .I read-write, binary .br Memory is split into 3 pages and each page has a unique identification (8 bytes). .I ALL is an aggregate of the ident. Each page is accessed sequentially. Identification will return correct result even if currently used password is incorrect. .SS settings/page.0 settings/page.1 settings/page.2 settings/page.ALL .I read-write, binary .br Memory is split into 3 pages of 48 bytes each. .I ALL is an aggregate of the pages. Each page is accessed sequentially. If currently used password is incorrect, random data will be returned when reading a page. (same as pages/page.*) .SS settings/ident.0 settings/ident.1 settings/ident.2 settings/ident.ALL .I read-write, binary .br Memory is split into 3 pages and each page has a unique identification (8 bytes). .I ALL is an aggregate of the ident. Each page is accessed sequentially. Identification will return correct result even if currently used password is incorrect. (same as pages/ident.*) .SS settings/password.0 settings/password.1 settings/password.2 settings/password.ALL .I write, binary .br Memory is split into 3 pages and each page has a unique password (8 bytes). .I ALL is an aggregate of the password. Each page is accessed sequentially. Writing to this file will set the currently used password when accessing memory in corresponding page. If the password is wrong, random data will be returned when reading memory. (same as pages/password.*) .SS settings/reset_password.0 settings/reset_password.1 settings/reset_password.2 settings/reset_password.ALL .I write, binary .br Memory is split into 3 pages and each page has a unique password (8 bytes). .I ALL is an aggregate of the ident. Each page is accessed sequentially. Writing to this file will reset the password on the page. NOTE: All data in corresponding page will be deleted! .SS settings/change_password.0 settings/change_password.1 settings/change_password.2 settings/change_password.ALL .I write, binary .br Memory is split into 3 pages and each page has a unique password (8 bytes). .I ALL is an aggregate of the ident. Each page is accessed sequentially. Writing to this file will change the password on the page. NOTE: Currently used password have to be set to correct password before changing password. Data in the corresponding page is NOT effected. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS1991 The .B DS1991 (3) is an iButton with password protected non-volatile memory. Data is read/written with error checking (transparent to the user). The memory is divided into 3 different pages with 3 separate passwords. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS1991.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Christian Magnusson (mag@mag.cx) owfs-2.8p15/src/man/Thermachron.30000664000175000017500000000001510244715043013506 00000000000000.so DS1921.3 owfs-2.8p15/src/man/DS2437.30000664000175000017500000001016211535563402012072 00000000000000'\" '\" Copyright (c) 2003-2004 Paul H Alfille, MD '\" (paul.alfille@gmail.com) '\" '\" Device manual page for the OWFS -- 1-wire filesystem package '\" Based on Dallas Semiconductor, Inc's datasheets, and trial and error. '\" '\" Free for all use. No waranty. None. Use at your own risk. '\" $Id: DS2437.3,v 1.10 2011/03/09 02:33:38 alfille Exp $ '\" .TH DS2437 3 2003 "OWFS Manpage" "One-Wire File System" .SH NAME DS2437 \- Smart Battery Monitor .SH SYNOPSIS Temperature Voltages and Memory. .PP .B 1E [.]XXXXXXXXXXXX[XX][/[ .B current | .B date | .B disconnect/date | .B disconnect/udate | .B endcharge/date | .B endcharge/udate | .I Ienable | .B pages/page.[0-7|ALL] | .B temperature | .B udate | .B VAD | .B VDD | .so standard_mini.3so ]] .SH FAMILY CODE .PP .I 1E .SH SPECIAL PROPERTIES .SS date .I read-write, ascii .br 26 character date representation of the .I counter value. Increments once per second. .br Setting .I date to a null string will put the current system time. .br Accepted date formats are: .br Sat[urday] March 12 12:23:59 2001 .br Apr[il] 4 9:34:56 2002 .br 3/23/04 23:34:57 .br current locale setting (your system's format) .SS current .I read-only, integer .br Current reading. Actual current depends on Rsens resistor (see datasheet). .br The formula for current is I = .I current /(4096*Rsens) .br with units in Amps and Ohms. .br Current measurement will be temporarily enabled (see .I Ienable ) if not currently enabled (pun intended) for this reading. .SS disconnect/date .I read-write, ascii .br 26 character date representation of the .I disconnect/udate value. Time when the battery pack waws removed from the charger. Format is the same as the .I date property. .SS disconnect/udate .I read-write, unsigned integer .br Representation of .I disconnect/date as a number. See .I udate for details. .SS endcharge/date .I read-write, ascii .br 26 character date representation of the .I endcharge/udate value. Format is the same as the .I date property. .SS endcharge/udate .I read-write, unsigned integer .br Representation of .I endcharge/date as a number. See .I udate for details. .SS Ienable .I read-write, unsigned integer .br Status of .I current monitoring. When enabled, current sensing is performed 36.41 times/second. Values of .I Ienable are: .TP .B 0 no current conversion .TP .B 1 current conversion enabled .TP .B 2 current conversion and accumulation .TP .B 3 current conversion and accumulation with EEPROM backup .SS pages/page.0 ... pages/page.7 pages/page.ALL .I read-write, binary .br Memory is split into 8 pages of 8 bytes each. Only the pages 3-7 are really available, and some of that appears to be reserved. See the datasheet for details. .br .I ALL is an aggregate of the pages. Each page is accessed sequentially. .SS temperature .I read-only, floating point .br .I Temperature read by the chip at high resolution (~13 bits). Units are selected from the invoking command line. See .B owfs(1) or .B owhttpd(1) for choices. Default is Celsius. Conversion takes ~20 msec. .SS udate .I read-write, unsigned integer .br Time represented as a number. .I udate increments once per second. .br Usually set to unix time standard: number of seconds since Jan 1, 1970. The .I date field will be the unix representation (ascii text) of .I udate and setting either will change the other. .SS VAD VDD .I read-only, floating point .br Voltage read (~10 bits) at the one of the chip's two supply voltages. Range VDD= 2.4V to 10V, VAD=1.5 to 10V. .SH STANDARD PROPERTIES .so standard.3so .SH ALARMS None. .SH DESCRIPTION .so description.3so .SS DS2437 The .B DS2437 (3) is an obsolete version of the .B DS2438 (3) battery chip. Current sensing is available, but not implemented. The major advantage compared to the .B DS2436 is that two voltages can be read, allowing correcting circuit nmeasurements to supply voltage and temperature. A better comparison is the .B DS276x family of chips. .SH ADDRESSING .so addressing.3so .SH DATASHEET .br http://pdfserv.maxim-ic.com/en/ds/DS2437.pdf .br http://pdfserv.maxim-ic.com/en/an/humsensor.pdf .SH SEE ALSO .so seealso.3so .SH AVAILABILITY http://www.owfs.org .SH AUTHOR Paul Alfille (paul.alfille@gmail.com) owfs-2.8p15/src/scripts/0000775000175000017500000000000011756315507012162 500000000000000owfs-2.8p15/src/scripts/install/0000775000175000017500000000000011756315507013630 500000000000000owfs-2.8p15/src/scripts/install/mkinstalldirs0000775000175000017500000000132107740730725016354 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.2 2003/10/08 06:42:29 vtt Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here owfs-2.8p15/src/scripts/install/depcomp0000775000175000017500000002753307740730724015137 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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 . 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 # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi 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 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. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 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. 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. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi 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,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$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" ;; 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 tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab 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 proprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. We will use -o /dev/null later, # however we can't do the remplacement now because # `-o $object' might simply not be used 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 "$@" -o /dev/null $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 $? # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; -*) ;; *) 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 proprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--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 '/^# [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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 owfs-2.8p15/src/scripts/install/config.guess0000755000175000017500000012743211754547512016100 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # 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 Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: owfs-2.8p15/src/scripts/install/ltmain.sh0000644000175000017500000105204011754547512015371 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 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. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1ubuntu1" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 owfs-2.8p15/src/scripts/install/config.sub0000755000175000017500000010517611754547512015544 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # 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. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: owfs-2.8p15/src/scripts/install/missing0000775000175000017500000002557711025705537015162 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # 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] Send bug reports to ." 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 # 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). 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 $1 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 1 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-end: "$" # End: owfs-2.8p15/src/scripts/install/install-sh0000755000175000017500000003253711651604433015555 00000000000000#!/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: owfs-2.8p15/src/scripts/usb/0000775000175000017500000000000011756315507012753 500000000000000owfs-2.8p15/src/scripts/usb/suse_setup.sh0000664000175000017500000000360410665524447015434 00000000000000#!/bin/sh # # $Id: suse_setup.sh,v 1.2 2007/08/30 11:25:27 d1mag Exp $ # OWFS setup routines for SUSE systems # Written by Paul Alfille and others. # udev routines by Peter Kropf # GPL v2 license (like all of OWFS) # copyrite 12/2006 Paul H Alfille # ### ------------------ ### -- Constants ----- ### ------------------ OWFS_GROUP=ow # # ### ----------------- ### -- Group -------- ### ----------------- groupadd $OWFS_GROUP # ### ----------------- ### -- Links -------- ### ----------------- # Put all the ninaries in /usr/bin # make them part of the "ow" group # and let only their owner and group read or execute them OWFS_bin="owfs owhttpd owftpd owserver owread owwrite owpresent owdir" for x in $OWFS_bin do ln -sfv /opt/owfs/bin/$x /usr/bin/$x done # ### ----------------- ### -- Rules -------- ### ----------------- cat >/etc/udev/rules.d/46_ds2490.rules << RULES BUS=="usb", SYSFS=="04fa", SYSFS=="2490", GROUP="users", MODE="0774", PROGRAM="/bin/sh -c 'K=%k; K=\$\$; printf bus/usb/%%03i/%%03i \$\$ \$\$'", NAME="%c", RUN="/etc/udev/ds2490 '%c'" RULES # ### ----------------- ### -- Shell -------- ### ----------------- cat >/etc/udev/ds2490 << SHELL #! /bin/sh -x /sbin/rmmod ds9490r MATCH="no" if [ "\$1" != "" ]; then if [ -f /proc/\$1 ]; then chgrp $OWFS_GROUP /proc/\$1 && \ chmod g+rw /proc/\$1 && \ logger ow udev: group set to $OWFS_GROUP and permission g+rw on /proc/\$1 MATCH="yes" fi if [ -e /dev/\$1 ]; then chgrp $OWFS_GROUP /dev/\$1 && \ chmod g+rw /dev/\$1 && \ logger ow udev: group set to $OWFS_GROUP and permission g+rw on /dev/\$1 MATCH="yes" fi fi if [ "\$MATCH" = "no" ]; then echo ow udev: no device file found for "\$1" logger ow udev: no device file found for "\$1" fi SHELL chmod 755 /etc/udev/ds2490 owfs-2.8p15/src/scripts/usb/Readme.txt0000664000175000017500000000021010201767662014617 00000000000000The owfs/src/scripts/usb directory tree contains sample scripts used in configuring and installing OWFS on differenct types of systems. owfs-2.8p15/src/scripts/usb/Makefile.in0000664000175000017500000005126611756250031014740 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/scripts/usb DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = windows cygwin EXTRA_DIST = Readme.txt fedora_setup.sh suse_setup.sh all: all-recursive .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 src/scripts/usb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/scripts/usb/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/scripts/usb/fedora_setup.sh0000775000175000017500000000371110665521030015700 00000000000000#!/bin/sh # # $Id: fedora_setup.sh,v 1.2 2007/08/30 10:55:20 d1mag Exp $ # OWFS setup routines for SUSE systems # Written by Paul Alfille and others. # udev routines by Peter Kropf # GPL v2 license (like all of OWFS) # copyrite 12/2006 Paul H Alfille # ### ------------------ ### -- Constants ----- ### ------------------ OWFS_GROUP=ow # # ### ----------------- ### -- Group -------- ### ----------------- groupadd $OWFS_GROUP # ### ----------------- ### -- Links -------- ### ----------------- # Put all the ninaries in /usr/bin # make them part of the "ow" group # and let only their owner and group read or execute them OWFS_bin="owfs owhttpd owftpd owserver owread owwrite owpresent owdir" for x in $OWFS_bin do ln -sfv /opt/owfs/bin/$x /usr/bin/$x done # ### ----------------- ### -- Rules -------- ### ----------------- cat >/etc/udev/rules.d/46_ds2490.rules << RULES BUS=="usb", ACTION=="add", SYSFS{idVendor}=="04fa", SYSFS{idProduct}=="2490", \ PROGRAM="/bin/sh -c 'K=%k; K=\$\${K#usbdev}; printf bus/usb/%%03i/%%03i \$\${K%%%%.*} \$\${K#*.}'", \ NAME="%c", MODE="0664", RUN+="/etc/udev/ds2490 '%c'" RULES # ### ----------------- ### -- Shell -------- ### ----------------- cat >/etc/udev/ds2490 << SHELL #! /bin/sh -x /sbin/rmmod ds9490r MATCH="no" if [ "\$1" != "" ]; then if [ -f /proc/\$1 ]; then chgrp $OWFS_GROUP /proc/\$1 && \ chmod g+rw /proc/\$1 && \ logger ow udev: group set to $OWFS_GROUP and permission g+rw on /proc/\$1 MATCH="yes" fi if [ -e /dev/\$1 ]; then chgrp $OWFS_GROUP /dev/\$1 && \ chmod g+rw /dev/\$1 && \ logger ow udev: group set to $OWFS_GROUP and permission g+rw on /dev/\$1 MATCH="yes" fi fi if [ "\$MATCH" = "no" ]; then echo ow udev: no device file found for "\$1" logger ow udev: no device file found for "\$1" fi SHELL chmod 755 /etc/udev/ds2490 owfs-2.8p15/src/scripts/usb/cygwin/0000775000175000017500000000000011756315507014253 500000000000000owfs-2.8p15/src/scripts/usb/cygwin/ds9490.inf0000775000175000017500000000415410516154137015625 00000000000000[Version] Signature = "$Chicago$" provider = %manufacturer% DriverVer = 04/15/2006,0.1.10.1 CatalogFile = ds9490.cat Class = LibUsbDevices ClassGUID = {EB781AAF-9C70-4523-A5DF-642A87ECA567} [ClassInstall] AddReg=ClassInstall.AddReg [ClassInstall32] AddReg=ClassInstall.AddReg [ClassInstall.AddReg] HKR,,,,"LibUSB-Win32 Devices" HKR,,Icon,,"-20" [Manufacturer] %manufacturer%=Devices ;-------------------------------------------------------------------------- ; Files ;-------------------------------------------------------------------------- [SourceDisksNames] 1 = "Libusb-Win32 Driver Installation Disk",, [SourceDisksFiles] libusb0.sys = 1,, cygusb0.dll = 1,, [DestinationDirs] LIBUSB.Files.Sys = 10,System32\Drivers LIBUSB.Files.Dll = 10,System32 [LIBUSB.Files.Sys] libusb0.sys [LIBUSB.Files.Dll] cygusb0.dll ;-------------------------------------------------------------------------- ; Device driver ;-------------------------------------------------------------------------- [LIBUSB_DEV] CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll AddReg = LIBUSB_DEV.AddReg [LIBUSB_DEV.NT] CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll [LIBUSB_DEV.HW] DelReg = LIBUSB_DEV.DelReg.HW [LIBUSB_DEV.NT.HW] DelReg = LIBUSB_DEV.DelReg.HW [LIBUSB_DEV.NT.Services] AddService = libusb0, 0x00000002, LIBUSB.AddService [LIBUSB_DEV.AddReg] HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,libusb0.sys [LIBUSB_DEV.DelReg.HW] HKR,,"LowerFilters" ;-------------------------------------------------------------------------- ; Services ;-------------------------------------------------------------------------- [LIBUSB.AddService] DisplayName = "LibUsb-Win32 - Kernel Driver 04/15/2006, 0.1.10.1" ServiceType = 1 StartType = 3 ErrorControl = 0 ServiceBinary = %12%\libusb0.sys ;-------------------------------------------------------------------------- ; Devices ;-------------------------------------------------------------------------- [Devices] "DS9490 1-Wire USB adapter"=LIBUSB_DEV, USB\VID_04fa&PID_2490 [Strings] manufacturer = "Maxim/Dallas" owfs-2.8p15/src/scripts/usb/cygwin/Makefile.in0000664000175000017500000004107411756250031016234 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/scripts/usb/cygwin DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(ds9490cygdriversdir)" DATA = $(ds9490cygdrivers_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = ds9490.inf ds9490.cat README.txt @HAVE_CYGWIN_TRUE@ds9490cygdriversdir = ${prefix}/drivers @HAVE_CYGWIN_TRUE@ds9490cygdrivers_DATA = ds9490.inf ds9490.cat README.txt 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 src/scripts/usb/cygwin/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/scripts/usb/cygwin/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-ds9490cygdriversDATA: $(ds9490cygdrivers_DATA) @$(NORMAL_INSTALL) test -z "$(ds9490cygdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(ds9490cygdriversdir)" @list='$(ds9490cygdrivers_DATA)'; test -n "$(ds9490cygdriversdir)" || 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)$(ds9490cygdriversdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(ds9490cygdriversdir)" || exit $$?; \ done uninstall-ds9490cygdriversDATA: @$(NORMAL_UNINSTALL) @list='$(ds9490cygdrivers_DATA)'; test -n "$(ds9490cygdriversdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(ds9490cygdriversdir)'; $(am__uninstall_files_from_dir) 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 $(DATA) installdirs: for dir in "$(DESTDIR)$(ds9490cygdriversdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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." @HAVE_CYGWIN_FALSE@install-data-local: 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-data-local install-ds9490cygdriversDATA 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: uninstall-ds9490cygdriversDATA .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-data-local \ install-ds9490cygdriversDATA 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 \ uninstall-ds9490cygdriversDATA @HAVE_CYGWIN_TRUE@install-data-local: @HAVE_CYGWIN_TRUE@ @INSTALL@ -d ${DESTDIR}${bindir} @HAVE_CYGWIN_TRUE@ -if test -f /bin/cygwin1.dll; then \ @HAVE_CYGWIN_TRUE@ @INSTALL@ /bin/cygwin1.dll ${DESTDIR}${bindir}/ ; \ @HAVE_CYGWIN_TRUE@ fi @HAVE_CYGWIN_TRUE@ -if test -f /bin/cygusb0.dll; then \ @HAVE_CYGWIN_TRUE@ @INSTALL@ /bin/cygusb0.dll ${DESTDIR}${bindir}/ ; \ @HAVE_CYGWIN_TRUE@ fi # @INSTALL@ -d ${DESTDIR}${prefix}/drivers # @INSTALL@ ${EXTRA_DIST} ${DESTDIR}${prefix}/drivers/ clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/scripts/usb/cygwin/README.txt0000664000175000017500000000304410516154137015663 00000000000000 Some instructions how to install and use OWFS on Windows with Cygwin. Install Cygwin Install cygwin package libusb-win32-0.1.10.1-3) Easiest way is to use cygwin's setup.exe to download and install it. Source could be found at: http://brl.thefreecat.org/libusb-win32/ if you want to compile it by yourself. (haven't tried it myself) # /usr/sbin/libusb-install.exe This will install the Windows service called "Libusb-win32 daemon" # testlibusb This will check if libusb-win32 works. Download the OWFS Windows binary package. # tar -C/ -xvzf owfs-2.5p4_cygwin.tar.gz # ls -l /opt/owfs/ total 0 drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:27 bin drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:55 drivers drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:28 include drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:28 lib drwxr-xr-x+ 6 Mag Ingen 0 Oct 15 09:54 man Plugin the DS9490 USB-adapter. Manually install the driver by choosing C:\cygwin\opt\owfs\drivers\ds9490.inf You will be asked to point out the location of the files: C:\cygwin\lib\libusb\libusb0.sys C:\cygwin\usr\bin\cygusb0.dll Note: The reason to the different dll-prefix could be found here: http://comments.gmane.org/gmane.os.cygwin.applications/13209 You will now see your "DS9490 1-Wire USB Adapter" in your device list. # /opt/owfs/bin/owserver.exe -u -p 3000 # /opt/owfs/bin/owhttpd.exe -s 3000 -p 3001 # /opt/owfs/bin/owdir.exe -s 3000 / bus.0 settings system statistics /10.94C7ED000800 /81.465723000000 /37.11A401000000 Visit the web-page http://127.0.0.1:3001/ to see the 1-wire devices in your web-browser. owfs-2.8p15/src/scripts/usb/cygwin/ds9490.cat0000775000175000017500000000025010516154137015611 00000000000000This file will contain the digital signature of the files to be installed on the system. This file will be provided by Microsoft upon certification of your drivers. owfs-2.8p15/src/scripts/usb/cygwin/Makefile.am0000664000175000017500000000104110577172175016225 00000000000000 EXTRA_DIST = ds9490.inf ds9490.cat README.txt if HAVE_CYGWIN ds9490cygdriversdir = ${prefix}/drivers ds9490cygdrivers_DATA = ds9490.inf ds9490.cat README.txt install-data-local: @INSTALL@ -d ${DESTDIR}${bindir} -if test -f /bin/cygwin1.dll; then \ @INSTALL@ /bin/cygwin1.dll ${DESTDIR}${bindir}/ ; \ fi -if test -f /bin/cygusb0.dll; then \ @INSTALL@ /bin/cygusb0.dll ${DESTDIR}${bindir}/ ; \ fi # @INSTALL@ -d ${DESTDIR}${prefix}/drivers # @INSTALL@ ${EXTRA_DIST} ${DESTDIR}${prefix}/drivers/ endif clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/scripts/usb/Makefile.am0000664000175000017500000000016111024233244014706 00000000000000SUBDIRS = windows cygwin EXTRA_DIST = Readme.txt fedora_setup.sh suse_setup.sh clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/scripts/usb/windows/0000775000175000017500000000000011756315507014445 500000000000000owfs-2.8p15/src/scripts/usb/windows/ds9490.inf0000775000175000017500000000415410516154137016017 00000000000000[Version] Signature = "$Chicago$" provider = %manufacturer% DriverVer = 04/15/2006,0.1.10.1 CatalogFile = ds9490.cat Class = LibUsbDevices ClassGUID = {EB781AAF-9C70-4523-A5DF-642A87ECA567} [ClassInstall] AddReg=ClassInstall.AddReg [ClassInstall32] AddReg=ClassInstall.AddReg [ClassInstall.AddReg] HKR,,,,"LibUSB-Win32 Devices" HKR,,Icon,,"-20" [Manufacturer] %manufacturer%=Devices ;-------------------------------------------------------------------------- ; Files ;-------------------------------------------------------------------------- [SourceDisksNames] 1 = "Libusb-Win32 Driver Installation Disk",, [SourceDisksFiles] libusb0.sys = 1,, libusb0.dll = 1,, [DestinationDirs] LIBUSB.Files.Sys = 10,System32\Drivers LIBUSB.Files.Dll = 10,System32 [LIBUSB.Files.Sys] libusb0.sys [LIBUSB.Files.Dll] libusb0.dll ;-------------------------------------------------------------------------- ; Device driver ;-------------------------------------------------------------------------- [LIBUSB_DEV] CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll AddReg = LIBUSB_DEV.AddReg [LIBUSB_DEV.NT] CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll [LIBUSB_DEV.HW] DelReg = LIBUSB_DEV.DelReg.HW [LIBUSB_DEV.NT.HW] DelReg = LIBUSB_DEV.DelReg.HW [LIBUSB_DEV.NT.Services] AddService = libusb0, 0x00000002, LIBUSB.AddService [LIBUSB_DEV.AddReg] HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,libusb0.sys [LIBUSB_DEV.DelReg.HW] HKR,,"LowerFilters" ;-------------------------------------------------------------------------- ; Services ;-------------------------------------------------------------------------- [LIBUSB.AddService] DisplayName = "LibUsb-Win32 - Kernel Driver 04/15/2006, 0.1.10.1" ServiceType = 1 StartType = 3 ErrorControl = 0 ServiceBinary = %12%\libusb0.sys ;-------------------------------------------------------------------------- ; Devices ;-------------------------------------------------------------------------- [Devices] "DS9490 1-Wire USB adapter"=LIBUSB_DEV, USB\VID_04fa&PID_2490 [Strings] manufacturer = "Maxim/Dallas" owfs-2.8p15/src/scripts/usb/windows/Makefile.in0000664000175000017500000003350711756250031016430 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/scripts/usb/windows DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = ds9490.inf ds9490.cat README.txt 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 src/scripts/usb/windows/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/scripts/usb/windows/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): 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 #ds9490windriversdir = ${prefix}/drivers #ds9490windrivers_DATA = ds9490.inf ds9490.cat README.txt #install-ds9490windrivers-local: # @INSTALL@ -d ${DESTDIR}${prefix}/drivers # @INSTALL@ ${EXTRA_DIST} ${DESTDIR}${prefix}/drivers/ clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/scripts/usb/windows/README.txt0000664000175000017500000000214410516154137016055 00000000000000 Some instructions how to install and use OWFS on Windows (without Cygwin). (This file is NOT complete yet...) Download and install libusb-win32-filter-bin-0.1.10.1.exe # testlibusb-win.exe This will check if libusb-win32 works. Download the OWFS Windows binary package. # unpack owfs-2.5p4_windows.tar.gz # C: # cd \owfs total 0 drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:27 bin drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:55 drivers drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:28 include drwxr-xr-x+ 2 Mag Ingen 0 Oct 19 11:28 lib drwxr-xr-x+ 6 Mag Ingen 0 Oct 15 09:54 man Plugin the DS9490 USB-adapter. Manually install the driver by choosing C:\owfs\drivers\ds9490.inf You will be asked to point out the location of the files: C:\windows\system32\drivers\libusb0.sys C:\windows\system32\libusb0.dll You will now see your "DS9490 1-Wire USB Adapter" in your device list. # owserver.exe -u -p 3000 # owhttpd.exe -s 3000 -p 3001 # owdir.exe -s 3000 / bus.0 settings system statistics /10.94C7ED000800 /81.465723000000 /37.11A401000000 Visit the web-page http://127.0.0.1:3001/ to see the 1-Wire devices in your web-browser. owfs-2.8p15/src/scripts/usb/windows/ds9490.cat0000775000175000017500000000025010516154137016003 00000000000000This file will contain the digital signature of the files to be installed on the system. This file will be provided by Microsoft upon certification of your drivers. owfs-2.8p15/src/scripts/usb/windows/Makefile.am0000664000175000017500000000047110516155425016415 00000000000000 EXTRA_DIST = ds9490.inf ds9490.cat README.txt #ds9490windriversdir = ${prefix}/drivers #ds9490windrivers_DATA = ds9490.inf ds9490.cat README.txt #install-ds9490windrivers-local: # @INSTALL@ -d ${DESTDIR}${prefix}/drivers # @INSTALL@ ${EXTRA_DIST} ${DESTDIR}${prefix}/drivers/ clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/scripts/Makefile.in0000664000175000017500000005116111756250031014141 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = usb windows all: all-recursive .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 src/scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/scripts/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/scripts/Makefile.am0000664000175000017500000000006710520364140014122 00000000000000SUBDIRS = usb windows clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/scripts/windows/0000775000175000017500000000000011756315507013654 500000000000000owfs-2.8p15/src/scripts/windows/Makefile.in0000664000175000017500000003356411756250031015642 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/scripts/windows DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/owfs.nsi.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = owfs.nsi CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ 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 src/scripts/windows/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/scripts/windows/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): owfs.nsi: $(top_builddir)/config.status $(srcdir)/owfs.nsi.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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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." @HAVE_CYGWIN_FALSE@install-data-local: 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-data-local 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-data-local 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 @HAVE_CYGWIN_TRUE@install-data-local: @HAVE_CYGWIN_TRUE@ @INSTALL@ -d -m0755 ${DESTDIR}${bindir} clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/scripts/windows/owfs.nsi.in0000755000175000017500000001465611704676027015707 00000000000000# $Id: owfs.nsi.in,v 1.10 2012/01/16 01:23:35 alfille Exp $ # Part of the OWFS (One Wire Filesystem) # See http://www.owfs.org # Copyright 2006 Paul H Alfille # # Windows installer script # Using NSIS from Nullsoft # # file src/windows/owfs.nsi ######### # Interface ######### !include "MUI.nsh" # Use Logic Library to improve readability !include "LogicLib.nsh" ######### # Version ######### !ifndef VERSION !define VERSION '@VERSION@' !endif ######### # directories -- up from src/windows/scripts ######### !define ROOT_OWFS "..\..\.." !define OPTDIR "\cygwin\opt\owfs" !define ROOT_HOME "${ROOT_OWFS}\..\.." !define ROOT_CYGWIN "${ROOT_HOME}\.." !define ROOT_OWNET "$(ROOT_OWFS)\module\ownet" ######### # Install settings ######### SetCompressor /SOLID lzma SetOverwrite ifnewer CRCCheck on ######### # Name ######### Name "OWFS" Caption "OWFS (One Wire Filesystem) ${VERSION} Setup" BrandingText "One-Wire Filesystem http://www.owfs.org" Icon "owfs.ico" UninstallIcon "unowfs.ico" ######### # Location ######### # The default installation directory InstallDir $PROGRAMFILES\OWFS # Result !ifdef OUTFILE OutFile "${OUTFILE}" !else OutFile ${ROOT_OWFS}\owfs_${VERSION}.exe !endif InstType "Programs" InstType "Source" ######### # Pages ######### !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${ROOT_OWFS}\COPYING" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH !define MUI_ABORTWARNING !insertmacro MUI_LANGUAGE "English" ######### # Kill running programs ######### Section "Terminate currently running OWFS programs" ExecWait '"tskill" "owdir"' ExecWait '"tskill" "owread"' ExecWait '"tskill" "owwrite"' ExecWait '"tskill" "owpresent"' ExecWait '"tskill" "owserver"' ExecWait '"tskill" "owhttpd"' ExecWait '"tskill" "owftpd"' SectionEnd ######### # Files ######### Section "OWFS program files" Bins SetDetailsPrint textonly DetailPrint "Installing OWFS Program Files..." SetDetailsPrint listonly SectionIn 1 2 RO SetOutPath $INSTDIR File /r "${OPTDIR}\*" File "*.ico" WriteUninstaller "$INSTDIR\owfs_uninstall.exe" WriteRegStr HKLM "Software\OWFS\Version" "String Value" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OWFS" "DisplayName" "OWFS -- One Wire Filesystem" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OWFS" "UninstallString" '"$INSTDIR\owfs_uninstall.exe"' SetOutPath $INSTDIR\ownet File ..\..\..\module\ownet\python\ownet\* WriteRegStr HKLM "Software\Python\PythonCore\2.5\PythonPath\OWFS" "" '"$INSTDIR"' WriteRegStr HKLM "Software\Python\PythonCore\2.4.4\PythonPath\OWFS" "" '"$INSTDIR"' SectionEnd ######### # Start Menu ######### Section "Add to Start menu" SectionIn 1 CreateDirectory "$SMPROGRAMS\OWFS" Delete "$SMPROGRAMS\OWFS\owserver.lnk" Delete "$SMPROGRAMS\OWFS\owftpd.lnk" Delete "$SMPROGRAMS\OWFS\owhttpd.lnk" Delete "$SMPROGRAMS\OWFS\owfs_uninstall.lnk" CreateShortcut "$SMPROGRAMS\OWFS\owserver.lnk" "$INSTDIR\bin\owserver.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} Server/Multiplexor" CreateShortcut "$SMPROGRAMS\OWFS\owftpd.lnk" "$INSTDIR\bin\owftpd.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} FTP server" CreateShortcut "$SMPROGRAMS\OWFS\owhttpd.lnk" "$INSTDIR\bin\owhttpd.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} Web server" CreateShortcut "$SMPROGRAMS\OWFS\owfs_uninstall.lnk" "$INSTDIR\owfs_uninstall.exe" "" "$INSTDIR\unowfs.ico" "" "" "" "Uninstall OWFS ${VERSION}" SectionEnd ######### # Desktop ######### Section "Add to Desktop" SectionIn 1 Delete "$DESKTOP\owserver.lnk" Delete "$DESKTOP\owftpd.lnk" Delete "$DESKTOP\owhttpd.lnk" Delete "$DESKTOP\owfs_uninstall.lnk" CreateShortcut "$DESKTOP\owserver.lnk" "$INSTDIR\bin\owserver.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} Server/Multiplexor" CreateShortcut "$DESKTOP\owftpd.lnk" "$INSTDIR\bin\owftpd.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} FTP server" CreateShortcut "$DESKTOP\owhttpd.lnk" "$INSTDIR\bin\owhttpd.exe" "" "$INSTDIR\owfs.ico" "" "" "" "OWFS ${VERSION} Web server" CreateShortcut "$DESKTOP\owfs_uninstall.lnk" "$INSTDIR\owfs_uninstall.exe" "" "$INSTDIR\unowfs.ico" "" "" "" "Uninstall OWFS ${VERSION}" SectionEnd ######### # USB driver ######### Section "USB (Universal Serial Bus) driver installation" SectionIn 1 MessageBox MB_OK "Going to Sourceforge for libusb-win32 installation." ExecShell "open" "http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/0.1.12.2/libusb-win32-filter-bin-0.1.12.2.exe/download" ExecWait 'rundll32 libusb0.dll,usb_install_driver_np_rundll $INSTDIR\driver\ds9490.inf' SectionEnd ######### # Bonjour ######### Section "Bonjour (zeroconf autodiscovery) installation" SectionIn 1 MessageBox MB_OK "Going to Apple site for Bonjour installation." ExecShell "open" "http://developer.apple.com/networking/bonjour/download/" SectionEnd ######### # Source ######### Section "OWFS source files" Source SectionIn 2 MessageBox MB_OK "Going to Sourceforge OWFS site for source file installation." ExecShell "open" "http://sourceforge.net/project/downloading.php?group_id=85502&filename=owfs-${VERSION}.zip" SectionEnd Section "USB Support Installation" MessageBox MB_OK "Going to LibUsb-Win32 site for installation." ExecShell "open" "http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/0.1.12.2/libusb-win32-src-0.1.12.2.tar.gz/download" SectionEnd Section "Cygwin Installation" MessageBox MB_OK "Going to RedHat's Cygwin site for installation." ExecShell "open" "http://www.cygwin.com" SectionEnd Section "Uninstall" RMDir /r /REBOOTOK $INSTDIR RMDir /r /REBOOTOK "$SMPROGRAMS\OWFS" Delete "$DESKTOP\owserver.lnk" Delete "$DESKTOP\owftpd.lnk" Delete "$DESKTOP\owhttpd.lnk" Delete "$DESKTOP\owfs_uninstall.lnk" DeleteRegKey HKLM "Software\OWFS\Version" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OWFS" DeleteRegKey HKLM "Software\Python\PythonCore\2.5\PythonPath\OWFS" DeleteRegKey HKLM "Software\Python\PythonCore\2.4.4\PythonPath\OWFS" SectionEnd owfs-2.8p15/src/scripts/windows/Makefile.am0000664000175000017500000000016611627516323015627 00000000000000 if HAVE_CYGWIN install-data-local: @INSTALL@ -d -m0755 ${DESTDIR}${bindir} endif clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/Makefile.in0000664000175000017500000005114511756250031012454 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include man rpm scripts all: all-recursive .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 src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/Makefile.am0000664000175000017500000000010410432627752012440 00000000000000SUBDIRS = include man rpm scripts clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/rpm/0000775000175000017500000000000011756315507011271 500000000000000owfs-2.8p15/src/rpm/owserver.conf0000664000175000017500000000005210440611660013715 00000000000000PORT[0]=3000 OPTIONS[0]="-d /dev/ttyS103" owfs-2.8p15/src/rpm/owserver.init0000775000175000017500000000242711104531457013751 00000000000000#!/bin/bash # # owserver Startup script for the 1-Wire networks # # chkconfig: - 94 06 # description: OWSERVER is a backend server (daemon) for 1-wire control # # config: /etc/sysconfig/owserver # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/owserver ]; then . /etc/sysconfig/owserver fi numfs=${#PORT[*]} if [ $numfs -eq 0 ]; then exit 0 fi lockfile=/var/lock/subsys/owserver owserver=/usr/sbin/owserver RETVAL=0 start() { echo -n $"Starting owserver: " i=0; n=0 while [ $n -lt $numfs ]; do port=${PORT[$i]} interface=${INTERFACE[$i]} options=${OPTIONS[$i]} if [ "$port" != "" ]; then $owserver -p $port $options >/dev/null RETVAL=$? [ $RETVAL = 0 ] || { echo_failure echo return $RETVAL } n=`expr $n + 1` fi i=`expr $i + 1` done echo_success echo touch ${lockfile} return 0 } stop() { echo -n $"Shutdown owserver: " killproc $owserver RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $owserver ;; restart) stop start ;; condrestart) if [ -f ${lockfile} ]; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL owfs-2.8p15/src/rpm/owfs.conf0000664000175000017500000000006610410211465013020 00000000000000MOUNTPOINT[0]=/mnt/1wire OPTIONS[0]="-d /dev/ttyS100" owfs-2.8p15/src/rpm/owhttpd.init0000775000175000017500000000236311104531457013565 00000000000000#!/bin/bash # # owhttpd Startup script for the 1-Wire networks # # chkconfig: - 95 05 # description: OWHTTPD is a HTTP daemon providing access to 1-Wire networks. # # config: /etc/sysconfig/owhttpd # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/owhttpd ]; then . /etc/sysconfig/owhttpd fi numfs=${#PORT[*]} if [ $numfs -eq 0 ]; then exit 0 fi lockfile=/var/lock/subsys/owhttpd owhttpd=/usr/sbin/owhttpd RETVAL=0 start() { echo -n $"Starting owhttpd: " i=0; n=0 while [ $n -lt $numfs ]; do port=${PORT[$i]} options=${OPTIONS[$i]} if [ "$port" != "" ]; then $owhttpd -p $port $options >/dev/null RETVAL=$? [ $RETVAL = 0 ] || { echo_failure echo return $RETVAL } n=`expr $n + 1` fi i=`expr $i + 1` done echo_success echo touch ${lockfile} return 0 } stop() { echo -n $"Shutdown owhttpd: " killproc $owhttpd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $owhttpd ;; restart) stop start ;; condrestart) if [ -f ${lockfile} ]; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL owfs-2.8p15/src/rpm/owftpd.conf0000664000175000017500000000006010440611660013343 00000000000000PORT[0]=0.0.0.0:21 OPTIONS[0]="-d /dev/ttyS102" owfs-2.8p15/src/rpm/owhttpd.conf0000664000175000017500000000005210410211465013526 00000000000000PORT[0]=3001 OPTIONS[0]="-d /dev/ttyS101" owfs-2.8p15/src/rpm/Makefile.in0000664000175000017500000003352711756250031013256 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.6 2006/09/30 19:40:05 alfille Exp $ 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@ target_triplet = @target@ subdir = src/rpm DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/owfs.spec.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = owfs.spec CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = owfs.conf owfs.init \ owserver.conf owserver.init \ owhttpd.conf owhttpd.init \ owftpd.conf owftpd.init 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 src/rpm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/rpm/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): owfs.spec: $(top_builddir)/config.status $(srcdir)/owfs.spec.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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/src/rpm/owftpd.init0000775000175000017500000000234511104531457013377 00000000000000#!/bin/bash # # owftpd Startup script for the 1-Wire networks # # chkconfig: - 95 05 # description: OWFTPD is a FTP daemon providing access to 1-Wire networks. # # config: /etc/sysconfig/owftpd # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/owftpd ]; then . /etc/sysconfig/owftpd fi numfs=${#PORT[*]} if [ $numfs -eq 0 ]; then exit 0 fi lockfile=/var/lock/subsys/owftpd owftpd=/usr/sbin/owftpd RETVAL=0 start() { echo -n $"Starting owftpd: " i=0; n=0 while [ $n -lt $numfs ]; do port=${PORT[$i]} options=${OPTIONS[$i]} if [ "$port" != "" ]; then $owftpd -p $port $options >/dev/null RETVAL=$? [ $RETVAL = 0 ] || { echo_failure echo return $RETVAL } n=`expr $n + 1` fi i=`expr $i + 1` done echo_success echo touch ${lockfile} return 0 } stop() { echo -n $"Shutdown owftpd: " killproc $owftpd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $owftpd ;; restart) stop start ;; condrestart) if [ -f ${lockfile} ]; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL owfs-2.8p15/src/rpm/owfs.init0000775000175000017500000000342511104531457013052 00000000000000#!/bin/bash # # owfs Startup script for the 1-Wire networks # # chkconfig: - 95 05 # description: OWFS is a userspace virtual filesystem providing access to 1-Wire networks. # # config: /etc/sysconfig/owfs # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/owfs ]; then . /etc/sysconfig/owfs fi numfs=${#MOUNTPOINT[*]} if [ $numfs -eq 0 ]; then exit 0 fi lockfile=/var/lock/subsys/owfs owfs=/usr/sbin/owfs RETVAL=0 start() { echo -n $"Mounting One Wire file system: " /sbin/modprobe -q fuse i=0; n=0 while [ $n -lt $numfs ]; do mountpoint=${MOUNTPOINT[$i]} options=${OPTIONS[$i]} if [ "$mountpoint" != "" ]; then [ -d $mountpoint ] || mkdir -p $mountpoint $owfs $options $mountpoint >/dev/null RETVAL=$? [ $RETVAL = 0 ] || { echo_failure echo return $RETVAL } n=`expr $n + 1` fi i=`expr $i + 1` done echo_success echo touch ${lockfile} return 0 } stop() { echo -n $"Umounting One Wire file system: " # i=0; n=0 # while [ $n -lt $numfs ]; do # mountpoint=${MOUNTPOINT[$i]} # interface=${INTERFACE[$i]} # options=${OPTIONS[$i]} # if [ "$mountpoint" != "" ]; then # /bin/umount $mountpoint # RETVAL=$? # [ $RETVAL = 0 ] || { # echo_failure # echo # return $RETVAL # } # n=`expr $n + 1` # fi # i=`expr $i + 1` # done killproc $owfs RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f ${lockfile} return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) for mountpoint in ${MOUNTPOINT[@]}; do /bin/mount | /bin/grep $mountpoint done status $owfs ;; restart) stop start ;; condrestart) if [ -f ${lockfile} ]; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL owfs-2.8p15/src/rpm/owfs.spec.in0000664000175000017500000004143511461546354013456 00000000000000# Use --define 'cvs 1' on the command line to enable CVS version %{!?cvs:%define CVSVERSION %{nil}} %{?cvs:%define CVSVERSION %(echo "_cvs_`date +"%Y%m%d"`")} %{!?cvs:%define CVS 0} %{?cvs:%define CVS 1} %define build_fs 1 %define build_httpd 1 %define build_capi 1 %define build_ownet 1 %define build_ftpd 1 %define build_server 1 %define build_perl 1 %define build_python 1 %define build_php 1 %define build_side 0 %define build_tap 1 %define build_mon 1 %define build_tcl 1 %define build_shell 1 %define build_man 1 %define debug_package %{nil} # include some mandriva defines # Look at http://wiki.mandriva.com/en/Policies/Release_Tag %define rel 3 # define the mkrel macro if it is not already defined # %{?!mkrel:%define mkrel(c:) %{-c:0.%{-c''}.}%{!?''with''unstable:%(perl -e '$''="%{1}";m/(.\'''\\D\+)?(\\d+)$/;$rel=${2}-1;re;print "$1$rel";').%{?subrel:%subrel}%{!?subrel:1}.%{?distversion:%distversion}}%{?''with_unstable:%{1}}%{?distsuffix:%distsuffix}%{?!distsuffix:mdk}} # For mandriva mkrel could be used. It doesn't work on older distributions though. # the define above fails with different syntax errors on FC1 atleast. #%define release %mkrel %rel %define release 1 %if %{build_tcl} %define tcl_pkgpath %(echo 'puts [lindex $tcl_pkgPath 0]' | %{_bindir}/tclsh) %endif Name: owfs Version: @VERSION@%{?cvs:%{CVSVERSION}} Release: %release Summary: 1-Wire Virtual File System Source: %{name}-%{version}.tar.gz #Copyright: GPL License: GPL Group: System Environment/Libraries URL: http://sourceforge.net/projects/owfs Buildroot: %{_tmppath}/%{name}-root Prefix: /usr Requires: %{name}-libs = %{version}-%{release} Packager: Serg Oskin Summary: Virtual filesystem on top of %{name}-libs providing access to 1-Wire networks. %description OWFS is a userspace virtual filesystem providing access to 1-Wire networks. %package libs Summary: Core library providing base functions to other OWFS modules. Group: System Environment/Libraries Requires: libusb >= 0.1.6 BuildRequires: automake autoconf libtool BuildRequires: libusb-devel %description libs %{name}-libs is a core library providing base functions to other OWFS modules. %if %{build_capi} %package capi Summary: C-API to develop third-part applications which access 1-Wire networks. Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release} %description capi %{name}-capi library on top of libow providing an easy API to develop third-part applications to access to 1-Wire networks. %endif %if %{build_ownet} %package ownet Summary: C-API to develop third-part applications which access 1-Wire networks. Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release} %description ownet %{name}-ownet library provids an easy API to develop third-part applications to access to 1-Wire networks. It doesn't depend on owlib, and only supports remote-server connections. This library doesn't include any 1-wire adapter support, except server connections. %endif %if %{build_fs} %package fs Summary: Virtual filesystem on top of %{name}-libs providing access to 1-Wire networks. Group: System Environment/Daemon Requires: %{name}-libs = %{version}-%{release}, fuse >= 1.0 #BuildRequires: fuse-devel >= 1.0 %description fs %{name}-fs is a virtual filesystem on top of %{name}-libs providing access to 1-Wire networks. %endif %if %{build_httpd} %package httpd Summary: HTTP daemon providing access to 1-Wire networks. Group: System Environment/Daemon Requires: %{name}-libs = %{version}-%{release} %description httpd %{name}-httpd is a HTTP daemon on top of %{name} providing access to 1-Wire networks. %endif %if %{build_ftpd} %package ftpd Summary: FTP daemon providing access to 1-Wire networks. Group: System Environment/Daemon Requires: %{name}-libs = %{version}-%{release} %description ftpd %{name}-ftpd is a FTP daemon on top of %{name} providing access to 1-Wire networks. %endif %if %{build_server} %package server Summary: Backend server (daemon) for 1-wire control Group: System Environment/Daemon Requires: %{name}-libs = %{version}-%{release} %description server %{name}-server is the backend component of the OWFS 1-wire bus control system. owserver arbitrates access to the bus from multiple client processes. The physical bus is usually connected to a serial or USB port, and other processes connect to owserver over network sockets (tcp port). Communication can be local or over a network. %endif %if %{build_side} %package side Summary: Packet sniffer for the owserver protocol Group: System Environment/Daemon Requires: tcl >= 8.1 %description side %{name}-side is a packet sniffer for the owserver protocol %endif %if %{build_tap} %package tap Summary: Packet sniffer for the owserver protocol Group: System Environment/Daemon Requires: tcl >= 8.1 %description tap %{name}-tap is a packet sniffer for the owserver protocol %endif %if %{build_mon} %package mon Summary: Statistics and settings monitor for owserver Group: System Environment/Daemon Requires: tcl >= 8.1 %description mon %{name}-mon is a graphical monitor of owserver\'s status %endif %if %{build_perl} %package perl Summary: %{name}-perl is a Perl interface for the 1-wire filesystem Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release}, perl BuildRequires: swig # FC1 doesn't have perl-devel, but should be added %description perl %{name}-perl is a Perl interface for the 1-wire filesystem %endif %if %{build_python} %package python Summary: %{name}-python is a python interface for the 1-wire filesystem Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release}, python >= 2.0 BuildRequires: python-devel >= 2.0, swig %description python %{name}-python is a Python interface for the 1-wire filesystem %endif %if %{build_php} %package php Summary: %{name}-php is a php interface for the 1-wire filesystem Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release}, php >= 4.3.0 BuildRequires: php-devel >= 4.3.0, swig # FC1 doesn't have php-cli >= 4.3.0, but should be added %description php %{name}-php is a php interface for the 1-wire filesystem %endif %if %{build_tcl} %package tcl Summary: %{name}-tcl is a Tcl interface for the 1-wire filesystem Group: System Environment/Libraries Requires: %{name}-libs = %{version}-%{release}, tcl >= 8.1 BuildRequires: tcl-devel >= 8.1 %description tcl %{name}-tcl is a Tcl interface for the 1-wire filesystem %endif %if %{build_shell} %package shell Summary: %{name}-shell gives light weight shell access to owserver and the 1-wire filesystem Group: Applications/System %description shell %{name}-shell is 5 small programs to easily access owserver (and thus the 1-wire system) from shell scripts. owdir, owread, owwrite, owget and owpresent. %endif %if %{build_man} %package man Summary: %{name}-man installs man pages for all the OWFS programs 1-wire devices. Group: Documentation %description man %{name}-man installs man pages for all the OWFS progams (owfs, owhtttpd, owserver, owftpd, owshell, owperl, owtcl) and also all the supported 1-wire devices. %endif %clean rm -rf $RPM_BUILD_ROOT %prep %if %{CVS} == 0 %setup %else %setup -n owfs-@VERSION@ %endif %build aclocal libtoolize -f -c autoheader autoconf automake -a -c ./configure \ --prefix=%{prefix} \ --libdir=%{_libdir} \ --disable-static \ --enable-usb \ --enable-cache \ --enable-mt \ %if %{build_fs} --enable-owfs \ %else --disable-owfs \ %endif %if %{build_httpd} --enable-owhttpd \ %else --disable-owhttpd \ %endif %if %{build_capi} --enable-owcapi \ %else --disable-owcapi \ %endif %if %{build_ownet} --enable-ownetlib \ %else --disable-ownetlib \ %endif %if %{build_ftpd} --enable-owftpd \ %else --disable-owftpd \ %endif %if %{build_server} --enable-owserver \ %else --disable-owserver \ %endif %if %{build_side} --enable-owside \ %else --disable-owside \ %endif %if %{build_tap} --enable-owtap \ %else --disable-owtap \ %endif %if %{build_mon} --enable-owmon \ %else --disable-owmon \ %endif %if %{build_perl} --enable-owperl \ %else --disable-owperl \ %endif %if %{build_python} --enable-owpython \ %else --disable-owpython \ %endif %if %{build_php} --enable-owphp \ %else --disable-owphp \ %endif %if %{build_tcl} --enable-owtcl \ %else --disable-owtcl \ %endif make #make check %install case "$RPM_BUILD_ROOT" in *-root) rm -rf $RPM_BUILD_ROOT ;; esac make install \ DESTDIR=$RPM_BUILD_ROOT #pushd src/man #make install-so-man #popd install -d -m 755 $RPM_BUILD_ROOT%{prefix}/include/owfs mv -f $RPM_BUILD_ROOT%{prefix}/include/*.h $RPM_BUILD_ROOT%{prefix}/include/owfs # man-files already installed at correct place on FC7 if [ -d $RPM_BUILD_ROOT%{prefix}/man ]; then install -d -m 755 $RPM_BUILD_ROOT%{_mandir} install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1 mv -f $RPM_BUILD_ROOT%{prefix}/man/man1/* $RPM_BUILD_ROOT%{_mandir}/man1/ install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man3 mv -f $RPM_BUILD_ROOT%{prefix}/man/man3/* $RPM_BUILD_ROOT%{_mandir}/man3/ install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man5 mv -f $RPM_BUILD_ROOT%{prefix}/man/man5/* $RPM_BUILD_ROOT%{_mandir}/man5/ install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/mann mv -f $RPM_BUILD_ROOT%{prefix}/man/mann/* $RPM_BUILD_ROOT%{_mandir}/mann/ rm -rf $RPM_BUILD_ROOT%{prefix}/man fi rm -f $RPM_BUILD_ROOT%{_mandir}/man1/*.1so $RPM_BUILD_ROOT%{_mandir}/man1/*.1so.gz rm -f $RPM_BUILD_ROOT%{_mandir}/man3/*.3so $RPM_BUILD_ROOT%{_mandir}/man3/*.3so.gz rm -f $RPM_BUILD_ROOT%{_mandir}/man5/*.5so $RPM_BUILD_ROOT%{_mandir}/man5/*.5so.gz rm -f $RPM_BUILD_ROOT%{_mandir}/mann/*.nso $RPM_BUILD_ROOT%{_mandir}/mann/*.nso.gz %if %{build_fs} install -D -m 644 src/rpm/owfs.conf $RPM_BUILD_ROOT/etc/sysconfig/owfs install -D -m 755 src/rpm/owfs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/owfs install -d -m 755 $RPM_BUILD_ROOT%{prefix}/sbin mv -f $RPM_BUILD_ROOT%{prefix}/bin/owfs $RPM_BUILD_ROOT%{prefix}/sbin %endif %if %{build_httpd} install -D -m 755 src/rpm/owhttpd.conf $RPM_BUILD_ROOT/etc/sysconfig/owhttpd install -D -m 644 src/rpm/owhttpd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/owhttpd install -d -m 755 $RPM_BUILD_ROOT%{prefix}/sbin mv -f $RPM_BUILD_ROOT%{prefix}/bin/owhttpd $RPM_BUILD_ROOT%{prefix}/sbin %endif %if %{build_ftpd} install -D -m 644 src/rpm/owftpd.conf $RPM_BUILD_ROOT/etc/sysconfig/owftpd install -D -m 755 src/rpm/owftpd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/owftpd install -d -m 755 $RPM_BUILD_ROOT%{prefix}/sbin mv -f $RPM_BUILD_ROOT%{prefix}/bin/owftpd $RPM_BUILD_ROOT%{prefix}/sbin %endif %if %{build_server} install -D -m 644 src/rpm/owserver.conf $RPM_BUILD_ROOT/etc/sysconfig/owserver install -D -m 755 src/rpm/owserver.init $RPM_BUILD_ROOT/etc/rc.d/init.d/owserver install -d -m 755 $RPM_BUILD_ROOT%{prefix}/sbin mv -f $RPM_BUILD_ROOT%{prefix}/bin/owserver $RPM_BUILD_ROOT%{prefix}/sbin %endif %if %{build_side} %endif %if %{build_tap} %endif %if %{build_mon} %endif %if %{build_perl} %define perl_archlib %(eval "`@PERL@ -V:installarchlib`"; echo $installarchlib) %define perl_sitearch %(eval "`@PERL@ -V:installsitearch`"; echo $installsitearch) %define perl_sitelib %(eval "`@PERL@ -V:installsitelib`"; echo $installsitelib) %define perl_siteman3dir %(eval "`@PERL@ -V:siteman3dir`"; echo $siteman3dir) rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod rm -f $RPM_BUILD_ROOT%{perl_sitearch}/auto/OW/.packlist rm -f $RPM_BUILD_ROOT%{perl_sitearch}/auto/OWNet/.packlist %endif %if %{build_python} %define python_sitedir %(@PYTHON@ -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1)" 2>/dev/null|| echo @PYSITEDIR@) # Remove OpenSUSE info files rm -f $RPM_BUILD_ROOT%{python_sitedir}/ow-*-info rm -f $RPM_BUILD_ROOT%{python_sitedir}/ownet-*-info %endif %if %{build_php} #don't use the PHPLIBDIR here... assume php-config works instead. %define php_extdir %(php-config --extension-dir 2>/dev/null || php5-config --extension-dir 2>/dev/null || php4-config --extension-dir 2>/dev/null || echo @PHPLIBDIR@) #don't use the PHPLIBDIR here... assume php-config works instead. rm -f $RPM_BUILD_ROOT%{php_extdir}/libowphp.la $RPM_BUILD_ROOT%{php_extdir}/libowphp.a %endif %if %{build_tcl} rm -f $RPM_BUILD_ROOT%{_libdir}/owtcl-*/ow.la $RPM_BUILD_ROOT%{_libdir}/owtcl-*/ow.a %endif %post libs /sbin/ldconfig %postun libs /sbin/ldconfig %if %{build_capi} %post capi /sbin/ldconfig %postun capi /sbin/ldconfig %endif %if %{build_ownet} %post ownet /sbin/ldconfig %postun ownet /sbin/ldconfig %endif %if %{build_fs} %post fs /sbin/chkconfig --add owfs %preun fs if [ $1 = 0 ]; then /sbin/chkconfig --del owfs fi %endif %if %{build_httpd} %post httpd /sbin/chkconfig --add owhttpd %preun httpd if [ $1 = 0 ]; then /sbin/chkconfig --del owhttpd fi %endif %if %{build_ftpd} %post ftpd /sbin/chkconfig --add owftpd %preun ftpd if [ $1 = 0 ]; then /sbin/chkconfig --del owftpd fi %endif %if %{build_server} %post server /sbin/chkconfig --add owserver %preun server if [ $1 = 0 ]; then /sbin/chkconfig --del owserver fi %endif %files libs %defattr(-,root,root) %doc README NEWS INSTALL ChangeLog AUTHORS COPYING %{prefix}/include/owfs/owfs_config.h %{_libdir}/libow-*.so* %{_libdir}/libow.so %{_libdir}/libow.la %{_mandir}/man3/*.3.* %if %{build_capi} %files capi %defattr(-,root,root) %{prefix}/include/owfs/owcapi.h %{_libdir}/libowcapi-*.so* %{_libdir}/libowcapi.so %{_libdir}/libowcapi.la %{_mandir}/man1/*owcapi.1.* %endif %if %{build_ownet} %files ownet %defattr(-,root,root) %{prefix}/include/owfs/ownetapi.h %{_libdir}/libownet-*.so* %{_libdir}/libownet.so %{_libdir}/libownet.la %{_mandir}/man1/*ownet*.1.* %endif %if %{build_fs} %files fs %defattr(-,root,root) %attr(0755,root,root) /etc/rc.d/init.d/owfs %config /etc/sysconfig/owfs %{prefix}/sbin/owfs %{_mandir}/man1/owfs.1.* %endif %if %{build_httpd} %files httpd %defattr(-,root,root) %attr(0755,root,root) /etc/rc.d/init.d/owhttpd %config /etc/sysconfig/owhttpd %{prefix}/sbin/owhttpd %{_mandir}/man1/owhttpd.1.* %endif %if %{build_shell} %files shell %defattr(-,root,root) %{prefix}/bin/owdir %{prefix}/bin/owread %{prefix}/bin/owwrite %{prefix}/bin/owget %{prefix}/bin/owpresent %{_mandir}/man1/owshell.1.* %{_mandir}/man1/owdir.1.* %{_mandir}/man1/owread.1.* %{_mandir}/man1/owget.1.* %{_mandir}/man1/owpresent.1.* %if %{build_php} # include ownet-php (it's a duplicate since it's in owfs-php too) %{prefix}/bin/ownet.php %endif %if %{build_python} #%dir %{python_sitedir}/ow #%{python_sitedir}/ow/__init__.py* #%{python_sitedir}/ow/_OW.so # include ownet-python (it's a duplicate since it's in owfs-python too) %dir %{python_sitedir}/ownet %{python_sitedir}/ownet/__init__.py*/ %{python_sitedir}/ownet/connection.py* %endif %endif %if %{build_man} %files man %defattr(-,root,root) %{_mandir}/man1/*.1.* #%{_mandir}/man1/*.1so %{_mandir}/man3/*.3.* #%{_mandir}/man3/*.3so %{_mandir}/man5/*.5.* #%{_mandir}/man5/*.5so %{_mandir}/mann/*.n.* #%{_mandir}/mann/*.nso %endif %if %{build_ftpd} %files ftpd %defattr(-,root,root) %attr(0755,root,root) /etc/rc.d/init.d/owftpd %config /etc/sysconfig/owftpd %{prefix}/sbin/owftpd %{_mandir}/man1/owftpd.1.* %endif %if %{build_server} %files server %defattr(-,root,root) %attr(0755,root,root) /etc/rc.d/init.d/owserver %config /etc/sysconfig/owserver %{prefix}/sbin/owserver %{_mandir}/man1/owserver.1.* %endif %if %{build_side} %files side %defattr(-,root,root) %{prefix}/bin/owside #%{_mandir}/man1/owside.1.* %endif %if %{build_tap} %files tap %defattr(-,root,root) %{prefix}/bin/owtap %{_mandir}/man1/owtap.1.* %endif %if %{build_mon} %files mon %defattr(-,root,root) %{prefix}/bin/owmon #%{_mandir}/man1/owmon.1.* %endif %if %{build_perl} %files perl %defattr(-,root,root) %dir %{perl_sitearch}/auto/OW %{perl_sitearch}/auto/OW/OW.* %{perl_sitearch}/OW.pm %{perl_sitelib}/OWNet.pm %{perl_siteman3dir}/OWNet.3* %endif %if %{build_python} %files python %defattr(-,root,root) %dir %{python_sitedir}/ow %{python_sitedir}/ow/__init__.py* %{python_sitedir}/ow/_OW.so #OpenSUSE info file #%{python_sitedir}/ow-*info %dir %{python_sitedir}/ownet %{python_sitedir}/ownet/__init__.py* %{python_sitedir}/ownet/connection.py* #OpenSUSE info file #%{python_sitedir}/ownet-*info %endif %if %{build_php} %files php %defattr(-,root,root) %dir %{php_extdir} %{php_extdir}/libowphp.so* %{prefix}/bin/ownet.php %endif %if %{build_tcl} %files tcl %defattr(-,root,root) %dir %{tcl_pkgpath}/owtcl-* %{tcl_pkgpath}/owtcl-*/* # ow-*.so ow.so ow.tcl pkgIndex.tcl %{_mandir}/mann/owtcl.n.* %endif %changelog * Sat Nov 15 2008 Serg Oskin - Build pkgs from released and CVS sources. - Correct TCL install path * Tue Jan 19 2008 Christian Magnusson - x86_64 support, tested on i386 and x86_64 * Tue Jan 15 2008 Serg Oskin - no scripts for owshell - x86_64 support (Not fully tested) * Sat Sep 30 2006 Paul Alfille - added shell programs, removed nfsd * Thu Jan 13 2005 Serg Oskin - reorganized * Sun Oct 24 2004 Serg Oskin - recreated * Wed Sep 24 2003 Vadim Tkachenko - Initial take at RPM build owfs-2.8p15/src/rpm/Makefile.am0000664000175000017500000000032610507544025013236 00000000000000# $Id: Makefile.am,v 1.6 2006/09/30 19:40:05 alfille Exp $ EXTRA_DIST = owfs.conf owfs.init \ owserver.conf owserver.init \ owhttpd.conf owhttpd.init \ owftpd.conf owftpd.init clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/src/include/0000775000175000017500000000000011756315507012116 500000000000000owfs-2.8p15/src/include/config.h.in0000664000175000017500000002251311756250045014057 00000000000000/* src/include/config.h.in. Generated from configure.ac by autoheader. */ #ifndef OWCONFIG_H #define OWCONFIG_H /* Define to 1 if you have the `accept' function. */ #undef HAVE_ACCEPT /* Have AF_NETLINK in socket.h */ #undef HAVE_AF_NETLINK /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_ASM_TYPES_H /* Broken glibc implementations use __ss_family instead of ss_family. */ #undef HAVE_BROKEN_SS_FAMILY /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if you have dlopen */ #undef HAVE_DLOPEN /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FEATURES_H /* Define to 1 if you have the header file. */ #undef HAVE_FEATURE_TESTS_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `freeaddrinfo' function. */ #undef HAVE_FREEADDRINFO /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `gethostbyaddr_r' function. */ #undef HAVE_GETHOSTBYADDR_R /* Define to 1 if you have the `gethostbyname2_r' function. */ #undef HAVE_GETHOSTBYNAME2_R /* Define to 1 if you have the `gethostbyname_r' function. */ #undef HAVE_GETHOSTBYNAME_R /* Define to 1 if you have the `getline' function. */ #undef HAVE_GETLINE /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `getservbyname_r' function. */ #undef HAVE_GETSERVBYNAME_R /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `inet_ntop' function. */ #undef HAVE_INET_NTOP /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TYPES_H /* Define if you have lrint */ #undef HAVE_LRINT /* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define if you have nanosleep */ #undef HAVE_NANOSLEEP /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_RESOLV_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the header file. */ #undef HAVE_SEMAPHORE_H /* Define to 1 if you have the `sem_timedwait' function. */ #undef HAVE_SEM_TIMEDWAIT /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #undef HAVE_STRUCT_SOCKADDR_STORAGE /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MKDEV_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UIO_H /* Define to 1 if you have the `tdelete' function. */ #undef HAVE_TDELETE /* Define to 1 if you have the `tdestroy' function. */ #undef HAVE_TDESTROY /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the `tfind' function. */ #undef HAVE_TFIND /* Define to 1 if you have the `tsearch' function. */ #undef HAVE_TSEARCH /* Define to 1 if you have the `twalk' function. */ #undef HAVE_TWALK /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usb_interrupt_read' function. */ #undef HAVE_USB_INTERRUPT_READ /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `vsprintf' function. */ #undef HAVE_VSPRINTF /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the `writev' function. */ #undef HAVE_WRITEV /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define if ipv6 support is present and available. */ #undef IPV6 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your system has no in6addr_any. */ #undef NO_IN6ADDR_ANY /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to the type of arg 1 for `select'. */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for `select'. */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 /* Define to 1 if sockaddr_in has a 'sin_len' member. */ #undef SOCKADDR_IN_HAS_LEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if string.h may be included along with strings.h */ #undef STRING_WITH_STRINGS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define on Darwin to activate all library features */ #undef _DARWIN_C_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* If we don't have a real socklen_t, unsigned int is good enough. */ #undef socklen_t /* Define as `fork' if `vfork' does not work. */ #undef vfork #endif owfs-2.8p15/src/include/Makefile.in0000664000175000017500000004447311756250031014105 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = src/include DIST_COMMON = $(owfsinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/owfs_config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = owfs_config.h CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(owfsincludedir)" HEADERS = $(owfsinclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ owfsincludedir = ${prefix}/include owfsinclude_HEADERS = owfs_config.h all: config.h $(MAKE) $(AM_MAKEFLAGS) 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 src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/include/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): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/include/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 owfs_config.h: $(top_builddir)/config.status $(srcdir)/owfs_config.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-owfsincludeHEADERS: $(owfsinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(owfsincludedir)" || $(MKDIR_P) "$(DESTDIR)$(owfsincludedir)" @list='$(owfsinclude_HEADERS)'; test -n "$(owfsincludedir)" || 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)$(owfsincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(owfsincludedir)" || exit $$?; \ done uninstall-owfsincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(owfsinclude_HEADERS)'; test -n "$(owfsincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(owfsincludedir)'; $(am__uninstall_files_from_dir) 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) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ 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: $(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) @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 $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(owfsincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-owfsincludeHEADERS 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: uninstall-owfsincludeHEADERS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic distclean-hdr \ 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-owfsincludeHEADERS \ 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 \ tags uninstall uninstall-am uninstall-owfsincludeHEADERS clean-generic: @RM@ -f *~ .*~ stamp-* # 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: owfs-2.8p15/src/include/owfs_config.h.in0000664000175000017500000000665711421224341015115 00000000000000/* $Id: owfs_config.h.in,v 1.29 2010/07/20 04:41:05 alfille Exp $ OW -- One-Wire filesystem Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- */ #ifndef OWFS_CONFIG_H #define OWFS_CONFIG_H /* This file describes the version and features of the owfs-installation. */ #define OWFS_VERSION "@VERSION@" #define OWFS_MAJOR "@VERSION_MAJOR@" #define OWFS_MINOR "@VERSION_MINOR@" #define OWFS_PATCHLEVEL "@VERSION_PATCHLEVEL@" #define OW_MT @OW_MT@ #define OW_ALLOC_DEBUG @OW_ALLOC_DEBUG@ #define OW_SHOW_TRAFFIC @OW_SHOW_TRAFFIC@ #define OW_CACHE @OW_CACHE@ #define OW_USB @OW_USB@ #define OW_PARPORT @OW_PARPORT@ #define OW_DEBUG @OW_DEBUG@ #define OW_TAI8570 @OW_TAI8570@ #define OW_HA7 @OW_HA7@ #define OW_W1 @OW_W1@ #define OW_I2C @OW_I2C@ #define OW_THERMOCOUPLE @OW_THERMOCOUPLE@ #define OW_ZERO @OW_ZERO@ #define OW_CYGWIN @OW_CYGWIN@ #define OW_DARWIN @OW_DARWIN@ #endif /* OWFS_CONFIG_H */ owfs-2.8p15/src/include/Makefile.am0000664000175000017500000000016110435061036014054 00000000000000owfsincludedir = ${prefix}/include owfsinclude_HEADERS = owfs_config.h clean-generic: @RM@ -f *~ .*~ stamp-* owfs-2.8p15/src/include/owfs_config.h0000664000175000017500000000635211756250044014512 00000000000000/* $Id: owfs_config.h.in,v 1.29 2010/07/20 04:41:05 alfille Exp $ OW -- One-Wire filesystem Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- */ #ifndef OWFS_CONFIG_H #define OWFS_CONFIG_H /* This file describes the version and features of the owfs-installation. */ #define OWFS_VERSION "2.8p15" #define OWFS_MAJOR "2" #define OWFS_MINOR "8" #define OWFS_PATCHLEVEL "15" #define OW_MT 1 #define OW_ALLOC_DEBUG 1 #define OW_SHOW_TRAFFIC 0 #define OW_CACHE 1 #define OW_USB 1 #define OW_PARPORT 1 #define OW_DEBUG 1 #define OW_TAI8570 1 #define OW_HA7 1 #define OW_W1 1 #define OW_I2C 1 #define OW_THERMOCOUPLE 1 #define OW_ZERO 1 #define OW_CYGWIN 0 #define OW_DARWIN 0 #endif /* OWFS_CONFIG_H */ owfs-2.8p15/Makefile.in0000664000175000017500000007222311756250031011665 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ $(top_srcdir)/module/owcapi/src/example++/Makefile.in \ $(top_srcdir)/module/owcapi/src/example/Makefile.in \ $(top_srcdir)/module/ownet/c/src/example/Makefile.in \ $(top_srcdir)/module/ownet/php/examples/ownet_example.php.in \ $(top_srcdir)/module/swig/perl5/OW/Makefile.linux.in \ $(top_srcdir)/module/swig/perl5/OW/Makefile.osx.in \ $(top_srcdir)/module/swig/php/example/load_php_OW.php.in \ AUTHORS COPYING COPYING.LIB ChangeLog INSTALL NEWS TODO \ src/scripts/install/config.guess \ src/scripts/install/config.sub src/scripts/install/depcomp \ src/scripts/install/install-sh src/scripts/install/ltmain.sh \ src/scripts/install/missing src/scripts/install/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(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 = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = module/ownet/php/examples/ownet_example.php \ module/ownet/c/src/example/Makefile \ module/owcapi/src/example/Makefile \ module/owcapi/src/example++/Makefile \ module/swig/perl5/OW/Makefile.linux \ module/swig/perl5/OW/Makefile.osx \ module/swig/php/example/load_php_OW.php CONFIG_CLEAN_VPATH_FILES = 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 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 = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src module RPMMACROS = ${HOME}/.rpmmacros RPMDIR = ${HOME}/.rpm EXTRA_DIST = bootstrap acx_pthread.m4 all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --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): module/ownet/php/examples/ownet_example.php: $(top_builddir)/config.status $(top_srcdir)/module/ownet/php/examples/ownet_example.php.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/ownet/c/src/example/Makefile: $(top_builddir)/config.status $(top_srcdir)/module/ownet/c/src/example/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/owcapi/src/example/Makefile: $(top_builddir)/config.status $(top_srcdir)/module/owcapi/src/example/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/owcapi/src/example++/Makefile: $(top_builddir)/config.status $(top_srcdir)/module/owcapi/src/example++/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/swig/perl5/OW/Makefile.linux: $(top_builddir)/config.status $(top_srcdir)/module/swig/perl5/OW/Makefile.linux.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/swig/perl5/OW/Makefile.osx: $(top_builddir)/config.status $(top_srcdir)/module/swig/perl5/OW/Makefile.osx.in cd $(top_builddir) && $(SHELL) ./config.status $@ module/swig/php/example/load_php_OW.php: $(top_builddir)/config.status $(top_srcdir)/module/swig/php/example/load_php_OW.php.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 # 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) $(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) $(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) $(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) $(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 -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=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(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_OPT=$${XZ_OPT--e} 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) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(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.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod 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" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) 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-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic \ 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-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 clean-generic: @RM@ -f *~ .*~ distclean-generic: @RM@ -rf auto*cache preparerpm: dist @ if @TEST@ -z "@RPMBUILD@" ; then \ @ECHO@ "RPMBUILD binary not found, can't build RPM package"; \ exit 1; \ fi if @TEST@ ! -f ${RPMMACROS} ; then \ @ECHO@ "%_topdir ${RPMDIR}" > ${RPMMACROS}; \ mkdir -p ${RPMDIR}/SOURCES \ ${RPMDIR}/SPECS \ ${RPMDIR}/BUILD \ ${RPMDIR}/RPMS/i386 \ ${RPMDIR}/SRPMS ; \ fi cd src/rpm && ${MAKE} @PACKAGE@.spec @LN_S@ -f `pwd`/src/rpm/@PACKAGE@.spec ${RPMDIR}/SPECS/@PACKAGE@.spec rpm: preparerpm @LN_S@ -f `pwd`/@PACKAGE@-@VERSION@.tar.gz ${RPMDIR}/SOURCES/@PACKAGE@-@VERSION@.tar.gz cd ${RPMDIR}/SPECS && @RPMBUILD@ -ba @PACKAGE@.spec rpmcvs: preparerpm @LN_S@ -f `pwd`/@PACKAGE@-@VERSION@.tar.gz ${RPMDIR}/SOURCES/@PACKAGE@-@VERSION@_cvs_`date +"%Y%m%d"`.tar.gz cd ${RPMDIR}/SPECS && @RPMBUILD@ -ba @PACKAGE@.spec --define 'cvs 1' # 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: owfs-2.8p15/README0000664000175000017500000000261711651552637010513 00000000000000$Id: README,v 1.8 2007/12/11 02:01:50 alfille Exp $ See OWFS (http://www.owfs.org). This is OWFS -- the one-wire filesystem. 1-Wire is a data protocol stat allows simple connections to clever chips. The chips are uniquely addressed, and have a variety of types, including temperature and voltage sensors, switches, memory and clocks. The base functionality is in the owlib library. It includes adapter interface, chip interface, caching, statistics, inumeration and command line processing. owfs is the filesystem portion of the package. It depends on fuse: Basically, fuse (http://fuse.sourceforge.net) exposes filesystem calls in the appropriate directory to this program. This program then calls owlib to query and modify the 1-wire bus. owhttpd is a simple webserver exposing owlib. It does not need a kernel module and will probably run on a greater platform variety. owtcl, owphp, owperl, owpython are language bindings using the same backend and naming scheme as owfs owserver is a generic backend. It can be remote, and shared by several front ends. Your contribution is welcome. --- If you pulled from the cvs: ./bootstrap ./configure make install /opt/owfs/bin/owfs -d /dev/ttyS0 /mnt/1wire (for example) If you downloaded the source package: ./configure make install /opt/owfs/bin/owfs -d /dev/ttyS0 /mnt/1wire (for example) --- For more information: http://www.owfs.org owfs-2.8p15/ChangeLog0000664000175000017500000000127111651552637011400 000000000000002010-06-06 15:42 alfille * module/owlib/src/c/ow_write.c: Added some debug messages to write code. 2010-06-06 13:23 alfille * module/owlib/src/c/: ow_1921.c, ow_1923.c, ow_1963.c, ow_1977.c, ow_1991.c, ow_1993.c, ow_2404.c, ow_2406.c, ow_2423.c, ow_2430.c, ow_2433.c, ow_2436.c, ow_2438.c, ow_2450.c, ow_2502.c, ow_2505.c, ow_2760.c, ow_2804.c, ow_bae.c, ow_eds.c, ow_lcd.c: Organize memory and pages a little better in code for consistency 2010-06-06 13:08 alfille include/ow_filetype.h: Add fc_subdir for clarity ( does nothing since the directory itself isn't cached ) 2010-06-05 17:03 alfille Clean up some of the paged memory logic -- use an offset and the owfs-2.8p15/Makefile.am0000664000175000017500000000204611651552637011663 00000000000000SUBDIRS = src module RPMMACROS = ${HOME}/.rpmmacros RPMDIR = ${HOME}/.rpm EXTRA_DIST = bootstrap acx_pthread.m4 clean-generic: @RM@ -f *~ .*~ distclean-generic: @RM@ -rf auto*cache preparerpm: dist @ if @TEST@ -z "@RPMBUILD@" ; then \ @ECHO@ "RPMBUILD binary not found, can't build RPM package"; \ exit 1; \ fi if @TEST@ ! -f ${RPMMACROS} ; then \ @ECHO@ "%_topdir ${RPMDIR}" > ${RPMMACROS}; \ mkdir -p ${RPMDIR}/SOURCES \ ${RPMDIR}/SPECS \ ${RPMDIR}/BUILD \ ${RPMDIR}/RPMS/i386 \ ${RPMDIR}/SRPMS ; \ fi cd src/rpm && ${MAKE} @PACKAGE@.spec @LN_S@ -f `pwd`/src/rpm/@PACKAGE@.spec ${RPMDIR}/SPECS/@PACKAGE@.spec rpm: preparerpm @LN_S@ -f `pwd`/@PACKAGE@-@VERSION@.tar.gz ${RPMDIR}/SOURCES/@PACKAGE@-@VERSION@.tar.gz cd ${RPMDIR}/SPECS && @RPMBUILD@ -ba @PACKAGE@.spec rpmcvs: preparerpm @LN_S@ -f `pwd`/@PACKAGE@-@VERSION@.tar.gz ${RPMDIR}/SOURCES/@PACKAGE@-@VERSION@_cvs_`date +"%Y%m%d"`.tar.gz cd ${RPMDIR}/SPECS && @RPMBUILD@ -ba @PACKAGE@.spec --define 'cvs 1' owfs-2.8p15/acx_pthread.m40000664000175000017500000002237411665162022012347 00000000000000dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl @summary figure out how to build C programs using POSIX threads dnl dnl This macro figures out how to build C programs using POSIX threads. dnl It sets the PTHREAD_LIBS output variable to the threads library and dnl linker flags, and the PTHREAD_CFLAGS output variable to any special dnl C compiler flags that are needed. (The user can also force certain dnl compiler flags/libs to be tested by setting these environment dnl variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl NOTE: You are assumed to not only compile your program with these dnl flags, but also link it with them as well. e.g. you should link dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS dnl $LIBS dnl dnl If you are only building threads programs, you may wish to use dnl these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the dnl default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, or dnl if you have any other suggestions or comments. This macro was based dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. dnl We are also grateful for the helpful feedback of numerous users. dnl dnl @category InstalledPackages dnl @author Steven G. Johnson dnl @version 2006-05-29 dnl @license GPLWithACException AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD owfs-2.8p15/aclocal.m40000664000175000017500000124117111756250025011464 00000000000000# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\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/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) owfs-2.8p15/module/0000775000175000017500000000000011756315507011171 500000000000000owfs-2.8p15/module/owfs/0000775000175000017500000000000011756315510012141 500000000000000owfs-2.8p15/module/owfs/src/0000775000175000017500000000000011756315510012730 500000000000000owfs-2.8p15/module/owfs/src/Makefile.in0000664000175000017500000005117311756250027014725 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owfs/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include all: all-recursive .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 module/owfs/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owfs/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owfs/src/Makefile.am0000664000175000017500000000006610504776327014715 00000000000000SUBDIRS = c include clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owfs/src/include/0000775000175000017500000000000011756315510014353 500000000000000owfs-2.8p15/module/owfs/src/include/owfs.h0000664000175000017500000000226610557552546015442 00000000000000/* $Id: owfs.h,v 1.12 2007/01/30 05:19:34 alfille Exp $ OWFS and OWHTTPD one-wire file system and one-wire web server By Paul H Alfille {c} 2003 GPL palfille@earthlink.net */ /* OWFS - specific header */ #ifndef OWFS_H #define OWFS_H #include #include "owfs_config.h" #include "ow.h" /* Include FUSE -- http://fuse.sf.net */ /* Lot's of version-specific code */ //#define FUSE_USE_VERSION 26 // FUSE_USE_VERSION is set from configure script #include #ifndef FUSE_VERSION #ifndef FUSE_MAJOR_VERSION #define FUSE_VERSION 11 #else /* FUSE_MAJOR_VERSION */ #undef FUSE_MAKE_VERSION #define FUSE_MAKE_VERSION(maj,min) ((maj) * 10 + (min)) #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION,FUSE_MINOR_VERSION) #endif /* FUSE_MAJOR_VERSION */ #endif /* FUSE_VERSION */ extern struct fuse_operations owfs_oper; struct Fuse_option { int max_options; char **argv; int argc; }; int Fuse_setup(struct Fuse_option *fo); void Fuse_cleanup(struct Fuse_option *fo); int Fuse_parse(char *opts, struct Fuse_option *fo); int Fuse_add(char *opt, struct Fuse_option *fo); char *Fuse_arg(char *opt_arg, char *entryname); #endif /* OWFS_H */ owfs-2.8p15/module/owfs/src/include/Makefile.in0000664000175000017500000003660111756250027016347 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owfs/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = owfs.h 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 module/owfs/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owfs/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owfs/src/include/Makefile.am0000664000175000017500000000007110432627750016327 00000000000000noinst_HEADERS = owfs.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owfs/src/c/0000775000175000017500000000000011756315510013152 500000000000000owfs-2.8p15/module/owfs/src/c/owfs.c0000644000175000017500000000753311731463642014225 00000000000000/* $Id: owfs.c,v 1.87 2012/03/17 00:28:29 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owfs.h" #include "ow_connection.h" /* OW -- One Wire Globals variables -- each invokation will have it's own data */ struct fuse *fuse; int fuse_fd = -1; char umount_cmd[1024] = ""; char *fuse_mnt_opt = NULL; char *fuse_open_opt = NULL; /* ---------------------------------------------- */ /* Command line parsing and mount handler to FUSE */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; struct Fuse_option fuse_options; /* Set up owlib */ LibSetup(program_type_filesystem); /* grab our executable name */ if (argc > 0) { Globals.progname = owstrdup(argv[0]); } //mtrace() ; /* process command line arguments */ while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; case e_fuse_opt: /* fuse_mnt_opt */ if (fuse_mnt_opt) { owfree(fuse_mnt_opt); } fuse_mnt_opt = Fuse_arg(optarg, "FUSE mount options"); if (fuse_mnt_opt == NULL) { ow_exit(0); } break; case e_fuse_open_opt: /* fuse_open_opt */ if (fuse_open_opt) { owfree(fuse_open_opt); } fuse_open_opt = Fuse_arg(optarg, "FUSE open options"); if (fuse_open_opt == NULL) { ow_exit(0); } break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* non-option arguments */ while (optind < argc - 1) { ARG_Generic(argv[optind]); ++optind; } while (optind < argc) { if (Outbound_Control.active) { ARG_Generic(argv[optind]); } else { ARG_Server(argv[optind]); } ++optind; } if (Outbound_Control.active == 0) { LEVEL_DEFAULT("No mount point specified.\nTry '%s -h' for help.", argv[0]); ow_exit(1); } // FUSE directory mounting LEVEL_CONNECT("fuse mount point: %s", Outbound_Control.head->name); // Signal handler is set in fuse library //set_signal_handlers(exit_handler); /* Set up adapters */ if ( BAD(LibStart()) ) { ow_exit(1); } #if FUSE_VERSION >= 14 /* Set up "command line" for main fuse routines */ Fuse_setup(&fuse_options); // command line setup Fuse_add(Outbound_Control.head->name, &fuse_options); // mount point #if FUSE_VERSION >= 22 Fuse_add("-o", &fuse_options); // add "-o direct_io" to prevent buffering Fuse_add("direct_io", &fuse_options); #endif /* FUSE_VERSION >= 22 */ if (!Globals.want_background) { Fuse_add("-f", &fuse_options); // foreground for fuse too if (Globals.error_level > 2) { Fuse_add("-d", &fuse_options); // debug for fuse too } } Fuse_parse(fuse_mnt_opt, &fuse_options); LEVEL_DEBUG("fuse_mnt_opt=[%s]", fuse_mnt_opt); Fuse_parse(fuse_open_opt, &fuse_options); LEVEL_DEBUG("fuse_open_opt=[%s]", fuse_open_opt); if (Globals.allow_other) { Fuse_add("-o", &fuse_options); // add "-o allow_other" to permit other users access Fuse_add("allow_other", &fuse_options); } #if OW_MT == 0 Fuse_add("-s", &fuse_options); // single threaded #endif /* OW_MT */ Globals.now_background = Globals.want_background; // tell "error" that we are background #if 0 { int i; for (i = 0; i < fuse_options.argc; i++) { LEVEL_DEBUG("fuse_options.argv[%d]=[%s]", i, fuse_options.argv[i]); } } #endif #if FUSE_VERSION > 25 fuse_main(fuse_options.argc, fuse_options.argv, &owfs_oper, NULL); #else /* FUSE_VERSION <= 25 */ fuse_main(fuse_options.argc, fuse_options.argv, &owfs_oper); #endif /* FUSE_VERSION <= 25 */ Fuse_cleanup(&fuse_options); #endif ow_exit(0); return 0; } owfs-2.8p15/module/owfs/src/c/owfs_callback.c0000644000175000017500000001514311657112060016025 00000000000000/* $Id: owfs_callback.c,v 1.59 2011/11/11 03:19:12 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interface LI -- LINK commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097U serial connector Written 2003 Paul H Alfille */ #include "owfs.h" #include "ow_pid.h" /* There was a major change in the function prototypes at FUSE 2.2, we'll make a flag */ #undef FUSE22PLUS #undef FUSE1X #ifdef FUSE_MAJOR_VERSION #if FUSE_MAJOR_VERSION > 2 #define FUSE22PLUS #elif FUSE_MAJOR_VERSION < 2 #define FUSE1X #elif FUSE_MINOR_VERSION > 1 #define FUSE22PLUS #endif /* FUSE > 2.1 */ #else /* no FUSE_MAJOR_VERSION */ #define FUSE1X #endif /* FUSE_MAJOR_VERSION */ #ifdef FUSE22PLUS #define FUSEFLAG struct fuse_file_info * #else /* FUSE < 2.2 */ #define FUSEFLAG int #endif /* FUSE_MAJOR_VERSION */ static int FS_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler); static int FS_utime(const char *path, struct utimbuf *buf); static int FS_truncate(const char *path, const off_t size); static int FS_chmod(const char *path, mode_t mode); static int FS_chown(const char *path, uid_t uid, gid_t gid); static int FS_open(const char *path, FUSEFLAG flags); static int FS_release(const char *path, FUSEFLAG flags); #ifdef FUSE22PLUS static int CB_read(const char *path, char *buffer, size_t size, off_t offset, struct fuse_file_info *flags); static int CB_write(const char *path, const char *buffer, size_t size, off_t offset, struct fuse_file_info *flags); #else /* fuse < 2.2 */ #define CB_read FS_read #define CB_write FS_write #endif #if FUSE_VERSION > 25 static void *FS_init(struct fuse_conn_info *); #elif FUSE_VERSION > 22 static void *FS_init(void); #endif /* FUSE_VERSION > 22 */ /* Change in statfs definition for newer FUSE versions */ #ifdef FUSE1X static int FS_statfs(struct fuse_statfs *fst); #else /* FUSE_MAJOR_VERSION */ #define FS_statfs NULL #endif /* FUSE_MAJOR_VERSION */ struct fuse_operations owfs_oper = { getattr:FS_fstat, readlink:NULL, getdir:FS_getdir, mknod:NULL, mkdir:NULL, symlink:NULL, unlink:NULL, rmdir:NULL, rename:NULL, link:NULL, chmod:FS_chmod, chown:FS_chown, truncate:FS_truncate, utime:FS_utime, open:FS_open, read:CB_read, write:CB_write, statfs:FS_statfs, release:FS_release, #if FUSE_VERSION > 22 init:FS_init, #endif /* FUSE_VERSION > 22 */ }; /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ /* Needed for "SETATTR" */ static int FS_utime(const char *path, struct utimbuf *buf) { LEVEL_CALL("UTIME path=%s", SAFESTRING(path)); (void) buf; return 0; } /* Needed for "SETATTR" */ static int FS_chmod(const char *path, mode_t mode) { LEVEL_CALL("CHMODE path=%s", SAFESTRING(path)); (void) mode; return 0; } /* Needed for "SETATTR" */ static int FS_chown(const char *path, uid_t uid, gid_t gid) { LEVEL_CALL("CHOWN path=%s", SAFESTRING(path)); (void) uid; (void) gid; return 0; } /* In theory, should handle file opening, but OWFS doesn't care. Device opened/closed with every read/write */ static int FS_open(const char *path, FUSEFLAG flags) { #if FUSE_VERSION < 23 if (!pid_created) PIDstart(); #endif /* FUSE_VERSION < 23 */ LEVEL_CALL("OPEN path=%s", SAFESTRING(path)); (void) flags; return 0; } /* In theory, should handle file closing, but OWFS doesn't care. Device opened/closed with every read/write */ static int FS_release(const char *path, FUSEFLAG flags) { LEVEL_CALL("RELEASE path=%s", SAFESTRING(path)); (void) flags; return 0; } /* dummy truncation (empty) function */ static int FS_truncate(const char *path, const off_t size) { LEVEL_CALL("TRUNCATE path=%s", SAFESTRING(path)); (void) size; return 0; } #ifdef FUSE22PLUS #define FILLER(handle,name) filler(handle,name,DT_DIR,(ino_t)0) #else /* FUSE22PLUS */ #define FILLER(handle,name) filler(handle,name,DT_DIR) #endif /* FUSE22PLUS */ struct getdirstruct { fuse_dirh_t h; fuse_dirfil_t filler; }; /* Callback function to FS_dir */ /* Prints this directory element (not the whole path) */ static void FS_getdir_callback(void *v, const struct parsedname *pn_entry) { struct getdirstruct *gds = v; #ifdef FUSE22PLUS (gds->filler) (gds->h, FS_DirName(pn_entry), DT_DIR, (ino_t) 0); #else /* FUSE22PLUS */ (gds->filler) (gds->h, FS_DirName(pn_entry), DT_DIR); #endif /* FUSE22PLUS */ } static int FS_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler) { struct parsedname pn; ZERO_OR_ERROR return_code ; RETURN_CODE_ERROR_RETURN( FS_ParsedName(path, &pn) ) ; LEVEL_CALL("GETDIR path=%s", SAFESTRING(path)); if (pn.selected_filetype == NO_FILETYPE) { struct getdirstruct gds = { h, filler, }; /* Call directory spanning function */ FS_dir(FS_getdir_callback, &gds, &pn); FILLER(h, "."); FILLER(h, ".."); RETURN_CODE_SET_SCALAR( return_code, 0 ) ; // success } else { /* property */ RETURN_CODE_SET_SCALAR( return_code, 69 ) ; // Directory - not a directory } /* Clean up */ FS_ParsedName_destroy(&pn); return return_code; } #ifdef FUSE22PLUS static int CB_read(const char *path, char *buffer, size_t size, off_t offset, struct fuse_file_info *flags) { (void) flags; int return_size ; OWQ_allocate_struct_and_pointer( owq ) ; if (path == NO_PATH) { path = "/"; } if ( BAD( OWQ_create(path, owq) ) ) { /* Can we parse the input string */ return -ENOENT; } if ( IsDir( PN(owq) ) ) { /* A directory of some kind */ return_size = -EISDIR ; } else if ( offset >= (off_t) FullFileLength( PN(owq) ) ) { // fuse requests a useless read at end of file -- just return ok. return_size = 0 ; } else { OWQ_assign_read_buffer( buffer, size, offset, owq) ; return_size = FS_read_postparse(owq) ; } OWQ_destroy(owq); return return_size ; } static int CB_write(const char *path, const char *buffer, size_t size, off_t offset, struct fuse_file_info *flags) { (void) flags; return FS_write(path, buffer, size, offset); } #endif /* FUSE22PLUS */ /* Change in statfs definition for newer FUSE versions */ #ifdef FUSE1X int FS_statfs(struct fuse_statfs *fst) { LEVEL_CALL("STATFS"); memset(fst, 0, sizeof(struct fuse_statfs)); return 0; } #endif /* FUSE1X */ #if FUSE_VERSION > 22 #if FUSE_VERSION > 25 static void *FS_init(struct fuse_conn_info *conn) { (void) conn; #else /* FUSE_VERSION > 25 */ static void *FS_init(void) { #endif /* FUSE_VERSION > 25 */ PIDstart(); return VOID_RETURN; } #endif /* FUSE_VERSION > 22 */ owfs-2.8p15/module/owfs/src/c/Makefile.in0000664000175000017500000005072711756250027015153 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.33 2008/06/17 10:01:02 d1mag Exp $ 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@ target_triplet = @target@ bin_PROGRAMS = owfs$(EXEEXT) subdir = module/owfs/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_owfs_OBJECTS = owfs.$(OBJEXT) owfs_callback.$(OBJEXT) \ fuse_line.$(OBJEXT) owfs_OBJECTS = $(am_owfs_OBJECTS) owfs_LDADD = $(LDADD) am__DEPENDENCIES_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(owfs_SOURCES) DIST_SOURCES = $(owfs_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ owfs_SOURCES = owfs.c owfs_callback.c fuse_line.c owfs_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ ${FUSE_FLAGS} \ ${FUSE_INCLUDES} \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${LIBUSB_CFLAGS} \ ${PTHREAD_CFLAGS} LDADD = -low ${FUSE_LIBS} ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} 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 module/owfs/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owfs/src/c/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-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_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 owfs$(EXEEXT): $(owfs_OBJECTS) $(owfs_DEPENDENCIES) $(EXTRA_owfs_DEPENDENCIES) @rm -f owfs$(EXEEXT) $(LINK) $(owfs_OBJECTS) $(owfs_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fuse_line.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owfs_callback.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic 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-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owfs/src/c/fuse_line.c0000664000175000017500000000473011343355171015212 00000000000000/* $Id: fuse_line.c,v 1.11 2010/03/03 03:41:45 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owfs.h" /* Fuse_main is called with a standard C-style argc / argv parameters */ /* These routines build the char **argv */ int Fuse_setup(struct Fuse_option *fo) { fo->max_options = 0; fo->argc = 0; fo->argv = NULL; /* create "0th" item -- the program name */ /* Note this is required since the final NULL item doesn't exist yet */ return Fuse_add("OWFS", fo); } void Fuse_cleanup(struct Fuse_option *fo) { if (fo->argv) { char ** option_pointer; for (option_pointer=fo->argv; option_pointer[0] != NULL; ++option_pointer) { owfree(option_pointer[0]); } owfree(fo->argv); fo->argv = NULL ; } } int Fuse_parse(char *opts, struct Fuse_option *fo) { char *start; char *next = opts; while ((start = next)) { strsep(&next, " "); if (Fuse_add(start, fo)) return 1; } return 0; } /* Add an option for the fuse library. * Must be in char ** argv format like any parameters sent to main * use a resizeable array */ int Fuse_add(char *opt, struct Fuse_option *fo) { //LEVEL_DEBUG("Adding option %s",opt); if (fo->argc >= fo->max_options-1) { char ** old_argv = fo->argv ; // need to allocate more space fo->max_options += 10; fo->argv = (char **) owrealloc(old_argv, (fo->max_options + 1) * sizeof(char *)); if (fo->argv == NULL) { // not enough memory. Clean up and return an error fo->argv = old_argv ; Fuse_cleanup(fo) ; return -ENOMEM; } } // Add new element fo->argv[fo->argc++] = owstrdup(opt); // and guard element at end fo->argv[fo->argc] = NULL; LEVEL_DEBUG("Added FUSE option %d %s",fo->argc-1,fo->argv[fo->argc-1]); return 0; } char *Fuse_arg(char *opt_arg, char *entryname) { char *ret = NULL; int len = strlen(opt_arg); if (len < 3 || opt_arg[0] != '"' || opt_arg[len - 1] != '"') { fprintf(stderr, "Put the %s value in quotes. \"%s\"", entryname, opt_arg); return NULL; } ret = owstrdup(&opt_arg[1]); // start after first quote if (ret == NULL) { fprintf(stderr, "Insufficient memory to store %s options: %s", entryname, opt_arg); return NULL; } ret[len - 2] = '\0'; // pare off trailing quote return ret; } owfs-2.8p15/module/owfs/src/c/Makefile.am0000664000175000017500000000116011025705536015124 00000000000000# $Id: Makefile.am,v 1.33 2008/06/17 10:01:02 d1mag Exp $ bin_PROGRAMS = owfs owfs_SOURCES = owfs.c owfs_callback.c fuse_line.c owfs_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ ${FUSE_FLAGS} \ ${FUSE_INCLUDES} \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${LIBUSB_CFLAGS} \ ${PTHREAD_CFLAGS} LDADD = -low ${FUSE_LIBS} ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owfs/Makefile.in0000664000175000017500000005115111756250027014132 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owfs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owfs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owfs/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owfs/Makefile.am0000664000175000017500000000005710432627750014121 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/swig/0000775000175000017500000000000011756315511012135 500000000000000owfs-2.8p15/module/swig/python/0000775000175000017500000000000011756315511013456 500000000000000owfs-2.8p15/module/swig/python/examples/0000775000175000017500000000000011756315511015274 500000000000000owfs-2.8p15/module/swig/python/examples/check_ow.py0000775000175000017500000000563711014431577017364 00000000000000#! /usr/bin/env python """ Nagios plugin to check the value of a 1-wire sensor. Nagios is a host, service and network monitoring program available at http://nagios.org. Copyright (c) 2008 Peter Kropf. All rights reserved. Examples: This example doesn't really do all that much, must verifies that the specified sensor exists on the USB adapter. ./check_ow.py u /10.54BA4D000800 Check the temperature of the sensor on the USB adapter. Give a warning if the temperature is greater than 29 degrees celsius and make it critical if above 35. ./check_ow.py -c 35 -w 29 u /10.54BA4D000800/temperature """ import ow import sys from optparse import OptionParser class nagios: ok = (0, 'OK') warning = (1, 'WARNING') critical = (2, 'CRITICAL') unknown = (3, 'UNKNOWN') def exit(status, message): print 'ow ' + status[1] + ' - ' + message sys.exit(status[0]) # FIXME: need to add more help text in the init_string and sensor_path parameters parser = OptionParser(usage='usage: %prog [options] init_string sensor_path', version='%prog ' + ow.__version__) parser.add_option('-v', dest='verbose', action='count', help='multiple -v increases the level of debugging output.') parser.add_option('-w', dest='warning', type='float', help='warning level.') parser.add_option('-c', dest='critical', type='float', help='critical level.') parser.add_option('-t', dest='temperature', choices=['C', 'F', 'R', 'K'], help='set the temperature scale: C - celsius, F - fahrenheit, R - rankine or K - kelvin.') options, args = parser.parse_args() if len(args) != 2: exit(nagios.unknown, 'missing command line arguments') init = args[0] sensor_path = args[1] if options.temperature: ow.opt(options.temperature) try: ow.error_print(ow.error_print.suppressed) # needed to exclude debug output which confuses nagios ow.init(init) except ow.exUnknownSensor, ex: exit(nagios.unknown[0], 'unable to initialize sensor adapter ' + str(ex)) pieces = [x for x in sensor_path.split('/') if x] if len(pieces): sensor = '/' + pieces[0] else: sensor = '/' try: s = ow.Sensor(sensor) except ow.exUnknownSensor, ex: exit(nagios.unknown, 'unknown sensor ' + str(ex)) if options.verbose == 1: print s elif options.verbose > 1: print s print 'entryList:', s.entryList() print 'sensorList:', s.sensorList() if len(pieces) > 1: field = pieces[1] try: v = float(getattr(s, field)) except AttributeError: exit(nagios.unknown, 'unknown field - ' + repr(s) + '.' + field) if options.critical: if v > options.critical: exit(nagios.critical, repr(s) + '.' + field + ' %f' % v) if options.warning: if v > options.warning: exit(nagios.warning, repr(s) + '.' + field + ' %f' % v) exit(nagios.ok, repr(s) + '.' + field + ' %f' % v) else: # len(pieces) > 1 exit(nagios.ok, repr(s)) owfs-2.8p15/module/swig/python/examples/xmlrpc_server.py0000775000175000017500000000457510174070021020462 00000000000000#! /usr/bin/env python """ ::BOH $Id: xmlrpc_server.py,v 1.1 2005/01/21 02:59:29 peterk Exp $ Copyright (c) 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Create an XML-RPC server for a 1-wire network. Run xmlrpc_client.py to see the server in action. Or point a browser at http://localhost:8765 to see some documentation. """ import sys import ow from DocXMLRPCServer import DocXMLRPCServer, DocXMLRPCRequestHandler from SocketServer import ThreadingMixIn class owr: """ A wrapper class is needed around the ow.Sensor class since the XML-RPC protocol doesn't know anything about generators, Python objects and such. XML-RPC is a pretty simple protocol that deals pretty well with basic types. So that's what it'll get. """ def entries( self, path ): """List a sensor's attributes.""" return [entry for entry in ow.Sensor( path ).entries( )] def sensors( self, path ): """List all the sensors that exist in a particular path.""" return [sensor._path for sensor in ow.Sensor( path ).sensors( )] def attr( self, path, attr ): """Lookup a specific sensor attribute.""" sensor = ow.Sensor( path ) exec 'val = sensor.' + attr return val class ThreadingServer( ThreadingMixIn, DocXMLRPCServer ): pass # Initialize ow for a USB controller or for a serial port. ow.init( 'u' ) #ow.init( '/dev/ttyS0' ) # Allow connections for the localhost on port 8765. serveraddr = ( '', 8765 ) srvr = ThreadingServer( serveraddr, DocXMLRPCRequestHandler ) srvr.set_server_title( '1-wire network' ) srvr.set_server_documentation( 'Welcome to the world of 1-wire networks.' ) srvr.register_instance( owr( ) ) srvr.register_introspection_functions( ) srvr.serve_forever( ) owfs-2.8p15/module/swig/python/examples/raw_access.py0000775000175000017500000000265110671053563017710 00000000000000#! /usr/bin/env python """ ::BOH $Id: raw_access.py,v 1.2 2007/09/09 20:28:35 d1mag Exp $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Example showing direct access to the underlying owfs libraries. """ import sys from ow import _OW def tree( path, indent = 0 ): raw = _OW.get( path ) if raw: entries = raw.split( ',' ) for entry in entries: print ' ' * indent, entry if entry[ -1 ] == '/': tree( entry, indent + 4 ) if __name__ == "__main__": if len( sys.argv ) == 1: print 'usage: tree.py u|serial_port_path|localhost:4304' sys.exit( 1 ) else: if not _OW.init( sys.argv[ 1 ] ): print 'problem initializing the 1-wire controller' sys.exit( 1 ) tree( '/' ) owfs-2.8p15/module/swig/python/examples/errormessages.py0000775000175000017500000000370311535564041020454 00000000000000#! /usr/bin/env python """ ::BOH $Id: errormessages.py,v 1.2 2011/03/09 02:38:25 alfille Exp $ Copyright (c) 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Turn on connection level error messages and print the address and type of all sensors on a 1-wire network. """ import sys import ow def tree( sensor ): print '%7s - %s' % ( sensor._type, sensor._path ) for next in sensor.sensors( ): if next._type in [ 'DS2409', ]: tree( next ) else: print '%7s - %s' % ( next._type, next._path ) if __name__ == "__main__": if len( sys.argv ) == 1: print 'usage: errormessages.py u|serial_port_path' sys.exit( 1 ) else: # Turn on the level of message to display #ow.error_level(ow.error_level.fatal) #ow.error_level(ow.error_level.default) #ow.error_level(ow.error_level.connect) ow.error_level(ow.error_level.call) #ow.error_level(ow.error_level.data) #ow.error_level(ow.error_level.debug) # Set where the messages are to be displayed #ow.error_print(ow.error_print.mixed) #ow.error_print(ow.error_print.syslog) ow.error_print(ow.error_print.stderr) #ow.error_print(ow.error_print.suppressed) ow.init( sys.argv[ 1 ] ) tree( ow.Sensor( '/' ) ) owfs-2.8p15/module/swig/python/examples/temperature.py0000775000175000017500000000237710173651516020137 00000000000000#! /usr/bin/env python """ ::BOH $Id: temperature.py,v 1.2 2005/01/20 06:44:30 peterk Exp $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Find all temperature sensors (DS18S20) and print out their current temperature reading. """ import sys import ow def temperature( ): root = ow.Sensor( '/' ) for sensor in root.find( type = 'DS18S20' ): print sensor._path, sensor.temperature if __name__ == "__main__": if len( sys.argv ) == 1: print 'usage: temperature.py u|serial_port_path' sys.exit( 1 ) else: ow.init( sys.argv[ 1 ] ) temperature( ) owfs-2.8p15/module/swig/python/examples/xmlrpc_client.py0000775000175000017500000000251410174070021020421 00000000000000#! /usr/bin/env python """ ::BOH $Id: xmlrpc_client.py,v 1.1 2005/01/21 02:59:29 peterk Exp $ Copyright (c) 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Create an XML-RPC client for a 1-wire network. """ import xmlrpclib import code ow_sensor = xmlrpclib.ServerProxy( 'http://localhost:8765/' ) print 'Entries at the root:', ow_sensor.entries( '/' ) print 'List of sensors:' sensors = ow_sensor.sensors( '/' ) for sensor in sensors: sensor_type = ow_sensor.attr( sensor, 'type' ) if sensor_type == 'DS18S20': print ' ', sensor, '-', sensor_type, '- temperature:', ow_sensor.attr( sensor, 'temperature' ).strip( ) else: print ' ', sensor, '-', sensor_type owfs-2.8p15/module/swig/python/examples/tree.py0000775000175000017500000000253010624632661016531 00000000000000#! /usr/bin/env python """ ::BOH $Id: tree.py,v 1.3 2007/05/22 18:25:53 alfille Exp $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Print the address and type of all sensors on a 1-wire network. """ import sys import ow def tree( sensor ): print '%7s - %s' % ( sensor._type, sensor._path ) for next in sensor.sensors( ): if next._type in [ 'DS2409', ]: tree( next ) else: print '%7s - %s' % ( next._type, next._path ) if __name__ == "__main__": if len( sys.argv ) == 1: print 'usage: tree.py u|serial_port_path|localhost:4304' sys.exit( 1 ) else: ow.init( sys.argv[ 1 ] ) tree( ow.Sensor( '/' ) ) owfs-2.8p15/module/swig/python/setup.py.in0000664000175000017500000001557711025730166015530 00000000000000""" ::BOH $Id: setup.py.in,v 1.19 2008/06/17 12:39:18 d1mag Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/setup.py $ Copyright (c) 2004, 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH distutils setup file for use in creating a Python module from the owfs project. """ import os # platform doesn't exist for python 2.2 #import platform from distutils.core import setup, Extension from distutils import sysconfig import string #python_version = platform.python_version()[0:3] python_version = sysconfig.get_config_vars()["VERSION"] classifiers = """ Development Status :: 4 - Beta Environment :: Console Intended Audience :: Developers Intended Audience :: System Administrators Operating System :: POSIX :: Linux Programming Language :: C Programming Language :: Python Topic :: System :: Hardware Topic :: Utilities """ my_libraries = [] my_library_dirs = [] my_include_dirs = [] my_extra_link_args = [] my_extra_compile_args = [] my_runtime_library_dirs = [] my_extra_objects = [] my_define_macros = [] my_undef_macros = [] def write_configuration(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs,extra_objects): #Write the compilation configuration into a file out=open('configuration.log','w') print >> out, "Current configuration" print >> out, "libraries", libraries print >> out, "library_dirs", library_dirs print >> out, "include_dirs", include_dirs print >> out, "define_macros", define_macros print >> out, "extra_link_args", extra_link_args print >> out, "extra_compile_args", extra_compile_args print >> out, "runtime_library_dirs", runtime_library_dirs print >> out, "extra_objects", extra_objects out.close() enable_usb = '@ENABLE_USB@' enable_mt = '@ENABLE_MT@' have_darwin = '@HAVE_DARWIN@' # have to split up the _CFLAGS, _LIBS variables since there are problem # when they contain spaces. The append() function doesn't work very good. # extra_l_args.append ( '@LIBUSB_CFLAGS@' ) # Should perhaps add ${LD_EXTRALIBS} ${OSLIBS} to extra_l_args too if # supporting MacOSX. my_extra_compile_args = [ '-D_FILE_OFFSET_BITS=64' ] if len('@PYCFLAGS@') > 0: my_extra_compile_args = my_extra_compile_args + string.split('@PYCFLAGS@', ' ') if len('@PIC_FLAGS@') > 0: my_extra_compile_args = my_extra_compile_args + string.split('@PIC_FLAGS@', ' ') my_extra_link_args = [ ] if enable_usb == 'true': if len('@LIBUSB_CFLAGS@') > 1: my_extra_compile_args = my_extra_compile_args + string.split('@LIBUSB_CFLAGS@', ' ') if enable_usb == 'true': if len('@LIBUSB_LIBS@') > 1: my_extra_link_args = my_extra_link_args + string.split('@LIBUSB_LIBS@', ' ') if enable_mt == 'true': if len('@PTHREAD_CFLAGS@') > 1: my_extra_compile_args = my_extra_compile_args + string.split('@PTHREAD_CFLAGS@', ' ') if enable_mt == 'true': if len('@PTHREAD_LIBS@') > 1: my_extra_link_args = my_extra_link_args + string.split('@PTHREAD_LIBS@', ' ') if have_darwin == 'true': my_extra_link_args = my_extra_link_args + string.split('../../owlib/src/c/.libs/libow.so', ' ') if len('@PYLDFLAGS@') > 1: my_extra_link_args = my_extra_link_args + string.split('@PYLDFLAGS@', ' ') ARCH="" my_platform = '@LIBPOSTFIX@' #my_platform = [ platform.machine() ] if my_platform == "x86_64" or my_platform == "amd64" or my_platform == "64": print "64bit system detected" ARCH = "x64" my_libraries = [ 'ow' ] #if ARCH == "x64": # my_extra_objects = [ '../../owlib/src/c/.libs/libow.a' ] # my_libraries = [ ] # #my_extra_link_args = my_extra_link_args + string.split('-Wl,--export-dynamic', ' ') #elif ARCH != "x64": # my_extra_objects = "" # my_libraries = [ 'ow' ] if have_darwin == 'true': my_libraries = [ ] removals = ['-Wstrict-prototypes'] if python_version == '2.5': cv_opt = sysconfig.get_config_vars()["CFLAGS"] for removal in removals: cv_opt = cv_opt.replace(removal, " ") sysconfig.get_config_vars()["CFLAGS"] = ' '.join(cv_opt.split()) cv_opt = ' '.join(my_extra_compile_args) for removal in removals: cv_opt = cv_opt.replace(removal, " ") my_extra_compile_args = ' '.join(cv_opt.split()) else: cv_opt = sysconfig.get_config_vars()["OPT"] for removal in removals: cv_opt = cv_opt.replace(removal, " ") sysconfig.get_config_vars()["OPT"] = ' '.join(cv_opt.split()) # cv_opt = ' '.join(my_extra_compile_args) # my_extra_compile_args = ' '.join(cv_opt.split()) #print "my_extra_compile_args=", my_extra_compile_args my_extra_compile_args = [ arg for arg in my_extra_compile_args if len(arg) > 1 ] #print "my_extra_compile_args=", my_extra_compile_args my_extra_link_args = [ arg for arg in my_extra_link_args if len(arg) > 1 ] my_include_dirs = [ '../../owlib/src/include', '../../../src/include' ] my_library_dirs = [ '../../owlib/src/c/.libs' ] my_runtime_library_dirs = [ '@LIBDIR@' ] sources = [ 'ow_wrap.c' ] write_configuration(my_define_macros, my_include_dirs, my_libraries, my_library_dirs, my_extra_link_args, my_extra_compile_args, my_runtime_library_dirs,my_extra_objects) setup( name = 'ow', description = '1-wire hardware interface.', version = '@VERSION@', author = 'Peter Kropf', author_email = 'pkropf@gmail.com', url = 'http://www.owfs.org/', license = 'GPL', platforms = 'Linux', long_description = 'Interface with 1-wire controllers and sensors from Python.', classifiers = filter( None, classifiers.split( '\n' ) ), packages = ['ow'], ext_package = 'ow', ext_modules = [ Extension( '_OW', sources, include_dirs = my_include_dirs, library_dirs = my_library_dirs, libraries = my_libraries, extra_compile_args = my_extra_compile_args, extra_link_args = my_extra_link_args, runtime_library_dirs = my_runtime_library_dirs, extra_objects=my_extra_objects) ], ) owfs-2.8p15/module/swig/python/ow/0000775000175000017500000000000011756315511014103 500000000000000owfs-2.8p15/module/swig/python/ow/Makefile.in0000664000175000017500000003310411756250031016064 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/swig/python/ow DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = __init__.py 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 module/swig/python/ow/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/swig/python/ow/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): 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/swig/python/ow/Makefile.am0000664000175000017500000000007310432627752016062 00000000000000 EXTRA_DIST = __init__.py clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/swig/python/ow/__init__.py0000664000175000017500000003757611443446272016160 00000000000000""" ::BOH $Id: __init__.py,v 1.18 2010/09/13 16:09:30 alfille Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $ Copyright (c) 2004, 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH 1-wire sensor network interface. OWFS is an open source project developed by Paul Alfille and hosted at http://www.owfs.org. """ # avoid error with python2.2 from __future__ import generators import os from ow import _OW __author__ = 'Peter Kropf' __email__ = 'pkropf@gmail.com' __version__ = _OW.version( ) + '-%s' % '$Id: __init__.py,v 1.18 2010/09/13 16:09:30 alfille Exp $'.split( )[ 2 ] # # Exceptions used and thrown by the ow classes # class exError( Exception ): """Base exception for all one wire raised exceptions.""" class exErrorValue( exError ): """Base exception for all one wire raised exceptions with a value.""" def __init__( self, value ): self.value = value def __str__( self ): return repr( self.value ) class exNoController( exError ): """Exception raised when a controller cannot be initialized.""" class exNotInitialized( exError ): """Exception raised when a controller has not been initialized.""" class exUnknownSensor(exErrorValue): """Exception raised when a specified sensor is not found.""" # # Module variable used to insure that the _OW library has been # initialized before any calls into it are made. # initialized = False # # Access to the internal owlib error level and print variables # def error_level(level=None): """ Manipulate the internal owlib error logging calls. If no parameter is specified, the current owlib error level is returned. Otherwise, the current owlib error level is set to the value specified. Valid level values are: error_level.fatal error_level.default error_level.connect error_level.call error_level.data error_level.debug """ if level: _OW.set_error_level(level) return _OW.get_error_level() error_level.fatal = 0 error_level.default = 1 error_level.connect = 2 error_level.call = 3 error_level.data = 4 error_level.debug = 5 def error_print(level=None): """ Manipulate where the internal owlib error logging facility sends the error messages. If no parameter is specified, the current owlib error print value is returned. Otherwise, the current owlib error print value is set to the parameter. Valid print values are: error_print.mixed error_print.syslog error_print.stderr error_print.suppressed """ if level: _OW.set_error_print(level) return _OW.get_error_print() error_print.mixed = 0 error_print.syslog = 1 error_print.stderr = 2 error_print.suppressed = 3 def opt(option, arg = ''): """ Pass options to the ow opt function. Used for things like setting the temperature scale: ow.opt('F') # use the fahrenheit temperature scale ow.opt('C') # use the celsius temperature scale Useful only when directly connected to a sensor adapter. When using a remote owserver process, the owserver process must be started with the correct command line arguments. """ return _OW.opt(option, arg) # # Module varialbe used to turn on _OW function call logging # use_logging = False #use_logging = True def _get(path): """ Get the sensor data. In the case where a sensor is disconnected from the bus or something else goes wrong, raise exUnknownSensor. """ sensor = _OW.get(path) if sensor == None: raise exUnknownSensor(path) return sensor def _put(path, value): """ Write the _OW.put call details out to the log file. """ return _OW.put(path, value) def log_get( path ): """ Write the _OW.get call details out to the log file. """ logfile.write( "_OW.get( '%s' )%s" % ( path, os.linesep ) ) return _OW.get(path) def log_put( path, value ): """ Write the _OW.put call details out to the log file. """ logfile.write( "_OW.put( '%s', '%s' )%s" % ( path, value, os.linesep ) ) return _OW.put( path, value ) if use_logging: logfile = open( 'OW.log', 'w' ) owfs_get = log_get owfs_put = log_put else: owfs_get = _get owfs_put = _put # # Initialize and cleanup the _OW library. # def init( iface ): """ Initialize the OWFS library by specifying the interface mechanism to be used for communications to the 1-wire network. Examples: ow.init( 'u' ) Will initialize the 1-wire interface to use the USB controller. ow.init( '/dev/ttyS0' ) Will initialize the 1-wire interface to use the /dev/ttyS0 serial port. ow.init( 'remote_system:3003' ) Will initialize the 1-wire interface to use the owserver running on remote_system on port 3003. """ #print 'ow.__init__' global initialized if not initialized: if not _OW.init( iface ): raise exNoController initialized = True def finish( ): """ Cleanup the OWFS library, freeing any used resources. """ #print 'Controller.__del__' global initialized if initialized: _OW.finish( ) initialized = False # # 1-wire sensors # class Sensor( object ): """ A Sensor is the basic component of a 1-wire network. It represents a individual 1-wire element as it exists on the network. """ def __init__( self, path ): """ Create a new Sensor as it exists at the specified path. """ #print 'Sensor.__init__: <%s>' % path if not initialized: raise exNotInitialized self._attrs = { } if path == '/': self._path = path self._useCache = True elif path == '/uncached': self._path = '/' self._useCache = False else: if path[ :len( '/uncached' ) ] == '/uncached': self._path = path[ len( '/uncached' ): ] self._useCache = False else: self._path = path self._useCache = True self.useCache( self._useCache ) def __str__( self ): """ Print a string representation of the Sensor in the form of: path - type Example: >>> print Sensor( '/' ) / - DS9490 """ #print 'Sensor.__str__' return "%s - %s" % ( self._usePath, self._type ) def __repr__( self ): """ Print a representation of the Sensor in the form of: Sensor( path ) Example: >>> Sensor( '/' ) Sensor("/") """ #print 'Sensor.__repr__' return 'Sensor("%s")' % self._usePath def __eq__( self, other ): """ Two sensors are considered equal if their paths are equal. This is done by comparing their _path attributes so that cached and uncached Sensors compare equal. Examples: >>> Sensor( '/' ) == Sensor( '/1F.440701000000' ) False >>> Sensor( '/' ) == Sensor( '/uncached' ) True """ return self._path == other._path def __hash__(self): """ Return a hash for the Sensor object's name. This allows Sensors to be used better in sets.Set. """ return hash(self._path) def __getattr__( self, name ): """ Retreive an attribute from the sensor. __getattr__ is called only if the named item doesn't exist in the Sensor's namespace. If it's not in the namespace, look for the attribute on the physical sensor. Usage: s = ow.Sensor( '/1F.5D0B01000000' ) print s.family, s.PIO_0 will result in the family and PIO.0 values being read from the sensor and printed. In this example, the family would be 1F and thr PIO.0 might be 1. """ #print 'Sensor.__getattr__', name try: return owfs_get(object.__getattribute__(self, '_attrs')[name]) except KeyError: raise AttributeError, name def __setattr__( self, name, value ): """ Set the value of a sensor attribute. This is accomplished by first determining if the physical sensor has the named attribute. If it does, then the value is written to the name. Otherwise, the Sensor's dictionary is updated with the name and value. Usage: s = ow.Sensor( '/1F.5D0B01000000' ) s.PIO_1 = '1' will set the value of PIO.1 to 1. """ #print 'Sensor.__setattr__', name, value # Life can get tricky when using __setattr__. Self doesn't # have an _attrs atribute when it's initially created. _attrs # is only there after it's been set in __init__. So we can # only reference it if it's already been added. if hasattr( self, '_attrs' ): if name in self._attrs: #print 'owfs_put', self._attrs[ name ], value owfs_put( self._attrs[ name ], value ) else: self.__dict__[ name ] = value else: self.__dict__[ name ] = value def useCache( self, use_cache ): """ Set the sensor to use the underlying owfs cache (or not) depending on the use_cache parameter. Usage: s = ow.Sensor( '/1F.5D0B01000000' ) s.useCache( False ) will set the internal sensor path to /uncached/1F.5D0B01000000. Also: s = ow.Sensor( '/uncached/1F.5D0B01000000' ) s.useCache( True ) will set the internal sensor path to /1F.5D0B01000000. """ self._useCache = use_cache if self._useCache: self._usePath = self._path else: if self._path == '/': self._usePath = '/uncached' else: self._usePath = '/uncached' + self._path if self._path == '/': self._type = owfs_get('bus.0/interface/settings/name') else: self._type = owfs_get( '%s/type' % self._usePath ) self._attrs = dict( [ (n.replace( '.', '_' ), self._usePath + '/' + n ) for n in owfs_get( self._usePath ).split( ',' ) ] ) def entries( self ): """ Generator which yields the attributes of a sensor. """ #print 'Sensor.entries' list = owfs_get( self._usePath ) if list: for entry in list.split( ',' ): try: owfs_get(entry + 'type') except exUnknownSensor, ex: yield entry.split( '/' )[ 0 ] def entryList( self ): """ List of the sensor's attributes. Example: >>> Sensor("/10.B7B64D000800").entryList( ) ['address', 'crc8', 'die', 'family', 'id', 'power', 'present', 'temperature', 'temphigh', 'templow', 'trim', 'trimblanket', 'trimvalid', 'type'] """ #print 'Sensor.entryList' return [ e for e in self.entries( ) ] def sensors( self, names = [ 'main', 'aux' ] ): """ Generator which yields all the sensors that are associated with the current sensor. In the event that the current sensor is the adapter (such as a DS9490 USB adapter) the list of sensors directly attached to the 1-wire network will be yielded. In the event that the current sensor is a microlan controller (such as a DS2409) the list of directories found in the names list parameter will be searched and any sensors found will be yielded. The names parameter defaults to [ 'main', 'aux' ]. """ #print 'Sensor.sensors' if self._type == 'DS2409': for branch in names: path = self._usePath + '/' + branch try: list = owfs_get( path ) except exUnknownSensor, ex: continue if list: for branch_entry in list.split( ',' ): branch_path = self._usePath + '/' + branch + '/' + branch_entry.split( '/' )[ 0 ] try: owfs_get( branch_path + '/type' ) except exUnknownSensor, ex: continue yield Sensor( branch_path ) else: list = owfs_get( self._usePath ) if list: for branch_entry in list.split( ',' ): try: owfs_get( branch_entry + 'type' ) except exUnknownSensor, ex: continue path = self._usePath + '/' + branch_entry.split( '/' )[ 0 ] if path[ :2 ] == '//': path = path[ 1: ] yield Sensor( path ) def sensorList( self, names = [ 'main', 'aux' ] ): """ List of all the sensors that are associated with the current sensor. In the event that the current sensor is the adapter (such as a DS9490 USB adapter) the list of sensors directly attached to the 1-wire network will be yielded. In the event that the current sensor is a microlan controller (such as a DS2409) the list of directories found in the names list parameter will be searched and any sensors found will be yielded. The names parameter defaults to [ 'main', 'aux' ]. Example: >>> Sensor("/1F.440701000000").sensorList( ) [Sensor("/1F.440701000000/main/29.400900000000")] """ #print 'Sensor.sensorList' return [ s for s in self.sensors( ) ] def find( self, **keywords ): """ Generator which yields all the sensors whose attributes match those past in. By default, any matched attribute will yield a sensor. If the parameter all is passed to the find call, then all the supplied attributes must match to yield a sensor. Usage: for s in Sensor( '/' ).find( type = 'DS2408' ): print s will print all the sensors whose type is DS2408. root = Sensor( '/' ) print len( [ s for s in root.find( all = True, family = '1F', type = 'DS2409' ) ] ) will print the count of sensors whose family is 1F and whose type is DS2409. """ #print 'Sensor.find', keywords #recursion = keywords.pop( 'recursion', False ) all = keywords.pop( 'all', False ) for sensor in self.sensors( ): match = 0 for attribute in keywords: if hasattr( sensor, attribute ): if keywords[ attribute ]: if getattr( sensor, attribute ) == keywords[ attribute ]: match = match + 1 else: if hasattr( sensor, attribute ): match = match + 1 if not all and match: yield sensor elif all and match == len( keywords ): yield sensor owfs-2.8p15/module/swig/python/Makefile.in0000664000175000017500000005416511756250031015451 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.29 2008/06/17 11:16:58 d1mag Exp $ 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@ target_triplet = @target@ subdir = module/swig/python DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/setup.py.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = setup.py CONFIG_CLEAN_VPATH_FILES = 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 DATA = $(noinst_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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = ow EXTRA_DIST = python.m4 \ examples/check_ow.py examples/errormessages.py examples/raw_access.py examples/temperature.py examples/tree.py examples/xmlrpc_client.py examples/xmlrpc_server.py \ unittest/Readme.txt unittest/ds1420.py unittest/ds2408.py unittest/ds2409.py unittest/owload.py unittest/owsensors.py unittest/owtest.py unittest/owtest_sample.ini unittest/owtest_think.ini unittest/util.py noinst_DATA = OW.py LIBOW = ../../owlib/src/c/libow.la all: all-recursive .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 module/swig/python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/swig/python/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): setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local 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 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-local ctags ctags-recursive distclean 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-data-local install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am ow_wrap.c: ../ow.i ${LIBOW} $(SWIG) -python -o $@ ../ow.i OW.py: ow_wrap.c setup.py LDFLAGS="$(PYLDFLAGS) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS}" CFLAGS="$(PYCFLAGS) $(PIC_FLAGS)" $(PYTHON) setup.py build # $(PYTHON) setup.py build install-data-local: # OpenSUSE is buggy and install libraries at /usr/local. # Need to add call "install_lib --install-dir" or call "install --install-lib" # $(PYTHON) setup.py install_lib --install-dir="/$(DESTDIR)$(PYSITEDIR)" $(PYTHON) setup.py install --install-lib="$(DESTDIR)$(PYSITEDIR)" # Other options are (but not needed): --install-data="/$(DESTDIR)$(PYSITEDIR)" --install-script="/$(DESTDIR)$(PYSITEDIR)" --install-header= clean-local: @RM@ -f *~ .*~ *.o configuration.log @RM@ -rf build OW.py ow_wrap.c clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/swig/python/unittest/0000775000175000017500000000000011756315511015335 500000000000000owfs-2.8p15/module/swig/python/unittest/owload.py0000775000175000017500000000336710201723315017115 00000000000000#! /usr/bin/env python """ ::BOH $Id: owload.py,v 1.1 2005/02/07 17:35:09 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/owsensors.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Simple test to ensure that the ow module can be loaded and an instance of ow.Sensor created. """ import unittest import sys import os import ConfigParser __version__ = '0.0-%s' % '$Id: owload.py,v 1.1 2005/02/07 17:35:09 peterk Exp $'.split( )[ 2 ] load = True class OWLoad( unittest.TestCase ): def setUp( self ): if not os.path.exists( 'owtest.ini' ): raise IOError, 'owtest.ini' self.config = ConfigParser.ConfigParser( ) self.config.read( 'owtest.ini' ) def testImport( self ): #print 'OWLoad.testImport' import ow ow.init( self.config.get( 'General', 'interface' ) ) s = ow.Sensor( '/' ) def Suite( ): return unittest.makeSuite( OWLoad, 'test' ) if __name__ == "__main__": if len( sys.argv ) > 1: unittest.main( ) else: unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/ds2409.py0000775000175000017500000001016710201730620016546 00000000000000#! /usr/bin/env python """ ::BOH $Id: ds2409.py,v 1.3 2005/02/07 18:21:04 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/ds2409.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Test suite for basic reality checks on a 1-wire nerwork. address/ branch.0/ branch.ALL/ control/ discharge/ event.1/ event.BYTE/ id/ present/ sensed.1/ sensed.BYTE/ aux/ branch.1/ branch.BYTE/ crc8/ event.0/ event.ALL/ family/ main/ sensed.0/ sensed.ALL/ type/ """ import unittest import sys import os import ConfigParser import ow __version__ = '0.0-%s' % '$Id: ds2409.py,v 1.3 2005/02/07 18:21:04 peterk Exp $'.split( )[ 2 ] if not os.path.exists( 'owtest.ini' ): raise IOError, 'owtest.ini' config = ConfigParser.ConfigParser( ) config.read( 'owtest.ini' ) sensors = [ name for name in config.get( 'Root', 'sensors' ).split( ' ' ) ] sensors = [ '/' + name for name in sensors if config.get( name, 'type' ) == 'DS2409' ] if len( sensors ): load = True else: load = False # There seems to be an odd interaction when ds2409 is run from # owtest.py. Once the aux or main attributes are checked, calls to the # controller no longer return the sensors that are there. This is seen # when owsensors.py tests are run. At this point, I'm not sure why # this is so ds2409 is forced not to run from owtest.py. Running it by # itself works just fine. But more testing is needed to understand # what's going on. load = False class DS2409( unittest.TestCase ): def setUp( self ): ow.init( config.get( 'General', 'interface' ) ) def testAttributes( self ): for name in sensors: sensor = ow.Sensor( name ) family, id = name[ 1: ].split( '.' ) self.failUnlessEqual( family + id, sensor.address[ :-2 ] ) #self.failUnlessEqual( config.get( name, 'crc8' ), sensor.crc8 ) self.failUnlessEqual( family, sensor.family ) self.failUnlessEqual( id, sensor.id ) self.failUnlessEqual( '1', sensor.present ) self.failUnlessEqual( config.get( name[ 1: ], 'type' ), sensor.type ) self.failUnlessEqual( hasattr( sensor, 'branch_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'branch_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'branch_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'branch_BYTE' ), True ) self.failUnlessEqual( hasattr( sensor, 'control' ), True ) #self.failUnlessEqual( hasattr( sensor, 'discharge' ), True ) self.failUnlessEqual( hasattr( sensor, 'event_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'event_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'event_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'event_BYTE' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_BYTE' ), True ) def Suite( ): return unittest.makeSuite( DS2409, 'test' ) if __name__ == "__main__": if len( sys.argv ) > 1: unittest.main( ) else: unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/ds2408.py0000775000175000017500000001771710201771634016567 00000000000000#! /usr/bin/env python """ ::BOH $Id: ds2408.py,v 1.4 2005/02/07 23:02:52 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/ds2408.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Test suite for basic reality checks on a 1-wire network. PIO.0/ PIO.1/ PIO.2/ PIO.3/ PIO.4/ PIO.5/ PIO.6/ PIO.7/ PIO.ALL/ PIO.BYTE/ address/ crc8/ family/ id/ latch.0/ latch.1/ latch.2/ latch.3/ latch.4/ latch.5/ latch.6/ latch.7/ latch.ALL/ latch.BYTE/ power/ present/ reset/ sensed.0/ sensed.1/ sensed.2/ sensed.3/ sensed.4/ sensed.5/ sensed.6/ sensed.7/ sensed.ALL/ sensed.BYTE/ set_alarm/ strobe/ type/ """ import unittest import sys import os import ConfigParser import ow import util __version__ = '0.0-%s' % '$Id: ds2408.py,v 1.4 2005/02/07 23:02:52 peterk Exp $'.split( )[ 2 ] if not os.path.exists( 'owtest.ini' ): raise IOError, 'owtest.ini' config = ConfigParser.ConfigParser( ) config.read( 'owtest.ini' ) sensors = util.find_config( config, 'DS2408' ) if len( sensors ): load = True else: load = False class DS2408( unittest.TestCase ): def setUp( self ): ow.init( config.get( 'General', 'interface' ) ) def testAttributes( self ): self.failIfEqual( len( sensors ), 0 ) for name in sensors: sensor = ow.Sensor( name ) family, id = name.split( '/' )[ -1 ].split( '.' ) self.failUnlessEqual( family + id, sensor.address[ :-2 ] ) #self.failUnlessEqual( config.get( name, 'crc8' ), sensor.crc8 ) self.failUnlessEqual( family, sensor.family ) self.failUnlessEqual( id, sensor.id ) self.failUnlessEqual( '1', sensor.present ) self.failUnlessEqual( config.get( name.split( '/' )[ -1 ], 'type' ), sensor.type ) self.failUnlessEqual( hasattr( sensor, 'PIO_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_2' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_3' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_4' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_5' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_6' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_7' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'PIO_BYTE' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_2' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_3' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_4' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_5' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_6' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_7' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'latch_BYTE' ), True ) self.failUnlessEqual( hasattr( sensor, 'power' ), True ) self.failUnlessEqual( hasattr( sensor, 'reset' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_0' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_1' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_2' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_3' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_4' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_5' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_6' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_7' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_ALL' ), True ) self.failUnlessEqual( hasattr( sensor, 'sensed_BYTE' ), True ) self.failUnlessEqual( hasattr( sensor, 'set_alarm' ), True ) self.failUnlessEqual( hasattr( sensor, 'strobe' ), True ) def testSet( self ): self.failIfEqual( len( sensors ), 0 ) for name in sensors: sensor = ow.Sensor( name ) sensor.PIO_0 = '0' #print sensor._path + '/PIO.0' self.failUnlessEqual( ow._OW.get( sensor._path + '/PIO.0' ), '0' ) self.failUnlessEqual( sensor.PIO_0, '0' ) self.failUnlessEqual( 'PIO_0' in dir( sensor ), False ) sensor.PIO_0 = '1' self.failUnlessEqual( sensor.PIO_0, '1' ) self.failUnlessEqual( 'PIO_0' in dir( sensor ), False ) sensor.PIO_1 = '0' self.failUnlessEqual( sensor.PIO_1, '0' ) self.failUnlessEqual( 'PIO_1' in dir( sensor ), False ) sensor.PIO_1 = '1' self.failUnlessEqual( sensor.PIO_1, '1' ) self.failUnlessEqual( 'PIO_1' in dir( sensor ), False ) sensor.PIO_2 = '0' self.failUnlessEqual( sensor.PIO_2, '0' ) self.failUnlessEqual( 'PIO_2' in dir( sensor ), False ) sensor.PIO_2 = '1' self.failUnlessEqual( sensor.PIO_2, '1' ) self.failUnlessEqual( 'PIO_2' in dir( sensor ), False ) sensor.PIO_3 = '0' self.failUnlessEqual( sensor.PIO_3, '0' ) self.failUnlessEqual( 'PIO_3' in dir( sensor ), False ) sensor.PIO_3 = '1' self.failUnlessEqual( sensor.PIO_3, '1' ) self.failUnlessEqual( 'PIO_3' in dir( sensor ), False ) sensor.PIO_4 = '0' self.failUnlessEqual( sensor.PIO_4, '0' ) self.failUnlessEqual( 'PIO_4' in dir( sensor ), False ) sensor.PIO_4 = '1' self.failUnlessEqual( sensor.PIO_4, '1' ) self.failUnlessEqual( 'PIO_4' in dir( sensor ), False ) sensor.PIO_5 = '0' self.failUnlessEqual( sensor.PIO_5, '0' ) self.failUnlessEqual( 'PIO_5' in dir( sensor ), False ) sensor.PIO_5 = '1' self.failUnlessEqual( sensor.PIO_5, '1' ) self.failUnlessEqual( 'PIO_5' in dir( sensor ), False ) sensor.PIO_6 = '0' self.failUnlessEqual( sensor.PIO_6, '0' ) self.failUnlessEqual( 'PIO_6' in dir( sensor ), False ) sensor.PIO_6 = '1' self.failUnlessEqual( sensor.PIO_6, '1' ) self.failUnlessEqual( 'PIO_6' in dir( sensor ), False ) sensor.PIO_7 = '0' self.failUnlessEqual( sensor.PIO_7, '0' ) self.failUnlessEqual( 'PIO_7' in dir( sensor ), False ) sensor.PIO_7 = '1' self.failUnlessEqual( sensor.PIO_7, '1' ) self.failUnlessEqual( 'PIO_7' in dir( sensor ), False ) def Suite( ): return unittest.makeSuite( DS2408, 'test' ) if __name__ == "__main__": if len( sys.argv ) > 1: unittest.main( ) else: unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/owtest_sample.ini0000664000175000017500000000446710201723315020644 00000000000000#::BOH # $Id: owtest_sample.ini,v 1.4 2005/02/07 17:35:09 peterk Exp $ # $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/owtest.ini $ # # Copyright (c) 2004 Peter Kropf. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #::EOH # # 1-wire unittest sample configuration file # The general section defines how the ow libraries are to be # initialized. # # interface - u | s | tty_path # Defines how the OW libraries are to communicate with the 1-wire # network. # # u - Use the USB controller # host:3001 - Talk with the OW server on host using port 3001 # tty_path - full path to the serial port [General] interface = u #interface = host:3001 #interface = /dev/ttyS0 # The root section defines the attributes and sensors that are # attached to the root branch of the 1-wire network. # # entries - names of all the attributes that are to be found in the # root. # # sensors - names of all the sensors that are attached to the root. [Root] entries = alarm settings simultaneous statistics structure system uncached sensors = 10.B7B64D000800 type = DS9490 # Each sensor that's attached to the 1-wire network should have a # section named after it. # # type - the type of the sensor # # parent - path to the controller or microlan this sensor is connected # to. # # branch - if the sensor is on a microlan, which branch is it on (main # or aux) # # main_sensors - names of all the sensors that are attached to the # main branch. This is valid for DS2409 type sensors only. # # aux_sensors - names of all the sensors that are attached to the aux # branch. This is valid for DS2409 type sensors only. [10.B7B64D000800] type = DS18S20 parent = / #branch = owfs-2.8p15/module/swig/python/unittest/Readme.txt0000664000175000017500000000516710201723314017210 00000000000000$Id: Readme.txt,v 1.2 2005/02/07 17:35:08 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/Readme.txt $ Unittests Status As of 2/7/2005, the OWSensor.testCacheUncached and OWSensor.testSensorList unittest will fail. This seems to be caused by a reading from the cached and then uncached trees. Under the right circumstances, it looks like the uncached tree doesn't show sensors connected to a ds2409 microlan controller. The problem has been reproduced with the Perl interface so it appears that it's not directly related to the Python module. But more work is needed to verify and resolve the issue. Environment The unittests expect that ow has been installed into the Python installation such that "import ow" works. This can be accomplished via the "python setup.py install" command or by adding the directory that contains the ow module to the PYTHONPATH environment variable. For example, to setup the unittest environment on a linux system after OWFS has been built but before is has been installed: export PYTHONPATH=$(PATH_TO_OWFS)/module/swig/python/build/lib.linux-i686-2.3/ Configuration The unittests require a configuration file that defines the layout of the 1-wire network to be used in testing. The configuration file should be named owtest.ini and should exist in the unittest directory. See owtest_sample.ini for a description of the configuration file. Running Unittests The owtest.py program is the main driver to run all unittests. It will look for all python modules in the current directory, include the test suites that it defines if the module's load variable is true. For example: root@think:/home/peter/src/owfs/module/swig/python/unittest> ./owtest.py testAttributes (ds1420.DS1420) ... ok testBaseAttributes (owsensors.OWSensors) ... ok testEntries (owsensors.OWSensors) ... ok testFindAll (owsensors.OWSensors) ... ok testFindAllNone (owsensors.OWSensors) ... ok testFindAnyNoValue (owsensors.OWSensors) ... ok testFindAnyNone (owsensors.OWSensors) ... ok testFindAnyValue (owsensors.OWSensors) ... ok testSensors (owsensors.OWSensors) ... ok ---------------------------------------------------------------------- Ran 9 tests in 0.688s OK The individual test cases can also be run. For example: $ ./ds1420.py testAttributes (__main__.DS1420) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.117s OK owfs-2.8p15/module/swig/python/unittest/owtest.py0000775000175000017500000000403110173527732017157 00000000000000#! /usr/bin/env python """ ::BOH $Id: owtest.py,v 1.1 2005/01/19 19:07:06 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/owtest.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Run all the tests from the modules in the current directory. """ import sys import os import glob import unittest __version__ = '0.0-%s' % '$Id: owtest.py,v 1.1 2005/01/19 19:07:06 peterk Exp $'.split( )[ 2 ] def Suite( ): """ Function used by unittest.TextTestRunner to create the suite of test cases that are found in the current directory. All modules except the current one are considered test cases and will be added to the list of test suites to be run. """ this_module_name = os.path.basename( __file__ ) test_suites = unittest.TestSuite( ) for name in glob.glob( '*.py' ): if name == this_module_name: continue name = name[:-3] try: exec 'import ' + name exec 'load = ' + name + '.load' if load: exec 'suite = ' + name + '.Suite( )' test_suites = unittest.TestSuite( ( test_suites, suite ) ) except AttributeError: print 'skipping ' + name + ' no Suite function found.' pass return test_suites suite = Suite( ) if __name__ == "__main__": unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/ds1420.py0000775000175000017500000000464610201723314016545 00000000000000#! /usr/bin/env python """ ::BOH $Id: ds1420.py,v 1.3 2005/02/07 17:35:08 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/ds1420.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Test suite for basic reality checks on a 1-wire nerwork. address/ crc8/ family/ id/ present/ type/ """ import unittest import sys import os import ConfigParser import ow __version__ = '0.0-%s' % '$Id: ds1420.py,v 1.3 2005/02/07 17:35:08 peterk Exp $'.split( )[ 2 ] if not os.path.exists( 'owtest.ini' ): raise IOError, 'owtest.ini' config = ConfigParser.ConfigParser( ) config.read( 'owtest.ini' ) sensors = [ name for name in config.get( 'Root', 'sensors' ).split( ' ' ) ] sensors = [ '/' + name for name in sensors if config.get( name, 'type' ) == 'DS1420' ] if len( sensors ): load = True else: load = False class DS1420( unittest.TestCase ): def setUp( self ): ow.init( config.get( 'General', 'interface' ) ) def testAttributes( self ): self.failIfEqual( len( sensors ), 0 ) for name in sensors: sensor = ow.Sensor( name ) family, id = name[ 1: ].split( '.' ) self.failUnlessEqual( family + id, sensor.address[ :-2 ] ) #self.failUnlessEqual( config.get( name, 'crc8' ), sensor.crc8 ) self.failUnlessEqual( family, sensor.family ) self.failUnlessEqual( id, sensor.id ) self.failUnlessEqual( config.get( name[ 1: ], 'type' ), sensor.type ) def Suite( ): return unittest.makeSuite( DS1420, 'test' ) if __name__ == "__main__": if len( sys.argv ) > 1: unittest.main( ) else: unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/owsensors.py0000775000175000017500000002033210201723315017661 00000000000000#! /usr/bin/env python """ ::BOH $Id: owsensors.py,v 1.2 2005/02/07 17:35:09 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/owsensors.py $ Copyright (c) 2004 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Test suite for basic reality checks on a 1-wire nerwork. """ import unittest import sys import os import ConfigParser import ow __version__ = '0.0-%s' % '$Id: owsensors.py,v 1.2 2005/02/07 17:35:09 peterk Exp $'.split( )[ 2 ] load = True class OWSensors( unittest.TestCase ): def setUp( self ): #print 'OWSensors.setup' if not os.path.exists( 'owtest.ini' ): raise IOError, 'owtest.ini' self.config = ConfigParser.ConfigParser( ) self.config.read( 'owtest.ini' ) ow.init( self.config.get( 'General', 'interface' ) ) self.entries = self.config.get( 'Root', 'entries' ).split( ' ' ) self.entries.sort( ) self.sensors = [ '/' + name for name in self.config.get( 'Root', 'sensors' ).split( ' ' ) ] self.sensors.sort( ) def testRootNameType( self ): #print 'OWSensors.testRootNameType' path, name = str( ow.Sensor( '/' ) ).split( ' - ' ) self.failUnlessEqual( path, '/' ) self.failUnlessEqual( name, self.config.get( 'Root', 'type' ) ) def testRootEntries( self ): #print 'OWSensors.testRootEntries' entries = list( ow.Sensor( '/' ).entries( ) ) entries.sort( ) self.failUnlessEqual( entries, self.entries ) def testSensors( self ): #print 'OWSensors.testSensors' sensors = [ str( sensor ).split( ' - ' )[ 0 ] for sensor in ow.Sensor( '/' ).sensors( ) ] sensors.sort( ) self.failUnlessEqual( sensors, self.sensors ) def testBaseAttributes( self ): #print 'OWSensors.testBaseAttributes' for sensor in ow.Sensor( '/' ).sensors( ): name = str( sensor ).split( ' - ' )[ 0 ][ 1: ] family, id = name.split( '.' ) self.failUnlessEqual( family + id, sensor.address[ :-2 ] ) #self.failUnlessEqual( self.config.get( name, 'crc8' ), sensor.crc8 ) self.failUnlessEqual( family, sensor.family ) self.failUnlessEqual( id, sensor.id ) self.failUnlessEqual( self.config.get( name, 'type' ), sensor.type ) def testFindAnyValue( self ): #print 'OWSensors.testFindAnyValue' type_list = { } for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): id_type = self.config.get( id, 'type' ) try: type_list[ id_type ] += 1 except KeyError: type_list[ id_type ] = 1 for id_type in type_list: sensor_list = [ sensor for sensor in ow.Sensor( '/' ).find( type = id_type ) ] self.failUnlessEqual( len( sensor_list ), type_list[ id_type ] ) def testFindAnyNoValue( self ): #print 'OWSensors.testFindAnyNoValue' type_count = len( self.config.get( 'Root', 'sensors' ).split( ' ' ) ) sensor_list = [ sensor for sensor in ow.Sensor( '/' ).find( type = None ) ] self.failUnlessEqual( len( sensor_list ), type_count ) def testFindAnyNone( self ): #print 'OWSensors.testFindNone' sensor_list = [ sensor for sensor in ow.Sensor( '/' ).find( xyzzy = None ) ] self.failUnlessEqual( len( sensor_list ), 0 ) def testFindAll( self ): #print 'OWSensors.testFindAll' list = { } for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): family = id.split( '.' )[ 0 ] id_type = self.config.get( id, 'type' ) try: list[ ( family, id_type ) ] += 1 except KeyError: list[ ( family, id_type ) ] = 1 for pair in list: sensor_list = [ sensor for sensor in ow.Sensor( '/' ).find( all = True, family = pair[ 0 ], type = pair[ 1 ] ) ] self.failUnlessEqual( len( sensor_list ), list[ pair ] ) def testFindAllNone( self ): #print 'OWSensors.testFindAllNone' list = { } for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): family = id.split( '.' )[ 0 ] id_type = self.config.get( id, 'type' ) try: list[ ( family, id_type ) ] += 1 except KeyError: list[ ( family, id_type ) ] = 1 for pair in list: sensor_list = [ sensor for sensor in ow.Sensor( '/' ).find( all = True, xyzzy = True, family = pair[ 0 ], type = pair[ 1 ] ) ] self.failUnlessEqual( len( sensor_list ), 0 ) def testCacheUncached( self ): for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): c = ow.Sensor( '/' + id ) u = ow.Sensor( '/uncached/' + id ) self.failUnlessEqual( c._path, u._path ) ce = [ entry for entry in c.entries( ) ] ue = [ entry for entry in u.entries( ) ] self.failUnlessEqual( ce, ue ) cs = [ sensor for sensor in c.sensors( ) ] us = [ sensor for sensor in u.sensors( ) ] self.failUnlessEqual( cs, us ) def testCacheSwitch( self ): for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): s = ow.Sensor( '/' + id ) ce = s.entryList( ) cs = s.sensorList( ) s.useCache( False ) ue = s.entryList( ) us = s.sensorList( ) self.failUnlessEqual( ce, ue ) self.failUnlessEqual( cs, us ) def testRootCache( self ): r = ow.Sensor( '/' ) ce = r.entryList( ) cs = r.sensorList( ) r.useCache( False ) ue = r.entryList( ) us = r.sensorList( ) self.failUnlessEqual( cs, us ) self.failUnlessEqual( ue, [ 'alarm', 'simultaneous' ] ) def testEntryList( self ): for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): c = ow.Sensor( '/' + id ) u = ow.Sensor( '/uncached/' + id ) ce = [ entry for entry in c.entries( ) ] self.failUnlessEqual( ce, c.entryList( ) ) ue = [ entry for entry in u.entries( ) ] self.failUnlessEqual( ue, u.entryList( ) ) self.failUnlessEqual( ce, ue ) def testSensorList( self ): for id in self.config.get( 'Root', 'sensors' ).split( ' ' ): c = ow.Sensor( '/' + id ) u = ow.Sensor( '/uncached/' + id ) cs = [ sensor for sensor in c.sensors( ) ] self.failUnlessEqual( cs, c.sensorList( ) ) us = [ sensor for sensor in u.sensors( ) ] self.failUnlessEqual( us, u.sensorList( ) ) self.failUnlessEqual( cs, us ) def testEqual( self ): s1 = ow.Sensor( '/' ) s2 = ow.Sensor( '/' ) s3 = ow.Sensor( self.config.get( 'Root', 'sensors' ).split( ' ' )[ 0 ] ) self.failUnlessEqual( s1, s2 ) self.failIfEqual( s1, s3 ) self.failIfEqual( s2, s3 ) def Suite( ): return unittest.makeSuite( OWSensors, 'test' ) if __name__ == "__main__": if len( sys.argv ) > 1: unittest.main( ) else: unittest.TextTestRunner( verbosity=2 ).run( Suite( ) ) owfs-2.8p15/module/swig/python/unittest/util.py0000664000175000017500000000315110177001224016571 00000000000000#! /usr/bin/env python """ ::BOH $Id: util.py,v 1.1 2005/01/29 21:39:32 peterk Exp $ Copyright (c) 2005 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH Utility functions for unittests. """ __version__ = '0.0-%s' % '$Id: util.py,v 1.1 2005/01/29 21:39:32 peterk Exp $'.split( )[ 2 ] load = False def find_config( config, type ): """ Returns a list of sensor path names for all the sensors found in the various sections of a ConfigParser .ini file. [ '/29.400001001234', '/1F.440701000000/main/29.400900000000' ] """ sensors = [ ] for section in config.sections( ): if config.has_option( section, 'type' ): if config.get( section, 'type' ) == type: parent = config.get( section, 'parent' ) if parent == '/': sensors.append( '/' + section ) else: sensors.append( parent + '/' + config.get( section, 'branch' ) + '/' + section ) return sensors owfs-2.8p15/module/swig/python/unittest/owtest_think.ini0000664000175000017500000000320610201723315020466 00000000000000#::BOH # $Id: owtest_think.ini,v 1.4 2005/02/07 17:35:09 peterk Exp $ # $HeadURL: http://subversion/stuff/svn/owfs/trunk/unittest/owtest.ini $ # # Copyright (c) 2004 Peter Kropf. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #::EOH # # 1-wire unittest configuration file for the host called think [General] #interface = u interface = localhost:3003 [Root] entries = alarm settings simultaneous statistics structure system uncached sensors = 10.B7B64D000800 1F.440701000000 1F.5D0B01000000 1F.7F0901000000 81.A44C23000000 type = DS9490 [10.B7B64D000800] type = DS18S20 parent = / #branch = [1F.440701000000] type = DS2409 main_sensors = 29.400900000000 aux_sensors = parent = / #branch = [1F.5D0B01000000] type = DS2409 #main_sensors = #aux_sensors = parent = / #branch = [1F.7F0901000000] type = DS2409 #main_sensors = #aux_sensors = parent = / #branch = [81.A44C23000000] type = DS1420 parent = / #branch = [29.400900000000] type = DS2408 parent = /1F.440701000000 branch = main owfs-2.8p15/module/swig/python/Makefile.am0000664000175000017500000000245311025716452015434 00000000000000# $Id: Makefile.am,v 1.29 2008/06/17 11:16:58 d1mag Exp $ SUBDIRS = ow EXTRA_DIST = python.m4 \ examples/check_ow.py examples/errormessages.py examples/raw_access.py examples/temperature.py examples/tree.py examples/xmlrpc_client.py examples/xmlrpc_server.py \ unittest/Readme.txt unittest/ds1420.py unittest/ds2408.py unittest/ds2409.py unittest/owload.py unittest/owsensors.py unittest/owtest.py unittest/owtest_sample.ini unittest/owtest_think.ini unittest/util.py noinst_DATA = OW.py LIBOW = ../../owlib/src/c/libow.la ow_wrap.c: ../ow.i ${LIBOW} $(SWIG) -python -o $@ ../ow.i OW.py: ow_wrap.c setup.py LDFLAGS="$(PYLDFLAGS) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS}" CFLAGS="$(PYCFLAGS) $(PIC_FLAGS)" $(PYTHON) setup.py build # $(PYTHON) setup.py build install-data-local: # OpenSUSE is buggy and install libraries at /usr/local. # Need to add call "install_lib --install-dir" or call "install --install-lib" # $(PYTHON) setup.py install_lib --install-dir="/$(DESTDIR)$(PYSITEDIR)" $(PYTHON) setup.py install --install-lib="$(DESTDIR)$(PYSITEDIR)" # Other options are (but not needed): --install-data="/$(DESTDIR)$(PYSITEDIR)" --install-script="/$(DESTDIR)$(PYSITEDIR)" --install-header= clean-local: @RM@ -f *~ .*~ *.o configuration.log @RM@ -rf build OW.py ow_wrap.c clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/swig/python/python.m40000664000175000017500000001640011016245446015160 00000000000000#------------------------------------------------------------------------ # SC_PATH_PYTHONCONFIG -- # # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-pythonconfig=... # --with-python=... # # Defines the following vars: # #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_PYTHON], [AC_PREREQ(2.57)dnl #---------------------------------------------------------------- # Look for Python #---------------------------------------------------------------- PYCFLAGS= PYLDFLAGS= PYLIB= PYVERSION= PYSITEDIR= AC_ARG_WITH(python, [ --with-python Set location of Python executable],[ PYBIN="$withval"], [PYBIN=yes]) AC_ARG_WITH(pythonconfig, [ --with-pythonconfig Set location of python-config executable],[ PYTHONCONFIGBIN="$withval"], [PYTHONCONFIGBIN=yes]) if test "x$PYTHONCONFIGBIN" = xyes; then AC_CHECK_PROGS(PYTHONCONFIG, python-config python2.5-config python2.4-config python2.3-config) else PYTHONCONFIG="$PYTHONCONFIGBIN" fi # First, check for "--without-python" or "--with-python=no". if test x"${PYBIN}" = xno -o x"${with_alllang}" = xno ; then AC_MSG_NOTICE([Disabling Python]) else # First figure out the name of the Python executable if test "x$PYBIN" = xyes; then AC_CHECK_PROGS(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python) else PYTHON="$PYBIN" fi if test ! -z "$PYTHONCONFIG"; then # python-config available. AC_MSG_CHECKING(for Python cflags) PYTHONCFLAGS="`$PYTHONCONFIG --cflags 2>/dev/null`" if test -z "$PYTHONCFLAGS"; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PYTHONCFLAGS) fi PYCFLAGS=$PYTHONCFLAGS AC_MSG_CHECKING(for Python ldflags) PYTHONLDFLAGS="`$PYTHONCONFIG --ldflags 2>/dev/null`" if test -z "$PYTHONLDFLAGS"; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PYTHONLDFLAGS) fi PYLDFLAGS=$PYTHONLDFLAGS AC_MSG_CHECKING(for Python libs) PYTHONLIBS="`$PYTHONCONFIG --libs 2>/dev/null`" if test -z "$PYTHONLIBS"; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PYTHONLIBS) fi PYLIB="$PYTHONLIBS" # Need to do this hack since autoconf replaces __file__ with the name of the configure file filehack="file__" PYVERSION=`($PYTHON -c "import string,operator,os.path; print operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1)")` AC_MSG_RESULT($PYVERSION) AC_MSG_CHECKING(for Python exec-prefix) PYTHONEPREFIX="`$PYTHONCONFIG --exec-prefix 2>/dev/null`" if test -z "$PYTHONEPREFIX"; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PYTHONEPREFIX) fi PYEPREFIX="$PYTHONEPREFIX" AC_MSG_CHECKING(for Python site-dir) #This seem to be the site-packages dir where files are installed. PYSITEDIR=`($PYTHON -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1)") 2>/dev/null` if test -z "$PYSITEDIR"; then # I'm not really sure if it should be installed at /usr/lib64... if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages" else if test -d "$PYEPREFIX/lib/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib/$PYVERSION/site-packages" fi fi fi AC_MSG_RESULT($PYSITEDIR) else # python-config not available. if test -n "$PYTHON"; then AC_MSG_CHECKING(for Python prefix) PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null` AC_MSG_RESULT($PYPREFIX) AC_MSG_CHECKING(for Python exec-prefix) PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null` AC_MSG_RESULT($PYEPREFIX) # Note: I could not think of a standard way to get the version string from different versions. # This trick pulls it out of the file location for a standard library file. AC_MSG_CHECKING(for Python version) # Need to do this hack since autoconf replaces __file__ with the name of the configure file filehack="file__" PYVERSION=`($PYTHON -c "import string,operator,os.path; print operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1)")` AC_MSG_RESULT($PYVERSION) # Find the directory for libraries this is necessary to deal with # platforms that can have apps built for multiple archs: e.g. x86_64 AC_MSG_CHECKING(for Python lib dir) PYLIBDIR=`($PYTHON -c "import sys; print sys.lib") 2>/dev/null` if test -z "$PYLIBDIR"; then # older versions don't have sys.lib so the best we can do is assume lib #PYLIBDIR="lib$LIBPOSTFIX" if test -r $PYPREFIX/include/$PYVERSION/Python.h; then if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/config"; then PYLIBDIR="lib$LIBPOSTFIX" else if test -d "$PYEPREFIX/lib/$PYVERSION/config"; then # for some reason a 64bit system could have libs installed at lib PYLIBDIR="lib" else # I doubt this will work PYLIBDIR="lib$LIBPOSTFIX" fi fi else # probably very old installation... PYLIBDIR="lib" fi fi AC_MSG_RESULT($PYLIBDIR) AC_MSG_CHECKING(for Python site-dir) PYSITEDIR=`($PYTHON -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=1)") 2>/dev/null` if test -z "$PYSITEDIR"; then # I'm not really sure if it should be installed at /usr/lib64... if test -d "$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib$LIBPOSTFIX/$PYVERSION/site-packages" else if test -d "$PYEPREFIX/lib/$PYVERSION/site-packages"; then PYSITEDIR="$PYEPREFIX/lib/$PYVERSION/site-packages" fi fi fi AC_MSG_RESULT($PYSITEDIR) # Set the include directory AC_MSG_CHECKING(for Python header files) if test -r $PYPREFIX/include/$PYVERSION/Python.h; then PYCFLAGS="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/$PYLIBDIR/$PYVERSION/config" fi if test -z "$PYCFLAGS"; then if test -r $PYPREFIX/include/Py/Python.h; then PYCFLAGS="-I$PYPREFIX/include/Py -I$PYEPREFIX/$PYLIBDIR/python/lib" fi fi AC_MSG_RESULT($PYCFLAGS) # Set the library directory blindly. This probably won't work with older versions AC_MSG_CHECKING(for Python library) dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR" for i in $dirs; do if test -d $PYEPREFIX/$PYLIBDIR/$i; then PYLIB="$PYEPREFIX/$PYLIBDIR/$i" break fi done if test -z "$PYLIB"; then AC_MSG_RESULT(Not found) else AC_MSG_RESULT($PYLIB) fi AC_MSG_CHECKING(for Python LDFLAGS) # Check for really old versions if test -r $PYLIB/libPython.a; then PYLINK="-lModules -lPython -lObjects -lParser" else if test ! -r $PYLIB/lib$PYVERSION.so -a -r $PYLIB/lib$PYVERSION.a ; then # python2.2 on FC1 need this PYLINK="$PYLIB/lib$PYVERSION.a" else PYLINK="-l$PYVERSION" fi fi PYLDFLAGS="$PYLINK" AC_MSG_RESULT($PYLDFLAGS) fi fi # Cygwin (Windows) needs the library for dynamic linking case $host in *-*-cygwin* | *-*-mingw*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK" DEFS="-DUSE_DL_IMPORT $DEFS" PYCFLAGS="$PYCFLAGS" ;; *)PYTHONDYNAMICLINKING="";; esac fi ]) owfs-2.8p15/module/swig/php/0000775000175000017500000000000011756315511012724 500000000000000owfs-2.8p15/module/swig/php/php_OW.h0000664000175000017500000000242011754552414014212 00000000000000/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.4 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #ifndef PHP_OW_H #define PHP_OW_H extern zend_module_entry OW_module_entry; #define phpext_OW_ptr &OW_module_entry #ifdef PHP_WIN32 # define PHP_OW_API __declspec(dllexport) #else # define PHP_OW_API #endif #ifdef ZTS #include "TSRM.h" #endif PHP_MINIT_FUNCTION(OW); PHP_MSHUTDOWN_FUNCTION(OW); PHP_RINIT_FUNCTION(OW); PHP_RSHUTDOWN_FUNCTION(OW); PHP_MINFO_FUNCTION(OW); ZEND_NAMED_FUNCTION(_wrap_version); ZEND_NAMED_FUNCTION(_wrap_init); ZEND_NAMED_FUNCTION(_wrap_get); ZEND_NAMED_FUNCTION(_wrap_put); ZEND_NAMED_FUNCTION(_wrap_finish); ZEND_NAMED_FUNCTION(_wrap_set_error_print); ZEND_NAMED_FUNCTION(_wrap_get_error_print); ZEND_NAMED_FUNCTION(_wrap_set_error_level); ZEND_NAMED_FUNCTION(_wrap_get_error_level); ZEND_NAMED_FUNCTION(_wrap_opt); #endif /* PHP_OW_H */ owfs-2.8p15/module/swig/php/Makefile.in0000664000175000017500000005374111756250031014716 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.27 2011/02/28 15:06:31 alfille Exp $ 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@ target_triplet = @target@ subdir = module/swig/php DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am_libowphp_la_OBJECTS = ow_wrap.lo libowphp_la_OBJECTS = $(am_libowphp_la_OBJECTS) libowphp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libowphp_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libowphp_la_SOURCES) DIST_SOURCES = $(libowphp_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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@ # Something like /usr/lib/php4, /usr/lib/php5/20041030, /usr/lib/php/modules/ or /usr/lib64/php/modules/ libdir = $(EXTENSION_DIR) 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = php.m4 example/owdir.php example/load_php_OW.php.in example/load_php_OW.php #noinst_DATA = ow_wrap.c php_OW.h #use libtool to build the php extension lib_LTLIBRARIES = libowphp.la libowphp_la_LIBADD = ../../owlib/src/c/libow.la libowphp_la_DEPENDENCIES = ../../owlib/src/c/libow.la libowphp_la_LDFLAGS = -shared -shrext .so # Older php installations doesn't handle owfs_config.h filename, and tries # to include non-existing config.h if HAVE_CONFIG_H is defined. #DEFS+= -UHAVE_CONFIG_H EXTENSION_DIR = @PHPLIBDIR@ AM_CFLAGS = -fexceptions \ -I.. \ -I$(top_srcdir)/src/include \ -I$(top_srcdir)/module/owlib/src/include \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ @PHPINC@ LDADD = -L../../owlib/src/c -low ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} libowphp_la_SOURCES = ow_wrap.c php_OW.h 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 module/swig/php/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/swig/php/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 libowphp.la: $(libowphp_la_OBJECTS) $(libowphp_la_DEPENDENCIES) $(EXTRA_libowphp_la_DEPENDENCIES) $(libowphp_la_LINK) -rpath $(libdir) $(libowphp_la_OBJECTS) $(libowphp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_wrap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 clean-local \ 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-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-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-local 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-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-libLTLIBRARIES ow_wrap.c: ../ow.i # avoid problem when "make dist" and there are no swig available @ENABLE_OWPHP_TRUE@ $(SWIG) -php -o $@ ../ow.i @ENABLE_OWPHP_FALSE@ touch ow_wrap.c php_OW.h #install-data-local: # @INSTALL@ -d $(DESTDIR)$(EXTENSION_DIR) # @INSTALL@ $(DESTDIR)${libdir}/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/ # ln -sf ${exec_prefix}/lib/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/libowphp.so # ln -sf ../../../lib/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/php_OW.so clean-local: @RM@ -f *~ .*~ *.o OW.* ow_wrap.c php_OW.h clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/swig/php/php.m40000664000175000017500000000351611536703174013704 00000000000000#------------------------------------------------------------------------- # Look for Php5 or Php4 #------------------------------------------------------------------------- AC_DEFUN([SC_PATH_PHP], [AC_PREREQ(2.57)dnl PHP4BIN= #AC_ARG_WITH(php4, AS_HELP_STRING([--without-php4], [Disable PHP4]) #AS_HELP_STRING([--with-php4=path], [Set location of PHP4 executable]),[ PHP4BIN="$withval"], [PHP4BIN=yes]) AC_ARG_WITH(php, [ --with-php Set location of Php executable],[ PHPBIN="$withval"], [PHPBIN=yes]) AC_ARG_WITH(phpconfig, [ --with-phpconfig Set location of php-config executable],[ PHPCONFIGBIN="$withval"], [PHPCONFIGBIN=yes]) # First, check for "--without-php" or "--with-php=no". if test x"${PHPBIN}" = xno -o x"${with_alllang}" = xno ; then AC_MSG_NOTICE([Disabling PHP]) else if test "x$PHPBIN" = xyes; then AC_CHECK_PROGS(PHP, php php5 php4) else PHP="$PHPBIN" fi if test "x$PHPCONFIGBIN" = xyes; then AC_CHECK_PROGS(PHPCONFIG, php-config php5-config php-config5 php4-config php-config4) else PHPCONFIG="$PHPCONFIGBIN" fi AC_MSG_CHECKING(for PHP header files) PHPINC="`$PHPCONFIG --includes 2>/dev/null`" if test "$PHPINC"; then AC_MSG_RESULT($PHPINC) else dirs="/usr/include/php /usr/local/include/php /usr/include/php5 /usr/local/include/php5 /usr/include/php4 /usr/local/include/php4 /usr/local/apache/php" for i in $dirs; do echo $i if test -r $i/main/php_config.h -o -r $i/main/php_version.h; then AC_MSG_RESULT($i is found) PHPEXT="$i" PHPINC="-I$PHPEXT -I$PHPEXT/main -I$PHPEXT/TSRM -I$PHPEXT/Zend" break; fi done fi if test -z "$PHPINC"; then AC_MSG_RESULT(not found) fi AC_MSG_CHECKING(for PHP extension-dir) PHPLIBDIR="`$PHPCONFIG --extension-dir 2>/dev/null`" if test ! -z "$PHPLIBDIR"; then AC_MSG_RESULT($PHPLIBDIR) else AC_MSG_RESULT(not found) fi fi ]) owfs-2.8p15/module/swig/php/example/0000775000175000017500000000000011756315511014357 500000000000000owfs-2.8p15/module/swig/php/example/load_php_OW.php0000664000175000017500000000135711756250044017210 00000000000000 owfs-2.8p15/module/swig/php/example/load_php_OW.php.in0000664000175000017500000000134410441037217017604 00000000000000 owfs-2.8p15/module/swig/php/example/owdir.php0000775000175000017500000000150611024165113016126 00000000000000 2 ) { $dir = $argv[2]; } else { $dir = "/"; } #initialize the 1-wire bus with given argument $init_result = init( $adapter ); if ( $init_result != '1' ) { echo "could not initialize the 1-wire bus.\n"; } else { $list_bus = get( $dir ); echo "list_bus result: $list_bus\n"; } finish(); ?> owfs-2.8p15/module/swig/php/Makefile.am0000664000175000017500000000301211532734767014706 00000000000000# $Id: Makefile.am,v 1.27 2011/02/28 15:06:31 alfille Exp $ EXTRA_DIST = php.m4 example/owdir.php example/load_php_OW.php.in example/load_php_OW.php #noinst_DATA = ow_wrap.c php_OW.h #use libtool to build the php extension lib_LTLIBRARIES = libowphp.la libowphp_la_LIBADD = ../../owlib/src/c/libow.la libowphp_la_DEPENDENCIES = ../../owlib/src/c/libow.la libowphp_la_LDFLAGS = -shared -shrext .so # Older php installations doesn't handle owfs_config.h filename, and tries # to include non-existing config.h if HAVE_CONFIG_H is defined. #DEFS+= -UHAVE_CONFIG_H EXTENSION_DIR = @PHPLIBDIR@ # Something like /usr/lib/php4, /usr/lib/php5/20041030, /usr/lib/php/modules/ or /usr/lib64/php/modules/ libdir = $(EXTENSION_DIR) AM_CFLAGS = -fexceptions \ -I.. \ -I$(top_srcdir)/src/include \ -I$(top_srcdir)/module/owlib/src/include \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ @PHPINC@ LDADD = -L../../owlib/src/c -low ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} libowphp_la_SOURCES = ow_wrap.c php_OW.h ow_wrap.c: ../ow.i if ENABLE_OWPHP # avoid problem when "make dist" and there are no swig available $(SWIG) -php -o $@ ../ow.i else touch ow_wrap.c php_OW.h endif #install-data-local: # @INSTALL@ -d $(DESTDIR)$(EXTENSION_DIR) # @INSTALL@ $(DESTDIR)${libdir}/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/ # ln -sf ${exec_prefix}/lib/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/libowphp.so # ln -sf ../../../lib/libowphp.so $(DESTDIR)$(EXTENSION_DIR)/php_OW.so clean-local: @RM@ -f *~ .*~ *.o OW.* ow_wrap.c php_OW.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/swig/php/ow_wrap.c0000664000175000017500000013774111754552414014506 00000000000000/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.4 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGPHP /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) # define SWIGTEMPLATEDISAMBIGUATOR template # elif defined(__HP_aCC) /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ # define SWIGTEMPLATEDISAMBIGUATOR template # else # define SWIGTEMPLATEDISAMBIGUATOR # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ # endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) # define _SCL_SECURE_NO_DEPRECATE #endif /* ----------------------------------------------------------------------------- * swigrun.swg * * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ #define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 /* Flags/methods for returning states. The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (strcmp(iter->type->name, c) == 0) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { if (iter->type == from) { if (iter == ty->cast) return iter; /* Move iter to the top of the linked list */ iter->prev->next = iter->next; if (iter->next) iter->next->prev = iter->prev; iter->next = ty->cast; iter->prev = 0; if (ty->cast) ty->cast->prev = iter; ty->cast = iter; return iter; } iter = iter->next; } } return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * phprun.swg * * PHP runtime library * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif #include "zend.h" #include "zend_API.h" #include "zend_exceptions.h" #include "php.h" #include "ext/standard/php_string.h" #ifdef ZEND_RAW_FENTRY /* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */ # define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_RAW_FENTRY((char*)#ZN, N, A, 0) #else /* This causes warnings from GCC >= 4.2 (assigning a string literal to char*). * But this seems to be unavoidable without directly assuming knowledge of * the structure, which changed between PHP4 and PHP5. */ # define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) #endif #ifndef Z_SET_ISREF_P /* For PHP < 5.3 */ # define Z_SET_ISREF_P(z) (z)->is_ref = 1 #endif #ifndef Z_SET_REFCOUNT_P /* For PHP < 5.3 */ # define Z_SET_REFCOUNT_P(z, rc) (z)->refcount = (rc) #endif #define SWIG_LONG_CONSTANT(N, V) zend_register_long_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) #define SWIG_DOUBLE_CONSTANT(N, V) zend_register_double_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) #define SWIG_STRING_CONSTANT(N, V) zend_register_stringl_constant((char*)#N, sizeof(#N), (char*)(V), strlen(V), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) #define SWIG_CHAR_CONSTANT(N, V) do {\ static char swig_char = (V);\ zend_register_stringl_constant((char*)#N, sizeof(#N), &swig_char, 1, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);\ } while (0) /* These TSRMLS_ stuff should already be defined now, but with older php under redhat are not... */ #ifndef TSRMLS_D #define TSRMLS_D #endif #ifndef TSRMLS_DC #define TSRMLS_DC #endif #ifndef TSRMLS_C #define TSRMLS_C #endif #ifndef TSRMLS_CC #define TSRMLS_CC #endif #ifdef __cplusplus } #endif /* But in fact SWIG_ConvertPtr is the native interface for getting typed pointer values out of zvals. We need the TSRMLS_ macros for when we make PHP type calls later as we handle php resources */ #define SWIG_ConvertPtr(obj,pp,type,flags) SWIG_ZTS_ConvertPtr(obj,pp,type,flags TSRMLS_CC) #define SWIG_fail goto fail static const char *default_error_msg = "Unknown error occurred"; static int default_error_code = E_ERROR; #define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg #define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0) #define SWIG_contract_assert(expr,msg) \ if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else /* Standard SWIG API */ #define SWIG_GetModule(clientdata) SWIG_Php_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer) /* used to wrap returned objects in so we know whether they are newobject and need freeing, or not */ typedef struct { void * ptr; int newobject; } swig_object_wrapper; /* empty zend destructor for types without one */ static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; } #define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC) #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) static void SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) { swig_object_wrapper *value=NULL; /* * First test for Null pointers. Return those as PHP native NULL */ if (!ptr ) { ZVAL_NULL(z); return; } if (type->clientdata) { if (! (*(int *)(type->clientdata))) zend_error(E_ERROR, "Type: %s failed to register with zend",type->name); value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper)); value->ptr=ptr; value->newobject=newobject; if (newobject <= 1) { /* Just register the pointer as a resource. */ ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata)); } else { /* * Wrap the resource in an object, the resource will be accessible * via the "_cPtr" member. This is currently only used by * directorin typemaps. */ value->newobject = 0; zval *resource; MAKE_STD_ZVAL(resource); ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata)); zend_class_entry **ce = NULL; zval *classname; MAKE_STD_ZVAL(classname); /* _p_Foo -> Foo */ ZVAL_STRING(classname, (char*)type->name+3, 1); /* class names are stored in lowercase */ php_strtolower(Z_STRVAL_PP(&classname), Z_STRLEN_PP(&classname)); if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &ce TSRMLS_CC) != SUCCESS) { /* class does not exist */ object_init(z); } else { object_init_ex(z, *ce); } Z_SET_REFCOUNT_P(z, 1); Z_SET_ISREF_P(z); zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL); FREE_ZVAL(classname); } return; } zend_error(E_ERROR, "Type: %s not registered with zend",type->name); } /* This pointer conversion routine takes the native pointer p (along with its type name) and converts it by calling appropriate casting functions according to ty. The resultant pointer is returned, or NULL is returned if the pointer can't be cast. Sadly PHP has no API to find a type name from a type id, only from an instance of a resource of the type id, so we have to pass type_name as well. The two functions which might call this are: SWIG_ZTS_ConvertResourcePtr which gets the type name from the resource and the registered zend destructors for which we have one per type each with the type name hard wired in. */ static void * SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) { swig_cast_info *tc; void *result = 0; if (!ty) { /* They don't care about the target type, so just pass on the pointer! */ return p; } if (! type_name) { /* can't convert p to ptr type ty if we don't know what type p is */ return NULL; } /* convert and cast p from type_name to ptr as ty. */ tc = SWIG_TypeCheck(type_name, ty); if (tc) { int newmemory = 0; result = SWIG_TypeCast(tc, p, &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ } return result; } /* This function returns a pointer of type ty by extracting the pointer and type info from the resource in z. z must be a resource. If it fails, NULL is returned. It uses SWIG_ZTS_ConvertResourceData to do the real work. */ static void * SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) { swig_object_wrapper *value; void *p; int type; char *type_name; value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type); if ( flags & SWIG_POINTER_DISOWN ) { value->newobject = 0; } p = value->ptr; if (type==-1) return NULL; type_name=zend_rsrc_list_get_rsrc_type(z->value.lval TSRMLS_CC); return SWIG_ZTS_ConvertResourceData(p, type_name, ty TSRMLS_CC); } /* We allow passing of a RESOURCE pointing to the object or an OBJECT whose _cPtr is a resource pointing to the object */ static int SWIG_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC) { if (z == NULL) { *ptr = 0; return 0; } switch (z->type) { case IS_OBJECT: { zval ** _cPtr; if (zend_hash_find(HASH_OF(z),(char*)"_cPtr",sizeof("_cPtr"),(void**)&_cPtr)==SUCCESS) { if ((*_cPtr)->type==IS_RESOURCE) { *ptr = SWIG_ZTS_ConvertResourcePtr(*_cPtr, ty, flags TSRMLS_CC); return (*ptr == NULL ? -1 : 0); } } break; } case IS_RESOURCE: *ptr = SWIG_ZTS_ConvertResourcePtr(z, ty, flags TSRMLS_CC); return (*ptr == NULL ? -1 : 0); case IS_NULL: *ptr = 0; return 0; } return -1; } static char const_name[] = "swig_runtime_data_type_pointer"; static swig_module_info *SWIG_Php_GetModule() { zval *pointer; swig_module_info *ret = 0; MAKE_STD_ZVAL(pointer); TSRMLS_FETCH(); if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) { if (pointer->type == IS_LONG) { ret = (swig_module_info *) pointer->value.lval; } } FREE_ZVAL(pointer); return ret; } static void SWIG_Php_SetModule(swig_module_info *pointer) { TSRMLS_FETCH(); REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0); } /* -------- TYPES TABLE (BEGIN) -------- */ static swig_type_info *swig_types[1]; static swig_module_info swig_module = {swig_types, 0, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ /* header section */ ZEND_BEGIN_MODULE_GLOBALS(OW) const char *error_msg; int error_code; ZEND_END_MODULE_GLOBALS(OW) ZEND_DECLARE_MODULE_GLOBALS(OW) #ifdef ZTS #define SWIG_ErrorMsg() TSRMG(OW_globals_id, zend_OW_globals *, error_msg ) #define SWIG_ErrorCode() TSRMG(OW_globals_id, zend_OW_globals *, error_code ) #else #define SWIG_ErrorMsg() (OW_globals.error_msg) #define SWIG_ErrorCode() (OW_globals.error_code) #endif // Allow the user to workaround a PHP bug on some platforms/architectures by // compiling with -DSWIG_ZEND_ERROR_NORETURN=zend_error #ifndef SWIG_ZEND_ERROR_NORETURN # define SWIG_ZEND_ERROR_NORETURN zend_error_noreturn #endif static void OW_init_globals(zend_OW_globals *globals ) { globals->error_msg = default_error_msg; globals->error_code = default_error_code; } static void OW_destroy_globals(zend_OW_globals * globals) { (void)globals; } static void SWIG_ResetError() { TSRMLS_FETCH(); SWIG_ErrorMsg() = default_error_msg; SWIG_ErrorCode() = default_error_code; } ZEND_NAMED_FUNCTION(_wrap_swig_OW_alter_newobject) { zval **args[2]; swig_object_wrapper *value; int type; int thisown; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type); value->newobject = zval_is_true(*args[1]); return; } ZEND_NAMED_FUNCTION(_wrap_swig_OW_get_newobject) { zval **args[1]; swig_object_wrapper *value; int type; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type); RETVAL_LONG(value->newobject); return; } #define SWIG_name "OW" #ifdef __cplusplus extern "C" { #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "php_OW.h" #ifdef __cplusplus } #endif #include "config.h" #include "owfs_config.h" #include "ow.h" // define this to add debug-output from newer swig-versions. //#define SWIGRUNTIME_DEBUG 1 char *version( ) { return VERSION; } int init( const char * dev ) { if ( BAD(API_init(dev)) ) { return 0 ; // error } return 1 ; } int put( const char * path, const char * value ) { int ret = 0 ; /* bad result */ if ( API_access_start() != 0 ) { return 0 ; // bad result } if ( value!=NULL) { if ( FS_write( path, value, strlen(value), 0 ) < 0 ) { ret = 1 ; // success } } API_access_end() ; return ret ; } /* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ char * get( const char * path ) { char * return_buffer = NULL ; if ( API_access_start() != 0 ) { return NULL ; // error } FS_get( path, &return_buffer, NULL ) ; API_access_end() ; return return_buffer ; } void finish( void ) { API_finish() ; } void set_error_print(int val) { Globals.error_print = val; } int get_error_print(void) { return Globals.error_print; } void set_error_level(int val) { Globals.error_level = val; } int get_error_level(void) { return Globals.error_level; } int opt(const char option_char, const char *arg) { return GOOD( owopt(option_char, arg) ) ? 0 : 1 ; } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info *swig_type_initial[] = { NULL }; static swig_cast_info *swig_cast_initial[] = { NULL }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ /* end header section */ /* vdecl subsection */ /* end vdecl subsection */ /* wrapper section */ ZEND_NAMED_FUNCTION(_wrap_version) { char *result = 0 ; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } result = (char *)version(); { if(!result) { ZVAL_NULL(return_value); } else { ZVAL_STRING(return_value, (char *)result, 1); } } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_init) { char *arg1 = (char *) 0 ; zval **args[1]; int result; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,62,CONVERT_STRING_IN@*/ if ((*args[0])->type==IS_NULL) { arg1 = (char *) 0; } else { convert_to_string_ex(args[0]); arg1 = (char *) Z_STRVAL_PP(args[0]); } /*@SWIG@*/; result = (int)init((char const *)arg1); { ZVAL_LONG(return_value,result); } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_get) { char *arg1 = (char *) 0 ; zval **args[1]; char *result = 0 ; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,62,CONVERT_STRING_IN@*/ if ((*args[0])->type==IS_NULL) { arg1 = (char *) 0; } else { convert_to_string_ex(args[0]); arg1 = (char *) Z_STRVAL_PP(args[0]); } /*@SWIG@*/; result = (char *)get((char const *)arg1); { if(!result) { ZVAL_NULL(return_value); } else { ZVAL_STRING(return_value, (char *)result, 1); } } { if (result) free(result) ; } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_put) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; zval **args[2]; int result; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,62,CONVERT_STRING_IN@*/ if ((*args[0])->type==IS_NULL) { arg1 = (char *) 0; } else { convert_to_string_ex(args[0]); arg1 = (char *) Z_STRVAL_PP(args[0]); } /*@SWIG@*/; /*@SWIG:/usr/share/swig2.0/php/utils.i,62,CONVERT_STRING_IN@*/ if ((*args[1])->type==IS_NULL) { arg2 = (char *) 0; } else { convert_to_string_ex(args[1]); arg2 = (char *) Z_STRVAL_PP(args[1]); } /*@SWIG@*/; result = (int)put((char const *)arg1,(char const *)arg2); { ZVAL_LONG(return_value,result); } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_finish) { SWIG_ResetError(); if(ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } finish(); return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_set_error_print) { int arg1 ; zval **args[1]; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); /*@SWIG@*/; set_error_print(arg1); return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_get_error_print) { int result; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } result = (int)get_error_print(); { ZVAL_LONG(return_value,result); } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_set_error_level) { int arg1 ; zval **args[1]; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); /*@SWIG@*/; set_error_level(arg1); return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_get_error_level) { int result; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } result = (int)get_error_level(); { ZVAL_LONG(return_value,result); } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } ZEND_NAMED_FUNCTION(_wrap_opt) { char arg1 ; char *arg2 = (char *) 0 ; zval **args[2]; int result; SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } /*@SWIG:/usr/share/swig2.0/php/utils.i,57,CONVERT_CHAR_IN@*/ convert_to_string_ex(args[0]); arg1 = (char) *Z_STRVAL_PP(args[0]); /*@SWIG@*/; /*@SWIG:/usr/share/swig2.0/php/utils.i,62,CONVERT_STRING_IN@*/ if ((*args[1])->type==IS_NULL) { arg2 = (char *) 0; } else { convert_to_string_ex(args[1]); arg2 = (char *) Z_STRVAL_PP(args[1]); } /*@SWIG@*/; result = (int)opt(arg1,(char const *)arg2); { ZVAL_LONG(return_value,result); } return; fail: zend_error(SWIG_ErrorCode(),"%s",SWIG_ErrorMsg()); } /* end wrapper section */ /* class entry subsection */ /* entry subsection */ /* Every non-class user visible function must have an entry here */ static zend_function_entry OW_functions[] = { SWIG_ZEND_NAMED_FE(version,_wrap_version,NULL) SWIG_ZEND_NAMED_FE(init,_wrap_init,NULL) SWIG_ZEND_NAMED_FE(get,_wrap_get,NULL) SWIG_ZEND_NAMED_FE(put,_wrap_put,NULL) SWIG_ZEND_NAMED_FE(finish,_wrap_finish,NULL) SWIG_ZEND_NAMED_FE(set_error_print,_wrap_set_error_print,NULL) SWIG_ZEND_NAMED_FE(get_error_print,_wrap_get_error_print,NULL) SWIG_ZEND_NAMED_FE(set_error_level,_wrap_set_error_level,NULL) SWIG_ZEND_NAMED_FE(get_error_level,_wrap_get_error_level,NULL) SWIG_ZEND_NAMED_FE(opt,_wrap_opt,NULL) SWIG_ZEND_NAMED_FE(swig_OW_alter_newobject,_wrap_swig_OW_alter_newobject,NULL) SWIG_ZEND_NAMED_FE(swig_OW_get_newobject,_wrap_swig_OW_get_newobject,NULL) {NULL, NULL, NULL} }; /* init section */ #if ZEND_MODULE_API_NO <= 20090626 #undef ZEND_MODULE_BUILD_ID #define ZEND_MODULE_BUILD_ID (char*)"API" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA #endif zend_module_entry OW_module_entry = { #if ZEND_MODULE_API_NO > 20010900 STANDARD_MODULE_HEADER, #endif (char*)"OW", OW_functions, PHP_MINIT(OW), PHP_MSHUTDOWN(OW), PHP_RINIT(OW), PHP_RSHUTDOWN(OW), PHP_MINFO(OW), #if ZEND_MODULE_API_NO > 20010900 NO_VERSION_YET, #endif STANDARD_MODULE_PROPERTIES }; zend_module_entry* SWIG_module_entry = &OW_module_entry; #ifdef __cplusplus extern "C" { #endif SWIGEXPORT zend_module_entry *get_module(void) { return &OW_module_entry; } #ifdef __cplusplus } #endif #define SWIG_php_minit PHP_MINIT_FUNCTION(OW) /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; init = 1; } else { init = 0; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* When multiple interpeters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif SWIG_php_minit { SWIG_InitializeModule(0); API_setup(program_type_swig) ; /* oinit subsection */ ZEND_INIT_MODULE_GLOBALS(OW, OW_init_globals, OW_destroy_globals); CG(active_class_entry) = NULL; /* end oinit subsection */ /* cinit subsection */ /* end cinit subsection */ return SUCCESS; } PHP_RINIT_FUNCTION(OW) { /* rinit section */ /* vinit subsection */ /* end vinit subsection */ return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(OW) { /* shutdown section */ #ifdef ZTS ts_free_id(OW_globals_id); #endif return SUCCESS; } PHP_RSHUTDOWN_FUNCTION(OW) { /* rshutdown section */ return SUCCESS; } PHP_MINFO_FUNCTION(OW) { } /* end init section */ owfs-2.8p15/module/swig/Makefile.in0000664000175000017500000005166011756250030014124 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.15 2009/07/01 01:26:27 alfille Exp $ 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@ target_triplet = @target@ subdir = module/swig DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = perl5 python php DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = ow.i @ENABLE_OWPERL_TRUE@@ENABLE_PERL_TRUE@SWIG_SUBDIRPERL = perl5 @ENABLE_OWPYTHON_TRUE@@ENABLE_PYTHON_TRUE@SWIG_SUBDIRPYTHON = python @ENABLE_OWPHP_TRUE@@ENABLE_PHP_TRUE@SWIG_SUBDIRPHP = php SUBDIRS = $(SWIG_SUBDIRPERL) $(SWIG_SUBDIRPYTHON) $(SWIG_SUBDIRPHP) all: all-recursive .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 module/swig/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/swig/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/swig/perl5/0000775000175000017500000000000011756315511013164 500000000000000owfs-2.8p15/module/swig/perl5/OW/0000775000175000017500000000000011756315511013511 500000000000000owfs-2.8p15/module/swig/perl5/OW/t/0000775000175000017500000000000011756315511013754 500000000000000owfs-2.8p15/module/swig/perl5/OW/t/OW.t0000664000175000017500000000070610625227137014411 00000000000000# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl OW.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; BEGIN { use_ok('OW') }; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script. owfs-2.8p15/module/swig/perl5/OW/MANIFEST0000664000175000017500000000017210625227137014562 00000000000000Changes Makefile.PL MANIFEST README t/OW.t META.yml Module meta-data (added by MakeMaker) owfs-2.8p15/module/swig/perl5/OW/Changes0000664000175000017500000000011110625227137014715 00000000000000Revision history for Perl extension OW. 0.01 Wed Jan 3 21:42:03 2007 owfs-2.8p15/module/swig/perl5/OW/README0000664000175000017500000000354610625227137014321 00000000000000OWNet version 1.10 ================== OWNet is a light-weight module for accessing owserver. The overall goal is an easy way to use the 1-Wire bus and devices. Useful for monitoring, security, hobby, control. (Projects include weather monitoring, heating and cooling control, aquarium, tractor, motorcycle, swimming pool and others.) The full explanation can be found at http://www.owfs.org Basically 1-Wire is a simple and inexpensive way to connect chips made by Dallas Semicondictor to a computer. These chips each have a unique ID, and are individually addressable, even with a bus that has only a combined power/data line and ground. The underlying idea of OWFS (One Wire File System) is to make the whole 1-wire bus look like a file system. Devices are directories (named by their unique ID) and their properties (memory, contact, voltage, temperature,...) are files. owserver is one of the OWFS programs that connects and virtuallizes the 1-wire bus. It communicates via a well-documented tcp/ip protocol, see: http://www.owfs.org/index.php?page=owserver-protocol OWNet is a perl module to connect to a owserver process. There are four methods: read, write, dir, present All that's needed is the ip address of the owserver, and the "path" -- unique name or the 1-wire resource wanted. --------------- OWNet is pure perl. It uses the IO::Socket::INET module for tcp/ip communication. It should be usable on any system with perl, and a network stack. --------------- INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: IO::Socket::INET Net::Rendezvous (optional) COPYRIGHT AND LICENCE Copyright (C) 2007 by Paul H Alfille This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. owfs-2.8p15/module/swig/perl5/OW/Makefile.osx.in0000664000175000017500000000154711162442476016317 00000000000000#!/usr/bin/perl -w use ExtUtils::MakeMaker ; WriteMakefile( 'CC' => '@CC@', 'ABSTRACT' => q[Perl interface to the 1-wire filesytem] , 'AUTHOR' => q[Paul H Alfille ] , 'VERSION' => q[@VERSION@], # Avoid compilation problem for Fedora Core 1 and Slackware 10.2 'DEFINE' => q[@PTHREAD_CFLAGS@ -D_FILE_OFFSET_BITS=64 -DSKIP_SEARCH_H @DEFS@], 'INC' => q[-I../../../../src/include -I../../../owlib/src/include @CPPFLAGS@], # Default value for LDDLFLAGS is $Config{lddlflags}="-shared -L/usr/local/lib" # but we want rpath to be @libdir@ or @exec_prefix@/lib 'LDDLFLAGS' => q[-bundle -flat_namespace -undefined suppress -Wl,-L../../../owlib/src/c/.libs], 'LIBS' => q[-L../../../owlib/src/c/.libs -low @PTHREAD_LIBS@ @LIBS@], 'OBJECT' => 'ow_wrap.o', 'NAME' => 'OW', 'POLLUTE' => 1, ) ; owfs-2.8p15/module/swig/perl5/OW/Makefile.linux.in0000664000175000017500000000152711162442470016635 00000000000000#!/usr/bin/perl -w use ExtUtils::MakeMaker ; WriteMakefile( 'CC' => '@CC@', 'ABSTRACT' => q[Perl interface to the 1-wire filesytem] , 'AUTHOR' => q[Paul H Alfille ] , 'VERSION' => q[@VERSION@], # Avoid compilation problem for Fedora Core 1 and Slackware 10.2 'DEFINE' => q[@PTHREAD_CFLAGS@ -D_FILE_OFFSET_BITS=64 -DSKIP_SEARCH_H @DEFS@], 'INC' => q[-I../../../../src/include -I../../../owlib/src/include @CPPFLAGS@], # Default value for LDDLFLAGS is $Config{lddlflags}="-shared -L/usr/local/lib" # but we want rpath to be @libdir@ or @exec_prefix@/lib 'LDDLFLAGS' => q[-shared -L../../../owlib/src/c/.libs -Wl,-rpath=@prefix@/lib], 'LIBS' => q[-L../../../owlib/src/c/.libs -low @PTHREAD_LIBS@ @LIBS@], 'OBJECT' => 'ow_wrap.o', 'NAME' => 'OW', 'POLLUTE' => 1, ) ; owfs-2.8p15/module/swig/perl5/OW/META.yml0000664000175000017500000000075510625227137014711 00000000000000 name: OW abstract: Build and install OW module version: 1.13 author: - Paul H Alfille license: perl distribution_type: module requires: IO::Socket::INET: 0 perl: 5.005_03 recommends: Net::Rendezvous: 0 build_requires: Test: 0 provides: OW: file: OW.pm urls: license: http://dev.perl.org/licenses/ meta-spec: version: 1.3 url: http://module-build.sourceforge.net/META-spec-v1.3.html generated_by: Module::Build version 0.20 owfs-2.8p15/module/swig/perl5/Makefile.in0000664000175000017500000003515111756250031015151 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/swig/perl5 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = perl5.m4 OW/META.yml OW/README OW/MANIFEST OW/Changes OW/Makefile.linux.in OW/Makefile.osx.in OW/t/OW.t example/owdir.pl example/tree.pl 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 module/swig/perl5/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/swig/perl5/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): 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-data-local 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-data-local 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 #all: OW/Makefile all: OW/blib/lib/OW.pm OW/Makefile.PL: @HAVE_DARWIN_TRUE@ cp OW/Makefile.osx OW/Makefile.PL @HAVE_DARWIN_FALSE@ cp OW/Makefile.linux OW/Makefile.PL OW/Makefile: OW/Makefile.PL @HAVE_DARWIN_TRUE@ ( cd OW; $(PERL) Makefile.PL ) @HAVE_DARWIN_FALSE@@HAVE_DEBIAN_TRUE@ ( cd OW; $(PERL) Makefile.PL INSTALLDIRS=vendor ) @HAVE_DARWIN_FALSE@@HAVE_DEBIAN_FALSE@ ( cd OW; $(PERL) Makefile.PL ) OW/ow_wrap.c: ../ow.i OW/Makefile ${LIBOW} $(SWIG) -perl5 -o $@ ../ow.i OW/blib/lib/OW.pm: OW/ow_wrap.c $(MAKE) -C OW -fMakefile @INSTALL@ -d OW/blib/lib @INSTALL@ OW/OW.pm OW/blib/lib/ @ECHO@ >> OW/blib/lib/OW.pm 'our $$VERSION='\''@VERSION@'\'' ;' install-data-local: OW/Makefile OW/ow_wrap.c OW/blib/lib/OW.pm $(MAKE) -C OW install DESTDIR="$(DESTDIR)" clean-generic: @RM@ -f *~ .*~ if test -f OW/Makefile; then cd OW; $(MAKE) clean; fi @RM@ -f OW/Makefile.old OW/Makefile OW/Makefile.PL OW/OW.pm OW/OW.bs OW/ow_wrap.c # 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: owfs-2.8p15/module/swig/perl5/example/0000775000175000017500000000000011756315511014617 500000000000000owfs-2.8p15/module/swig/perl5/example/tree.pl0000775000175000017500000000261611164541413016036 00000000000000#!/usr/bin/perl -w # OWFS test program # See owfs.sourceforge.net for details # {copyright} 2004 Paul H. Alfille # GPL v2 license # $Id: tree.pl,v 1.2 2009/04/01 01:27:39 alfille Exp $ use OW ; die ( "OWFS 1-wire tree perl program\n" ." by Paul Alfille 2004 see http://www.owfs.org\n" ."Syntax:\n" ."\t$0 1wire-adapter\n" ." 1wire-adapter (required):\n" ."\t'u' for USB -or-\n" ."\t--fake=10,28 for a fake-adapter with DS18S20 and DS18B20-sensor -or-\n" ."\t/dev/ttyS0 (or whatever) serial port -or-\n" ."\t4304 for remote-server at port 4304\n" ."\t192.168.1.1:4304 for remote-server at 192.168.1.1:4304\n" ) if ( $#ARGV != 0 ) ; OW::init($ARGV[0]) or die "Cannot open 1wire port $ARGV[0]" ; #OW::set_error_print(2); #OW::set_error_level(9); # for "paging" #my $lin = 0 ; sub treelevel { my $lev = shift ; my $path = shift ; #sleep 1; #print "lev=$lev path=$path \n" ; my $res = OW::get($path) or return ; for (split(',',$res)) { for (1..$lev) { print("\t") } ; #for paging #if (++$lin == 30 ) { #$lin=0 ; #getc(); #} print $_ ; if ( m{/$} ) { # print "[".OW::get($path.$_)."]" ; print "\n" ; treelevel($lev+1,$path.$_) ; } else { my $r = OW::get($path.$_) ; print ": $r" if defined($r) ; print "\n" ; } } } treelevel(0,"/") ; OW::finish() ; owfs-2.8p15/module/swig/perl5/example/owdir.pl0000775000175000017500000000164611164541313016224 00000000000000#!/usr/bin/perl -w # OWFS test program # See owfs.sourceforge.net for details # {copyright} 2004 Paul H. Alfille # GPL v2 license # $Id: owdir.pl,v 1.2 2009/04/01 01:26:35 alfille Exp $ use OW ; die ( "OWFS 1-wire owdir perl program\n" ."Syntax:\n" ."\t$0 1wire-adapter [dir]\n" ." 1wire-adapter (required):\n" ."\t'u' for USB -or-\n" ."\t--fake=10,28 for a fake-adapter with DS18S20 and DS18B20-sensor -or-\n" ."\t/dev/ttyS0 (or whatever) serial port -or-\n" ."\t4304 for remote-server at port 4304\n" ."\t192.168.1.1:4304 for remote-server at 192.168.1.1:4304\n" ) if ( $#ARGV < 0 ) ; OW::init($ARGV[0]) or die "Cannot open 1wire port $ARGV[0]" ; #OW::set_error_print(2); #OW::set_error_level(9); if ( $#ARGV >= 1 ) { $dir = $ARGV[1]; } else { $dir = "/"; } my $res = OW::get($dir) or print "Error reading directory\n" ; print $res . "\n" if defined($res) ; OW::finish() ; owfs-2.8p15/module/swig/perl5/Makefile.am0000664000175000017500000000211511542516636015143 00000000000000## $Id: Makefile.am,v 1.39 2011/03/24 01:25:50 alfille Exp $ EXTRA_DIST = perl5.m4 OW/META.yml OW/README OW/MANIFEST OW/Changes OW/Makefile.linux.in OW/Makefile.osx.in OW/t/OW.t example/owdir.pl example/tree.pl #all: OW/Makefile all: OW/blib/lib/OW.pm OW/Makefile.PL: if HAVE_DARWIN cp OW/Makefile.osx OW/Makefile.PL else cp OW/Makefile.linux OW/Makefile.PL endif OW/Makefile: OW/Makefile.PL if HAVE_DARWIN ( cd OW; $(PERL) Makefile.PL ) else if HAVE_DEBIAN ( cd OW; $(PERL) Makefile.PL INSTALLDIRS=vendor ) else ( cd OW; $(PERL) Makefile.PL ) endif endif OW/ow_wrap.c: ../ow.i OW/Makefile ${LIBOW} $(SWIG) -perl5 -o $@ ../ow.i OW/blib/lib/OW.pm: OW/ow_wrap.c $(MAKE) -C OW -fMakefile @INSTALL@ -d OW/blib/lib @INSTALL@ OW/OW.pm OW/blib/lib/ @ECHO@ >> OW/blib/lib/OW.pm 'our $$VERSION='\''@VERSION@'\'' ;' install-data-local: OW/Makefile OW/ow_wrap.c OW/blib/lib/OW.pm $(MAKE) -C OW install DESTDIR="$(DESTDIR)" clean-generic: @RM@ -f *~ .*~ if test -f OW/Makefile; then cd OW; $(MAKE) clean; fi @RM@ -f OW/Makefile.old OW/Makefile OW/Makefile.PL OW/OW.pm OW/OW.bs OW/ow_wrap.c owfs-2.8p15/module/swig/perl5/perl5.m40000664000175000017500000000455011067631265014403 00000000000000#---------------------------------------------------------------- # Look for Perl5 # $Id: perl5.m4,v 1.6 2008/09/28 07:31:01 d1mag Exp $ #---------------------------------------------------------------- AC_DEFUN([SC_PATH_PERL5], [AC_PREREQ(2.57)dnl PERLBIN= AC_ARG_WITH(perl5, [ --with-perl5 Set location of Perl executable],[ PERLBIN="$withval"], [PERLBIN=yes]) # First, check for "--without-perl5" or "--with-perl5=no". if test x"${PERLBIN}" = xno -o x"${with_alllang}" = xno ; then AC_MSG_NOTICE([Disabling Perl5]) else # First figure out what the name of Perl5 is if test "x$PERLBIN" = xyes; then AC_CHECK_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl) else PERL="$PERLBIN" fi # This could probably be simplified as for all platforms and all versions of Perl the following apparently should be run to get the compilation options: # perl -MExtUtils::Embed -e ccopts AC_MSG_CHECKING(for Perl5 header files) if test -n "$PERL"; then PERL=`(which $PERL) 2>/dev/null` # Make it possible to force a directory during cross-compilation if test -z "$PERL5DIR"; then PERL5DIR=`($PERL -e 'use Config; print $Config{archlib}, "\n";') 2>/dev/null` fi if test -n "$PERL5DIR"; then dirs="$PERL5DIR $PERL5DIR/CORE" PERL5EXT=none for i in $dirs; do if test -r $i/perl.h; then AC_MSG_RESULT($i) PERL5EXT="$i" break; fi done if test "$PERL5EXT" = none; then PERL5EXT="$PERL5DIR/CORE" AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) fi AC_MSG_CHECKING(for Perl5 library) PERL5NAME=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_, "\n"') 2>/dev/null` if test "$PERL5NAME" = "" ; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PERL5NAME) fi AC_MSG_CHECKING(for Perl5 compiler options) PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-I/$ISYSTEM/") 2>/dev/null` if test "$PERL5CCFLAGS" = "" ; then AC_MSG_RESULT(not found) else AC_MSG_RESULT($PERL5CCFLAGS) fi else AC_MSG_RESULT(unable to determine perl5 configuration) PERL5EXT=$PERL5DIR fi else AC_MSG_RESULT(could not figure out how to run perl5) fi # Cygwin (Windows) needs the library for dynamic linking case $host in *-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5NAME";; *)PERL5DYNAMICLINKING="";; esac fi ]) owfs-2.8p15/module/swig/ow.i0000664000175000017500000000370511620362277012662 00000000000000/* File: ow.i */ /* $Id: ow.i,v 1.62 2011/08/10 01:54:07 alfille Exp $ */ %module OW %include "typemaps.i" %init %{ API_setup(program_type_swig) ; %} %{ #include "config.h" #include "owfs_config.h" #include "ow.h" // define this to add debug-output from newer swig-versions. //#define SWIGRUNTIME_DEBUG 1 char *version( ) { return VERSION; } int init( const char * dev ) { if ( BAD(API_init(dev)) ) { return 0 ; // error } return 1 ; } int put( const char * path, const char * value ) { int ret = 0 ; /* bad result */ if ( API_access_start() != 0 ) { return 0 ; // bad result } if ( value!=NULL) { if ( FS_write( path, value, strlen(value), 0 ) < 0 ) { ret = 1 ; // success } } API_access_end() ; return ret ; } /* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ char * get( const char * path ) { char * return_buffer = NULL ; if ( API_access_start() != 0 ) { return NULL ; // error } FS_get( path, &return_buffer, NULL ) ; API_access_end() ; return return_buffer ; } void finish( void ) { API_finish() ; } void set_error_print(int val) { Globals.error_print = val; } int get_error_print(void) { return Globals.error_print; } void set_error_level(int val) { Globals.error_level = val; } int get_error_level(void) { return Globals.error_level; } int opt(const char option_char, const char *arg) { return GOOD( owopt(option_char, arg) ) ? 0 : 1 ; } %} %typemap(newfree) char * { if ($1) free($1) ; } %newobject get ; extern char *version( ); extern int init( const char * dev ) ; extern char * get( const char * path ) ; extern int put( const char * path, const char * value ) ; extern void finish( void ) ; extern void set_error_print(int); extern int get_error_print(void); extern void set_error_level(int); extern int get_error_level(void); extern int opt(const char, const char *); owfs-2.8p15/module/swig/Makefile.am0000664000175000017500000000061411222535503014103 00000000000000# $Id: Makefile.am,v 1.15 2009/07/01 01:26:27 alfille Exp $ EXTRA_DIST = ow.i if ENABLE_OWPERL if ENABLE_PERL SWIG_SUBDIRPERL = perl5 endif endif if ENABLE_OWPYTHON if ENABLE_PYTHON SWIG_SUBDIRPYTHON = python endif endif if ENABLE_OWPHP if ENABLE_PHP SWIG_SUBDIRPHP = php endif endif SUBDIRS = $(SWIG_SUBDIRPERL) $(SWIG_SUBDIRPYTHON) $(SWIG_SUBDIRPHP) clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/0000775000175000017500000000000011756315507012325 500000000000000owfs-2.8p15/module/ownet/python/0000775000175000017500000000000011756315510013640 500000000000000owfs-2.8p15/module/ownet/python/examples/0000775000175000017500000000000011756315510015456 500000000000000owfs-2.8p15/module/ownet/python/examples/check_ow.py0000664000175000017500000000462610605157143017540 00000000000000#! /usr/bin/env python """ $Id: check_ow.py,v 1.2 2007/04/05 11:32:51 d1mag Exp $ $HeadURL: http://void/svn/peter/playground/nud/categories.py $ Copyright (c) 2006 Peter Kropf. All rights reserved. Nagios (http://nagios.org) plugin to check the value of a 1-wire sensor. """ import ownet import sys import os from optparse import OptionParser import socket class nagios: ok = (0, 'OK') warning = (1, 'WARNING') critical = (2, 'CRITICAL') unknown = (3, 'UNKNOWN') # FIXME: need to add more help text in the init_string and sensor_path parameters parser = OptionParser(usage='usage: %prog [options] server port sensor_path', version='%prog ' + ownet.__version__) parser.add_option('-v', dest='verbose', action='count', help='multiple -v increases the level of debugging output.') parser.add_option('-w', dest='warning', type='int', help='warning level.') parser.add_option('-c', dest='critical', type='int', help='critical level.') parser.add_option('-f', dest='field', help='sensor field to be used for monitoring.', default='temperature') options, args = parser.parse_args() if len(args) != 3: print 'OW ' + nagios.unknown[1] + ' - ' + 'missing command line arguments' parser.print_help() sys.exit(nagios.unknown[0]) server = args[0] port = int(args[1]) path = args[2] try: s = ownet.Sensor(path, server=server, port=port) except ownet.exUnknownSensor, ex: print 'OW ' + nagios.unknown[1] + ' - unknown sensor ' + str(ex) sys.exit(nagios.unknown[0]) except socket.error, ex: print 'OW ' + nagios.unknown[1] + ' - communication error ' + str(ex) sys.exit(nagios.unknown[0]) if options.verbose == 1: print s elif options.verbose > 1: print s print 'entryList:', s.entryList() print 'sensorList:', s.sensorList() if not hasattr(s, options.field): print 'OW ' + nagios.unknown[1] + ' - ' + 'unknown field: ' + options.field sys.exit(nagios.unknown[0]) val = getattr(s, options.field) if val >= options.critical: status = nagios.critical[1] exit_code = nagios.critical[0] elif val >= options.warning: status = nagios.warning[1] exit_code = nagios.warning[0] else: status = nagios.ok[1] exit_code = nagios.ok[0] print 'OW %s - %s %s: %i| %s/%s=%i' % (status, path, options.field, val, path, options.field, val) sys.exit(exit_code) owfs-2.8p15/module/ownet/python/examples/temperatures.py0000664000175000017500000000070110543376500020465 00000000000000#! /usr/bin/env python # $Id: temperatures.py,v 1.1 2006/12/24 04:08:32 alfille Exp $ import sys import ownet if len(sys.argv) != 3: print 'temperatures.py server port' sys.exit(1) r = ownet.Sensor('/', server=sys.argv[1], port=int(sys.argv[2])) e = r.entryList() s = r.sensorList() print 'r:', r print 'r.entryList():', e print 'r.sensorList():', s for x in r.sensors(): if hasattr(x, 'temperature'): print x, x.temperature owfs-2.8p15/module/ownet/python/ownet/0000775000175000017500000000000011756315510014774 500000000000000owfs-2.8p15/module/ownet/python/ownet/__init__.py0000664000175000017500000003317611443446272017042 00000000000000""" ::BOH $Id: __init__.py,v 1.5 2010/09/13 16:09:30 alfille Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $ Copyright (c) 2006 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH 1-wire sensor network interface. ownet provides standalone access to a owserver without the need to compile the core ow libraries on the local system. As a result, ownet can run on almost any platform that support Python. OWFS is an open source project developed by Paul Alfille and hosted at http://www.owfs.org """ # avoid error with python2.2 from __future__ import generators import sys import os from connection import Connection __author__ = 'Peter Kropf' __email__ = 'pkropf@gmail.com' __version__ = '0.3' + '-' + '$Id: __init__.py,v 1.5 2010/09/13 16:09:30 alfille Exp $'.split()[2] # # exceptions used and thrown by the ownet classes # class exError(Exception): """base exception for all one wire raised exceptions.""" class exErrorValue(exError): """Base exception for all one wire raised exceptions with a value.""" def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class exNoController(exError): """Exception raised when a controller cannot be initialized.""" class exNotInitialized(exError): """Exception raised when a controller has not been initialized.""" class exUnknownSensor(exErrorValue): """Exception raised when a specified sensor is not found.""" # # _server and _port are the default server and port values to be used # if a Sensor is initialized without specifying a server and port. # _server = None _port = None # # Initialize and cleanup the _server and _port default values. # def init(iface): """ Initialize the interface mechanism to be used for communications to the 1-wire network. Only socket connections to owserver are supported. Examples: ownet.init('remote_system:3003') Will initialize the 1-wire interface to use the owserver running on remote_system on port 3003. """ #print 'ownet.init(%s)' % iface global _server global _port pair = iface.split(':') if len(pair) != 2: raise exNoController _server = pair[0] _port = pair[1] def finish(): """ Cleanup the OWFS library, freeing any used resources. """ #print 'ownet.finish()' global _server global _port _server = None _port = None # # 1-wire sensors # class Sensor(object): """ A Sensor is the basic component of a 1-wire network. It represents a individual 1-wire element as it exists on the network. """ def __init__(self, path, server = None, port = None, connection=None): """ Create a new Sensor as it exists at the specified path. """ #print 'Sensor.__init__(%s, server="%s", port=%s)' % (path, str(server), str(port)) # setup the connection to use for connunication with the owsensor server if connection: self._connection = connection elif not server or not port: global _server global _port if not _server or not _port: raise exNotInitialized else: self._connection = Connection(server, port) else: self._connection = Connection(server, port) self._attrs = {} if path == '/': self._path = path self._useCache = True elif path == '/uncached': self._path = '/' self._useCache = False else: if path[:len('/uncached')] == '/uncached': self._path = path[len('/uncached'):] self._useCache = False else: self._path = path self._useCache = True self.useCache(self._useCache) def __str__(self): """ Print a string representation of the Sensor in the form of: server:port/path - type Example: >>> print Sensor('/') xyzzy:9876/ - DS9490 """ #print 'Sensor.__str__' return "%s%s - %s" % (str(self._connection), self._usePath, self._type) def __repr__(self): """ Print a representation of the Sensor in the form of: Sensor(path) Example: >>> Sensor('/') Sensor("/", server="xyzzy", port=9876) """ #print 'Sensor.__repr__' return 'Sensor("%s", server="%s", port=%i)' % (self._usePath, self._connection._server, self._connection._port) def __eq__(self, other): """ Two sensors are considered equal if their paths are equal. This is done by comparing their _path attributes so that cached and uncached Sensors compare equal. Examples: >>> Sensor('/') == Sensor('/1F.440701000000') False >>> Sensor('/') == Sensor('/uncached') True """ #print 'Sensor.__eq__(%s)' % str(other) return self._path == other._path def __hash__(self): """ Return a hash for the Sensor object's name. This allows Sensors to be used better in sets.Set. """ #print 'Sensor.__hash__' return hash(self._path) def __getattr__(self, name): """ Retreive an attribute from the sensor. __getattr__ is called only if the named item doesn't exist in the Sensor's namespace. If it's not in the namespace, look for the attribute on the physical sensor. Usage: s = ownet.Sensor('/1F.5D0B01000000') print s.family, s.PIO_0 will result in the family and PIO.0 values being read from the sensor and printed. In this example, the family would be 1F and thr PIO.0 might be 1. """ try: #print 'Sensor.__getattr__(%s)' % name attr = object._connection.read(object.__getattribute__(self, '_attrs')[name]) except KeyError: raise AttributeError, name return attr def __setattr__(self, name, value): """ Set the value of a sensor attribute. This is accomplished by first determining if the physical sensor has the named attribute. If it does, then the value is written to the name. Otherwise, the Sensor's dictionary is updated with the name and value. Usage: s = ownet.Sensor('/1F.5D0B01000000') s.PIO_1 = '1' will set the value of PIO.1 to 1. """ #print 'Sensor.__setattr__(%s, %s)' % (name, value) # Life can get tricky when using __setattr__. Self doesn't # have an _attrs atribute when it's initially created. _attrs # is only there after it's been set in __init__. So we can # only reference it if it's already been added. if hasattr(self, '_attrs'): if name in self._attrs: self._connection.write(self._attrs[name], value) else: self.__dict__[name] = value else: self.__dict__[name] = value def useCache(self, use_cache): """ Set the sensor to use the underlying owfs cache (or not) depending on the use_cache parameter. Usage: s = ownet.Sensor('/1F.5D0B01000000') s.useCache(False) will set the internal sensor path to /uncached/1F.5D0B01000000. Also: s = ownet.Sensor('/uncached/1F.5D0B01000000') s.useCache(True) will set the internal sensor path to /1F.5D0B01000000. """ #print 'Sensor.useCache(%s)' % str(use_cache) self._useCache = use_cache if self._useCache: self._usePath = self._path else: if self._path == '/': self._usePath = '/uncached' else: self._usePath = '/uncached' + self._path if self._path == '/': self._type = self._connection.read('/system/adapter/name.0') else: self._type = self._connection.read('%s/type' % self._usePath) self._attrs = dict([(n.replace('.', '_'), self._usePath + '/' + n) for n in self.entries()]) def entries(self): """ Generator which yields the attributes of a sensor. """ #print 'Sensor.entries()' list = self._connection.dir(self._usePath) if self._path == '/': for entry in list: if not '/' in entry: yield entry else: for entry in list: yield entry.split('/')[-1] def entryList(self): """ List of the sensor's attributes. Example: >>> Sensor("/10.B7B64D000800").entryList() ['address', 'crc8', 'die', 'family', 'id', 'power', 'present', 'temperature', 'temphigh', 'templow', 'trim', 'trimblanket', 'trimvalid', 'type'] """ #print 'Sensor.entryList()' return [e for e in self.entries()] def sensors(self, names = ['main', 'aux']): """ Generator which yields all the sensors that are associated with the current sensor. In the event that the current sensor is the adapter (such as a DS9490 USB adapter) the list of sensors directly attached to the 1-wire network will be yielded. In the event that the current sensor is a microlan controller (such as a DS2409) the list of directories found in the names list parameter will be searched and any sensors found will be yielded. The names parameter defaults to ['main', 'aux']. """ #print 'Sensor.sensors(%s)' % str(names) if self._type == 'DS2409': for branch in names: path = self._usePath + '/' + branch list = filter(lambda x: '/' in x, self._connection.dir(path)) if list: namelist = ','.join(list) #print 'Sensor.sensors namelist(%s)' % str(namelist) for branch_entry in namelist.split(','): # print 'branch_entry(%s)' % str(branch_entry) try: self._connection.read(branch_entry + '/type') except exUnknownSensor, ex: continue yield Sensor(branch_entry, connection=self._connection) else: list = self._connection.dir(self._usePath) if self._path == '/': for entry in list: if '/' in entry: yield Sensor(entry, connection=self._connection) def sensorList(self, names = ['main', 'aux']): """ List of all the sensors that are associated with the current sensor. In the event that the current sensor is the adapter (such as a DS9490 USB adapter) the list of sensors directly attached to the 1-wire network will be yielded. In the event that the current sensor is a microlan controller (such as a DS2409) the list of directories found in the names list parameter will be searched and any sensors found will be yielded. The names parameter defaults to ['main', 'aux']. Example: >>> Sensor("/1F.440701000000").sensorList() [Sensor("/1F.440701000000/main/29.400900000000")] """ #print 'Sensor.sensorList(%s)' % str(names) return [s for s in self.sensors()] def find(self, **keywords): """ Generator which yields all the sensors whose attributes match those past in. By default, any matched attribute will yield a sensor. If the parameter all is passed to the find call, then all the supplied attributes must match to yield a sensor. Usage: for s in Sensor('/').find(type = 'DS2408'): print s will print all the sensors whose type is DS2408. root = Sensor('/') print len([s for s in root.find(all = True, family = '1F', type = 'DS2409')]) will print the count of sensors whose family is 1F and whose type is DS2409. """ #print 'Sensor.find', keywords #recursion = keywords.pop('recursion', False) all = keywords.pop('all', False) for sensor in self.sensors(): match = 0 for attribute in keywords: if hasattr(sensor, attribute): if keywords[attribute]: if getattr(sensor, attribute) == keywords[attribute]: match = match + 1 else: if hasattr(sensor, attribute): match = match + 1 if not all and match: yield sensor elif all and match == len(keywords): yield sensor owfs-2.8p15/module/ownet/python/ownet/connection.py0000664000175000017500000001534611443446272017441 00000000000000# -*- coding: utf-8 -*- """ ::BOH $Id: connection.py,v 1.8 2010/09/13 16:09:30 alfille Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $ Copyright (c) 2006 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH OWFS is an open source project developed by Paul Alfille and hosted at http://www.owfs.org """ import sys import os import socket import struct import re __author__ = 'Peter Kropf' __email__ = 'pkropf@gmail.com' __version__ = '$Id: connection.py,v 1.8 2010/09/13 16:09:30 alfille Exp $'.split()[2] class exError(Exception): """base exception for all one wire raised exceptions.""" class exErrorValue(exError): """Base exception for all one wire raised exceptions with a value.""" def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class exInvalidMessage(exErrorValue): """Exception raised when trying to unpack a message that doesn't meet specs.""" class exShortRead(exError): """Exception raised when too few bytes are received from the owserver.""" class OWMsg: """ Constants for the owserver api message types. """ error = 0 nop = 1 read = 2 write = 3 dir = 4 size = 5 presence = 6 class Connection(object): """ A Connection provides access to a owserver without the standard core ow libraries. Instead, it impliments the wire protocol for communicating with the owserver. This allows Python programs to interact with the ow sensors on any platform supported by Python. """ def __init__(self, server, port): """ Create a new connection object. """ #print 'Connection.__init__(%s, %i)' % (server, port) self._server = server self._port = port def __str__(self): """ Print a string representation of the Connection in the form of: server:port """ #print 'Connection.__str__' return "%s:%i" % (self._server, self._port) def __repr__(self): """ Print a representation of the Connection in the form of: Connection(server, port) Example: >>> Connection('xyzzy', 9876) Connection(server="xyzzy", port=9876) """ #print 'Connection.__repr__' return 'Connection("%s", %i)' % (self._server, self._port) def read(self, path): """ """ #print 'Connection.read("%s", %i, "%s")' % (path) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((self._server, self._port)) smsg = self.pack(OWMsg.read, len(path) + 1, 8192) s.sendall(smsg) s.sendall(path + '\x00') while 1: data = s.recv(24) if len(data) is not 24: raise exShortRead ret, payload_len, data_len = self.unpack(data) if payload_len >= 0: data = s.recv(payload_len) rtn = self.toNumber(data[:data_len]) break else: # ping response rtn = None break s.close() return rtn def write(self, path, value): """ """ #print 'Connection.write("%s", "%s")' % (path, str(value)) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((self._server, self._port)) value = str(value) smsg = self.pack(OWMsg.write, len(path) + 1 + len(value) + 1, len(value) + 1) s.sendall(smsg) s.sendall(path + '\x00' + value + '\x00') data = s.recv(24) if len(data) is not 24: raise exShortRead ret, payload_len, data_len = self.unpack(data) s.close() return ret def dir(self, path): """ """ #print 'Connection.dir("%s")' % (path) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((self._server, self._port)) smsg = self.pack(OWMsg.dir, len(path) + 1, 0) s.sendall(smsg) s.sendall(path + '\x00') fields = [] while 1: data = s.recv(24) if len(data) is not 24: raise exShortRead ret, payload_len, data_len = self.unpack(data) if payload_len > 0: data = s.recv(payload_len) fields.append(data[:data_len]) else: # end of dir list or 'ping' response break s.close() return fields def pack(self, function, payload_len, data_len): """ """ #print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len) return struct.pack('iiiiii', socket.htonl(0), #version socket.htonl(payload_len), #payload length socket.htonl(function), #type of function call socket.htonl(258), #format flags -- 266 for alias upport socket.htonl(data_len), #size of data element for read or write socket.htonl(0), #offset for read or write ) def unpack(self, msg): """ """ #print 'Connection.unpack("%s")' % msg if len(msg) is not 24: raise exInvalidMessage, msg val = struct.unpack('iiiiii', msg) version = socket.ntohl(val[0]) payload_len = socket.ntohl(val[1]) try: ret_value = socket.ntohl(val[2]) except OverflowError: ret_value = 0 format_flags = socket.ntohl(val[3]) data_len = socket.ntohl(val[4]) offset = socket.ntohl(val[5]) return ret_value, payload_len, data_len def toNumber(self, str): """ """ stripped = str.strip() if re.compile('^-?\d+$').match(stripped) : return int(stripped) if re.compile('^-?\d*\.\d*$').match(stripped) : # Could crash if it matched '.' - let it. return float(stripped) return str owfs-2.8p15/module/ownet/python/Readme.txt0000664000175000017500000000524610543507046015525 00000000000000ownet ===== ownet is a standalone python module for accessing 1-wire sensors through an owserver. The ownet module does not use the core ow libraries. Instead, it impliments the wire protocol for owserver communication. This means that the ow core libraries do no have to be installed on all systems, just on the system running owserver. The ownet module can be installed on any system with Python. Installation ------------ Via easy_install ++++++++++++++++ If you have installed easy_install (http://peak.telecommunity.com/DevCenter/EasyInstall) installing is as simple as: $ easy_install ownet Searching for ownet Reading http://www.python.org/pypi/ownet/ Reading http://www.owfs.org/ Reading http://www.python.org/pypi/ownet/0.2 Best match: ownet 0.2 Downloading http://cheeseshop.python.org/packages/source/o/ownet/ownet-0.2.tar.gz Processing ownet-0.2.tar.gz Running ownet-0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install--lFbng/ownet-0.2/egg-dist-tmp-ed4Ygq package init file 'examples/__init__.py' not found (or not a regular file) Creating missing __init__.py for examples zip_safe flag not set; analyzing archive contents... Adding ownet 0.2 to easy-install.pth file Installed /sw/lib/python2.5/site-packages/ownet-0.2-py2.5.egg Processing dependencies for ownet $ From CVS ++++++++ Installation of the ownet module follows the standard Python distutils installation. $ cd module/ownet/python $ sudo python setup.py install There should now be a module called ownet in the site-packages directory of the python installation. Examples -------- There are two sample programs in the examples directory - check_ow.py and temperatures.py. The check_ow.py program impliments a Nagios (http://www.nagios.org) plugin to monitor the value of a sensor field, like the temperature. Usage is beyond the scope of this document. See the Nagios documentation for configuring and monitoring via plugins. The temperatures.py will print out some details of the sensors along with the temperatures found on any sensor that has a field called temperature. Running it should print out something like: $ python ./examples/temperatures.py kuro2 9999 r: kuro2:9999/ - DS9490 r.entryList(): ['bus.0', 'settings', 'system', 'statistics'] r.sensorList(): [Sensor("/10.B7B64D000800", server="kuro2", port="9999"), Sensor("/26.AF2E15000000", server="kuro2", port="9999"), Sensor("/81.A44C23000000", server="kuro2", port="9999")] kuro2:9999/10.B7B64D000800 - DS18S20 22.4375 kuro2:9999/26.AF2E15000000 - DS2438 21.0938 $ where "kuro2" should be the host name where owserver is running and "9999" is the port to be used to communicate with the owserver. $Id: Readme.txt,v 1.2 2006/12/24 14:26:46 peterk Exp $ owfs-2.8p15/module/ownet/python/setup.py0000664000175000017500000000476210545001576015302 00000000000000""" ::BOH $Id: setup.py,v 1.2 2006/12/28 17:48:46 peterk Exp $ $HeadURL: http://subversion/stuff/svn/owfs/trunk/setup.py $ Copyright (c) 2006 Peter Kropf. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ::EOH ownet: access 1-wire sensors ownet is a standalone python module for accessing 1-wire sensors through an owserver. The ownet module does not use the core ow libraries. Instead, it impliments the wire protocol for owserver communication. This means that the ow core libraries do no have to be installed on all systems, just on the system running owserver. The ownet module can be installed on any system with Python. """ from distutils.core import setup, Extension classifiers = """ Development Status :: 4 - Beta Environment :: Console Intended Audience :: Developers Intended Audience :: System Administrators License :: OSI Approved :: GNU General Public License (GPL) Operating System :: MacOS Operating System :: Microsoft Operating System :: Microsoft :: Windows :: Windows NT/2000 Operating System :: Other OS Operating System :: POSIX Operating System :: Unix Programming Language :: Python Topic :: System :: Hardware Topic :: System :: Networking :: Monitoring Topic :: Utilities """ doclines = __doc__.split('::EOH')[1].split('\n')[1:] version = '0.3' setup( name = 'ownet', description = doclines[0], version = version, author = 'Peter Kropf', author_email = 'pkropf@gmail.com', maintainer = 'Peter Kropf', maintainer_email = 'pkropf@gmail.com', url = 'http://www.owfs.org/', license = 'GPL', platforms = ['any'], long_description = '\n'.join(doclines), classifiers = filter( None, classifiers.split( '\n' ) ), packages = ['ownet'], download_url = 'http://cheeseshop.python.org/packages/source/o/ownet/ownet-%s.tar.gz' % version ) owfs-2.8p15/module/ownet/python/MANIFEST.in0000664000175000017500000000014010543373735015317 00000000000000README.txt setup.py ownet/__init__.py ownet/connection.py recursive-include examples *.txt *.py owfs-2.8p15/module/ownet/python/Readme_pypi.txt0000664000175000017500000000235710543373735016574 00000000000000ownet on pypi ============= The ownet module has been registered on the `Python Cheese Shop `__ to allow for easier access. The Python Cheese Shop is the central location for finding and installing various Python programs, modules, tools, etc. Updating ownet on pypi ---------------------- 1) Register the latest version $ python setup.py register running register Using PyPI login from /Users/peter/.pypirc Server response (200): OK $ 2) Upload the latest version $ python setup.py sdist upload running sdist reading manifest file 'MANIFEST' creating ownet-0.2 creating ownet-0.2/examples creating ownet-0.2/ownet making hard links in ownet-0.2... hard linking README.txt -> ownet-0.2 hard linking setup.py -> ownet-0.2 hard linking examples/check_ow.py -> ownet-0.2/examples hard linking examples/temperatures.py -> ownet-0.2/examples hard linking ownet/__init__.py -> ownet-0.2/ownet hard linking ownet/connection.py -> ownet-0.2/ownet tar -cf dist/ownet-0.2.tar ownet-0.2 gzip -f9 dist/ownet-0.2.tar removing 'ownet-0.2' (and everything under it) running upload Submitting dist/ownet-0.2.tar.gz to http://www.python.org/pypi Server response (200): OK $ $Id: Readme_pypi.txt,v 1.1 2006/12/24 03:45:33 alfille Exp $ owfs-2.8p15/module/ownet/python/Makefile.in0000664000175000017500000003431111756250030015622 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/python DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = setup.py MANIFEST.in Readme.txt Readme_pypi.txt examples/check_ow.py examples/temperatures.py ownet/__init__.py ownet/connection.py 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 module/ownet/python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/python/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): 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-local 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-data-local 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 \ clean-local distclean distclean-generic distclean-libtool \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-data-local \ 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 install-data-local: # OpenSUSE is buggy and install libraries at /usr/local. # Need to add call "install_lib --install-dir" or call "install --install-lib" # $(PYTHON) setup.py install_lib --install-dir="/$(DESTDIR)$(PYSITEDIR)" $(PYTHON) setup.py install --install-lib="$(DESTDIR)$(PYSITEDIR)" # Other options are (but not needed): --install-data="/$(DESTDIR)$(PYSITEDIR)" --install-script="/$(DESTDIR)$(PYSITEDIR)" --install-header= clean-local: @RM@ -rf build clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/python/Makefile.am0000664000175000017500000000127711024230636015614 00000000000000## $Id: Makefile.am,v 1.9 2008/06/12 14:24:30 d1mag Exp $ EXTRA_DIST = setup.py MANIFEST.in Readme.txt Readme_pypi.txt examples/check_ow.py examples/temperatures.py ownet/__init__.py ownet/connection.py install-data-local: # OpenSUSE is buggy and install libraries at /usr/local. # Need to add call "install_lib --install-dir" or call "install --install-lib" # $(PYTHON) setup.py install_lib --install-dir="/$(DESTDIR)$(PYSITEDIR)" $(PYTHON) setup.py install --install-lib="$(DESTDIR)$(PYSITEDIR)" # Other options are (but not needed): --install-data="/$(DESTDIR)$(PYSITEDIR)" --install-script="/$(DESTDIR)$(PYSITEDIR)" --install-header= clean-local: @RM@ -rf build clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/php/0000775000175000017500000000000011756315510013106 500000000000000owfs-2.8p15/module/ownet/php/examples/0000775000175000017500000000000011756315510014724 500000000000000owfs-2.8p15/module/ownet/php/examples/ownet_example.php.in0000664000175000017500000000426410605152423020631 00000000000000get("/",OWNET_MSG_DIR,true)); var_dump($ow->get("/10.67C6697351FF/temperature",OWNET_MSG_READ,true)); var_dump($ow->get("/10.67C6697351FF",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/",OWNET_MSG_DIR,false)); var_dump($ow->get("/10.67C6697351FF/temperature",OWNET_MSG_READ,false)); var_dump($ow->get("/10.67C6697351FF",OWNET_MSG_PRESENCE,false)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,false)); ?> owfs-2.8p15/module/ownet/php/examples/bcadd.php0000664000175000017500000000345110545175566016427 00000000000000 strlen($real_part)) { for ($i=0;$i<=($scale - strlen($real_part));$i++) $real_part .= "0"; } // end checking for more precision needed // return built string return $int_part . "." . substr($real_part, 0, $scale); } // end function bcadd ?> owfs-2.8p15/module/ownet/php/examples/ownet_example.php0000664000175000017500000000427011756250044020227 00000000000000get("/",OWNET_MSG_DIR,true)); var_dump($ow->get("/10.67C6697351FF/temperature",OWNET_MSG_READ,true)); var_dump($ow->get("/10.67C6697351FF",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/",OWNET_MSG_DIR,false)); var_dump($ow->get("/10.67C6697351FF/temperature",OWNET_MSG_READ,false)); var_dump($ow->get("/10.67C6697351FF",OWNET_MSG_PRESENCE,false)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,false)); ?> owfs-2.8p15/module/ownet/php/Makefile.in0000664000175000017500000003733511756250030015101 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/php DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(phpdir)" DATA = $(php_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = ownet.php examples/bcadd.php examples/ownet_example.php.in examples/ownet_example.php phpdir = ${datadir}/php/OWNet php_DATA = ownet.php 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 module/ownet/php/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/php/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-phpDATA: $(php_DATA) @$(NORMAL_INSTALL) test -z "$(phpdir)" || $(MKDIR_P) "$(DESTDIR)$(phpdir)" @list='$(php_DATA)'; test -n "$(phpdir)" || 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)$(phpdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(phpdir)" || exit $$?; \ done uninstall-phpDATA: @$(NORMAL_UNINSTALL) @list='$(php_DATA)'; test -n "$(phpdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(phpdir)'; $(am__uninstall_files_from_dir) 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 $(DATA) installdirs: for dir in "$(DESTDIR)$(phpdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-phpDATA 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: uninstall-phpDATA .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-phpDATA 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 uninstall-phpDATA clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/php/ownet.php0000664000175000017500000010006311515426155014674 00000000000000 pack / unpack builtin function from linux sources #include uint32_t (pack format = 'N') htonl(uint32_t hostlong); uint16_t (pack format = 'n') htons(uint16_t hostshort); uint32_t (pack format = 'n') ntohl(uint32_t netlong); uint16_t (pack format = 'n') ntohs(uint16_t netshort); from http://www.linuxjournal.com/article/6788 IP's byte order also is big endian. */ // Constants for the OWNet class define('OWNET_DEFAULT_HOST' ,'127.0.0.1'); define('OWNET_DEFAULT_PORT' ,4304); define('OWNET_LINK_TYPE_SOCKET' ,0); define('OWNET_LINK_TYPE_STREAM' ,1); define('OWNET_LINK_TYPE_TCP' ,0); define('OWNET_LINK_TYPE_UDP' ,1); /* Constants for the owserver api message types. from ow.h enum msg_classification { msg_error, msg_nop, msg_read, msg_write, msg_dir, msg_size, // No longer used, leave here to compatibility msg_presence, }; */ define('OWNET_MSG_ERROR' ,0); define('OWNET_MSG_NOP' ,1); define('OWNET_MSG_READ' ,2); define('OWNET_MSG_WRITE' ,3); define('OWNET_MSG_DIR' ,4); define('OWNET_MSG_SIZE' ,5); define('OWNET_MSG_PRESENCE' ,6); define('OWNET_MSG_DIR_ALL' ,7); define('OWNET_MSG_READ_ANY' ,99999); if (!defined('TCP_NODELAY')) define('TCP_NODELAY',1); if (!defined('IPPROTO_TCP')) define('IPPROTO_TCP',6); $OWNET_GLOBAL_CACHE_STRUCTURE=array(); // cache value types length read write.... class OWNet{ protected $link=0; protected $host=''; protected $port=0; protected $sock_type=OWNET_LINK_TYPE_TCP; protected $link_type=OWNET_LINK_TYPE_SOCKET; protected $link_connected=false; protected $timeout=0; protected $use_swig_dir=true; function __construct($host='',$timeout=5,$use_swig_dir=true){ // just set default configurations $this->setHost($host); $this->timeout=abs((double)$timeout); $this->use_swig_dir=(bool)$use_swig_dir; } function setTimeout($timeout=5){ $this->timeout=abs((double)$timeout); } function getTimeout(){ return($this->timeout); } function setUseSwigDir($use){ $this->use_swig_dir=(bool)$use; } function getUseSwigDir(){ return($this->use_swig_dir); } function setHost($host=''){ // host must be "anything://host:port" or "anything://host" OR 'anything that don't parse_url and get default values' // use "stream://host:port" or "ow-stream://host:port" to prefer stream instead sockets $tmp_path =@parse_url($host); // get URL information from host if (!isset($tmp_path['scheme'])) $tmp_path =@parse_url("tcp://$host"); $this->host = (!isset($tmp_path['host'])?OWNET_DEFAULT_HOST:$tmp_path['host']); // if don't have host get default host $this->port =(int) (!isset($tmp_path['port'])?OWNET_DEFAULT_PORT:$tmp_path['port']); // if don't have port get default port $prefer_sock =(isset($tmp_path['scheme'])? ($tmp_path['scheme']!='stream' && $tmp_path['scheme']!='ow-stream' && $tmp_path['scheme']!='stream-udp' && $tmp_path['scheme']!='ow-stream-udp') :true); // check if prefer using streams instead socket if (strpos($tmp_path['scheme'],'udp')!==false) $this->sock_type=OWNET_LINK_TYPE_UDP; else $this->sock_type=OWNET_LINK_TYPE_TCP; unset($tmp_path); if (function_exists('socket_connect') && $prefer_sock){ $this->link_type=OWNET_LINK_TYPE_SOCKET; // prefer socks }else{ $this->link_type=OWNET_LINK_TYPE_STREAM; // prefer stream } $this->link_connected =false; return(true); } function getHost(){ // return and URI that can be used with setHost again if ($this->link_type==OWNET_LINK_TYPE_STREAM) return('ow-stream'.($this->sock_type==OWNET_LINK_TYPE_UDP?'-udp':'').'://'.$this->host.':'.$this->port); // using streams return('ow'.($this->sock_type==OWNET_LINK_TYPE_UDP?'-udp':'').'://'.$this->host.':'.$this->port); // using sockets if possible } protected function pack_htonl( $val ){ // builtin function to use htonl, big endian style $bval =str_pad(decbin(bcadd($val,0,0)),8*4,'0',STR_PAD_LEFT); $b1 =bindec(substr($bval,0,8)); $b2 =bindec(substr($bval,8,8)); $b3 =bindec(substr($bval,16,8)); $b4 =bindec(substr($bval,24,8)); return(chr($b1).chr($b2).chr($b3).chr($b4)); } protected function unpack_ntohl($str){ // builtin function to use ntohl, big endian style, not shure if it's right $size=strlen($str)/4; $ret=array(); for($i=0;$i<$size;$i++){ $bval =substr($str,$i*4,4); $b1 =ord(substr($bval,0,1)); $b2 =ord(substr($bval,1,1)); $b3 =ord(substr($bval,2,1)); $b4 =ord(substr($bval,3,1)); $value =$b4 + ($b3<<8) + ($b2<<16) + ($b1<<24); $ret[$i]=$value; } return($ret); } private function disconnect(){ // disconnect link if ($this->link_type==OWNET_LINK_TYPE_SOCKET){ // socket @socket_set_block($this->link); if ($this->sock_type==OWNET_LINK_TYPE_TCP) @socket_shutdown($this->link,2); @socket_close($this->link); }else{ @fclose($this->link); // streams } $this->link=NULL; $this->link_connected=false; } private function connect(){ // connect with sockets or stream if ($this->link_connected) return(true); // if connected don't continue if ($this->link_type==OWNET_LINK_TYPE_SOCKET){ // socket if ($this->sock_type==OWNET_LINK_TYPE_TCP){ $this->link=@socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // create socket if ($this->link){ @socket_set_block($this->link); // set it to blocking $ok=@socket_connect($this->link,$this->host,$this->port); // try to connect if (!$ok){ $errno =@socket_last_error(); // get error when connecting $errstr =@socket_strerror(socket_last_error()); trigger_error("Can't create socket [ow://".$this->host.":".$this->port."], errno: $errno, error: $errstr",E_USER_NOTICE); @socket_shutdown($this->link,2); // unload socket @socket_close($this->link); $this->link=NULL; return(false); // return false on error or can't connect } // socket created and connected }else{ $errno =@socket_last_error(); // get error when creating socket $errstr =@socket_strerror(@socket_last_error()); trigger_error("Can't create socket [ow://".$this->host.":".$this->port."], errno: $errno, error: $errstr",E_USER_NOTICE); return(false); // return false on error or can't connect } }else{ // udp $this->link=@socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); // create socket if ($this->link){ @socket_set_block($this->link); // set it to blocking }else{ $errno =@socket_last_error(); // get error when creating socket $errstr =@socket_strerror(@socket_last_error()); trigger_error("Can't create socket [ow-udp://".$this->host.":".$this->port."], errno: $errno, error: $errstr",E_USER_NOTICE); return(false); // return false on error or can't connect } } }else{ // stream $this->link =@stream_socket_client( ($this->sock_type==OWNET_LINK_TYPE_TCP?'tcp://':'udp://'). $this->host.":".$this->port, $errno, $errstr, $this->timeout); // connect with streams, could be with fsockopen but stream_socket_client is faster (we will use PHP 5+) if (!$this->link){ trigger_error("Can't create stream [ow-stream".($this->sock_type!=OWNET_LINK_TYPE_TCP?'-udp':'')."://".$this->host.":".$this->port."], errno: $errno, error: $errstr",E_USER_NOTICE); return(false); // return false on error or can't connect } } $this->set_link_options(); // set socket options or stream options $this->link_connected=true; return(true); // ok } private function set_link_options(){ // set link options if (!$this->link_connected) return(false); if ($this->link_type==OWNET_LINK_TYPE_SOCKET){ // socket socket_set_block( $this->link); // set blocking mode if ($this->sock_type==OWNET_LINK_TYPE_TCP){ socket_set_option( $this->link,SOL_SOCKET, SO_RCVTIMEO, array("sec"=>0, "usec"=>100)); // receive timeout socket_set_option( $this->link,SOL_SOCKET, SO_SNDTIMEO, array("sec"=>0, "usec"=>100)); // send timeout socket_set_option($this->link, SOL_SOCKET, SO_REUSEADDR, 1); // reuse address socket_set_option($this->link, SOL_SOCKET, SO_OOBINLINE, 1); // out off band inline @socket_set_option($this->link, IPPROTO_TCP, TCP_NODELAY, 1); // no delay can have bug with windows?! } socket_set_option($this->link, SOL_SOCKET, SO_RCVBUF, 8192); // set receive buffer socket_set_option($this->link, SOL_SOCKET, SO_SNDBUF, 8192); // set send buffer }else{ stream_set_timeout($this->link ,20); // set timeout stream_set_blocking($this->link ,1); // set blocking mode stream_set_write_buffer($this->link ,0); // flush everything directly without buffer (faster than with buffer=8192) } return(true); } private function get_msg($msg_size=24){ // return false on error // get messagem from server $num_changed_sockets =0; $read_data =''; $last_read =microtime(1); $t1=intval($this->timeout); $t2=($this->timeout*1000000)%1000000; while ($num_changed_sockets<=0){ // can loop forever? owserver must send something! or disconnect! $read=array($this->link); if ($this->link_type==OWNET_LINK_TYPE_SOCKET) $num_changed_sockets = socket_select($read, $write = NULL, $except = NULL, $t1,$t2); // use socket_select else $num_changed_sockets = stream_select($read, $write = NULL, $except = NULL, $t1,$t2); // use stream_select if ($num_changed_sockets===false){ // error handling select $this->disconnect(); trigger_error("Error handling get_msg#1",E_USER_NOTICE); return(false); // return false when have error }elseif($num_changed_sockets>0){ // we can read! if ($this->link_type==OWNET_LINK_TYPE_SOCKET){ if ($this->sock_type==OWNET_LINK_TYPE_TCP){ $read_data=socket_read($this->link,$msg_size,PHP_BINARY_READ); // read with sockets }else{ $ret=socket_recvfrom($this->link,$read_data,$msg_size,$tmp_host,$tmp_port); // read with sockets if ($ret>0){ $this->host=$tmp_host; $this->port=$tmp_port; } } }else $read_data=fread($this->link,$msg_size); // read with streams if ($read_data==''){ // disconnected :'( $this->disconnect(); trigger_error("Disconnected",E_USER_NOTICE); return(false); // return false when have error }else $last_read =microtime(1); break; }else break; if (microtime(1)-$last_read>$this->timeout) break; } return($read_data); // return data } private function send_msg($string){ // return false on error and true on success, trigger error on disconnection // send message to server if (!$this->link_connected) return(false); $num_changed_sockets=0; while ($num_changed_sockets<=0){ $write=array($this->link); if ($this->link_type==OWNET_LINK_TYPE_SOCKET) $num_changed_sockets = socket_select($read = NULL, $write , $except = NULL, 0,1000); // use socket_select else $num_changed_sockets = stream_select($read = NULL, $write , $except = NULL, 0,1000); // use stream_select if ($num_changed_sockets===false){ // error handling $this->disconnect(); trigger_error("Error handling send_msg#1",E_USER_NOTICE); return(false); // return false on error } } $size=strlen($string); $sent=0; while($sent<$size){ // we will not use select, using can be slower, and without work! :D if ($this->link_type==OWNET_LINK_TYPE_SOCKET){ if ($this->sock_type==OWNET_LINK_TYPE_TCP) $ret=socket_write($this->link, $string, strlen($string)); // write and get sent bytes else $ret=socket_sendto($this->link, $string, strlen($string),0,$this->host,$this->port); // write and get sent bytes }else $ret=fwrite($this->link,$string,strlen($string)); // write and get sent bytes if ($ret===false){ // error sending $this->disconnect(); trigger_error("Error writing send_msg#1",E_USER_NOTICE); return(false); // return false on error } $sent+=$ret; // add sent bytes } return(true); // ok everything sent } function read($path,$parse_value=true){ // return NULL on error or no file // if $parse_value return php parsed value type (boolean,double,string), if not return an string value return($this->get($path,OWNET_MSG_READ,false,$parse_value)); // return get with right flags } function dir($path){ // return NULL on error or no directory // return numeric array starting from 0 with directory list return($this->get($path,OWNET_MSG_DIR_ALL,false,false)); // return get with right flags } function presence($path){ // return NULL on error // return true or false on success return($this->get($path,OWNET_MSG_PRESENCE,false,false)); // return get with right flags } function get($path='/',$get_type=OWNET_MSG_READ,$return_full_info_array=false,$parse_php_type=true){ // return NULL on error // path = path of file or directory // get_type = OWNET_MSG_READ_ANY (READ AND DIR) // OWNET_MSG_READ read an file // OWNET_MSG_DIR or OWNET_MSG_DIR_ALL read an directory (output is an array) // OWNET_MSG_PRESENCE check presence output is true or false // return_full_info_array if true return everything from comunication and unit if variables is an temperature, ['data'] is returned data and ['data_php'] is an parsed data in (double) or (string) types // parse_php_type if true try to get right data_php variable type // return NULL on error or not founded // return an array on OWNET_MSG_DIR or when return_full_info_array=true // return true or false when OWNET_MSG_PRESENCE $path=trim($path); // trim path if ($get_type==OWNET_MSG_READ_ANY){ // getting first read $ret=$this->get($path,OWNET_MSG_READ,$return_full_info_array,$parse_php_type); if ($ret!==NULL) return($ret); // ok we get and result return($this->get($path,OWNET_MSG_DIR_ALL,$return_full_info_array,$parse_php_type)); // return dir } if ($get_type!=OWNET_MSG_DIR && $get_type!=OWNET_MSG_DIR_ALL){ if (substr($path,strlen($path)-1,1)=='/') // isn't a dir, dir must end with characters != '/' return(NULL); } $this->disconnect(); // be sure that we are disconnected $this->connect(); // try to connect if (!$this->link_connected){ trigger_error("Can't connect get#1",E_USER_NOTICE); return(NULL); } // get value if ($get_type==OWNET_MSG_DIR || $get_type==OWNET_MSG_DIR_ALL){ // get right send function $msg=$this->pack($get_type ,strlen($path)+1,0 ); }elseif ($get_type==OWNET_MSG_PRESENCE){ $msg=$this->pack(OWNET_MSG_PRESENCE ,strlen($path)+1,0 ); }else{ $get_type=OWNET_MSG_READ; $msg=$this->pack(OWNET_MSG_READ ,strlen($path)+1,8192 ); } if ( $this->send_msg($msg)===false ){ trigger_error("Can't write to resource get#1",E_USER_NOTICE); return(NULL); // error sending } if ( $this->send_msg($path.chr(0))===false){ trigger_error("Can't write to resource get#2",E_USER_NOTICE); return(NULL); // error sending } if ($parse_php_type) global $OWNET_GLOBAL_CACHE_STRUCTURE; // we will use for parse_php_type // get return $return=NULL; // set to NULL if nothing returned while(1){ unset($ret,$data,$tmp_ret,$start,$data_len); $data='';$tmp_ret=''; $start=microtime(1); while(1){ $tmp_ret=$this->get_msg(24); if ($tmp_ret===false){ trigger_error("Can't read from resource get#3",E_USER_NOTICE); $this->disconnect(); return(NULL); } if (strlen($tmp_ret)>0) $start=microtime(1); $data.=$tmp_ret; unset($tmp_ret); if(strlen($data)>=24 || (microtime(1)-$start)>$this->timeout) break; } $ret=$this->unpack(substr($data,0,24)); // unpack 24bytes into 6 data if (count($ret)<6){ if ($get_type==OWNET_MSG_DIR_ALL) // old servers return($this->get($path,OWNET_MSG_DIR,$return_full_info_array,$parse_php_type)); $data=substr($data,0,24); trigger_error("Error unpacking data get#1 [".strlen($data)."] ".$data,E_USER_NOTICE); $this->disconnect(); return(NULL); } if ($get_type==OWNET_MSG_PRESENCE){ // check presence if (!isset($ret[2])) return(NULL); // error ?! maybe not (count < 6) return($ret[2]===0); // ret[2]!=0 => not present } $data=substr($data,24); // if any data was read with more than 24 bytes if (!isset($ret[1])) $ret[1]=false; // just to be sure that will not get into $ret parsing if ($ret[1]>0){ if ($get_type==OWNET_MSG_DIR || $get_type==OWNET_MSG_DIR_ALL) // reading directory use $ret[1] for read data $data_len=$ret[1]; else $data_len=$ret[2]; // reading file use $ret[2] for read data $tmp_ret=''; $start=microtime(1); // set start time for timeout read if ($data_len>0) while(1){ $tmp_ret=$this->get_msg($data_len); if ($tmp_ret===false){ trigger_error("Can't read from resource get#4",E_USER_NOTICE); // error receiving $this->disconnect(); return(NULL); // return NULL on error } if (strlen($tmp_ret)>0) $start=microtime(1); $data.=$tmp_ret;unset($tmp_ret); if(strlen($data)>=$data_len || (microtime(1)-$start)>$this->timeout) // timedout or got every data that we need break; } if (!$return_full_info_array && strlen($data)!=$data_len){ // if just return value and data < data_len return as an error trigger_error("Can't read full data get#1",E_USER_NOTICE); $this->disconnect(); return(NULL); // return NULL on error } if ($get_type==OWNET_MSG_DIR){ // reading dir $ret['data'] =$data; $ret['data_len']=strlen($data); $ret['data_php']=substr($data,0,$ret[4]); // ret[4] is the right filename size ?! it's work :D if ($return===NULL) $return=array(); // se return as an array to get values if ($return_full_info_array) $return[]=$ret; // return an array else $return[]=$ret['data_php']; // return file name // continue while... }else{ $ret['data'] =substr($data,0,$data_len); // data_php length is the same as $ret[2] $ret['data_len']=strlen($data); $this->disconnect(); // disconnect from server $type=false; // check type? if ($parse_php_type && $get_type!=OWNET_MSG_DIR_ALL){ $tmp =explode('/',$path);$c=count($tmp)-1; if ($c>0){ // must be something like '/dir/file' array('dir', 'file'), count()-1 = 1 > 0 $variavel =$tmp[$c]; // get last two uri args $ow =$tmp[$c-1]; unset($tmp); if (preg_match('/([0-9A-F]{2})[\.]{0,1}[0-9A-F]{12}/',$ow,$tmp)){ // check if ow is an OW id ("XX.ZZZZZZZZZZZZ or XXZZZZZZZZZZZZ") $tmp=$tmp[1]; if (!isset($OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel])){ // check if we have structure information $tmp_v=@$this->get("/structure/$tmp/$variavel",OWNET_MSG_READ,false,false); // get estrutucture information if ($tmp_v!==NULL){ $tmp_v=explode(',',$tmp_v); // ok :D we will get real php values now! $OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel]=$tmp_v; $type=$tmp_v; } }else $type=$OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel]; } } unset($tmp,$tmp_v,$variavel,$ow,$c); } if ($type!==false){ // get real php values $ret['data_php']=$ret['data']; if($type[0]=='i'){ $ret['data_php']=bcadd($ret['data_php'],0,0); // integer (using bcmath for bigger precision) }elseif($type[0]=='u'){ $ret['data_php']=bcadd($ret['data_php'],0,0); // unsigned integer (using bcmath for bigger precision) if (bccmp($ret['data_php'],0,0)==-1){ $ret['data_php']=substr($ret['data_php'],1); // be shure that it's unsigned } }elseif(in_array($type[0],array('f','t',chr(152)))){ $ret['data_php']=(double)$ret['data_php']; // using float (double) values, maybe sprinf("%.50f",$value) could get an string representation if ($return_full_info_array){ if ($type[0]=='t'){ // temperature (last owserver versions... maybe an 'v' for volts and 'A' for amps could be implemented) // we can't cache cause server may restart or change configurations while we have old cache information, here we will have +- .1 seconds of performace lost, set return full information off if you don't want it $tmp_v=@$this->get("/settings/units/temperature_scale",OWNET_MSG_READ,false,false); // get server current scale if ($tmp_v!==NULL) // just for compatible with old owservers $ret['unit']=$tmp_v; // use unit if return full information } } }elseif(in_array($type[0],array('a','b','d'))){ $ret['data_php']=(string)$ret['data_php']; // string (maybe without it could work too, but's it's pretty :D ) }elseif($type[0]=='y'){ $ret['data_php']=($ret['data_php']==1?true:false); // boolean content } // another contents are parsed as string too }else{ $ret['data_php']=&$ret['data']; // we will use not parsed values (we use it when getting structure information! or setting $parse_php_type=false) } if ($get_type==OWNET_MSG_DIR_ALL){ $return=& $ret; break; } if ($return_full_info_array){ return($ret); // return array }else{ return($ret['data_php']); // return just php parsed value } } }else{ break; } } $this->disconnect(); // disconnect from server (dir listing) if ($get_type==OWNET_MSG_DIR_ALL && $return===NULL) // old servers return($this->get($path,OWNET_MSG_DIR,$return_full_info_array,$parse_php_type)); if ($return!==NULL){ if ($this->use_swig_dir && !$return_full_info_array && $get_type==OWNET_MSG_DIR) if (is_array($return)) $return=implode(',',$return); if ($this->use_swig_dir==false && $get_type==OWNET_MSG_DIR_ALL){ if ($return_full_info_array){ $tmp=explode(',',$return['data_php']); $r=array(); for ($i=0;$i$return[0], 1=>$return[1], 2=>$return[2], 3=>$return[3], 4=>$return[4], 5=>$return[5], 'data'=>$return['data'], 'data_len'=>$return['data_len'], 'data_php'=>$tmp[$i] ); $return=$r; unset($tmp,$r); }else $return=explode(',',$return); } } return($return); } function set($path,$value=''){ // set and value to path checking before if path is readonly or not $path=trim($path); // trim path $tmp =explode('/',$path);$c=count($tmp)-1; $type=false; if ($c>0){ // try to get information about structure, if file is readonly or not $variavel =$tmp[$c]; $ow =$tmp[$c-1]; unset($tmp); if (preg_match('/([0-9A-F]{2})[\.]{0,1}[0-9A-F]{12}/',$ow,$tmp)){ $tmp=$tmp[1]; if (!isset($OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel])){ $tmp_v=@$this->get("/structure/$tmp/$variavel",OWNET_MSG_READ,false,false); // get estrutucture information if ($tmp_v!==NULL){ $tmp_v=explode(',',$tmp_v); $OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel]=$tmp_v; // ok we will test it $type=$tmp_v; } }else $type=$OWNET_GLOBAL_CACHE_STRUCTURE[$tmp.'/'.$variavel]; // very fine, it was cached! :D performace boost } } if ($type!==false){ if ($type[3]=='ro'){ // read only file trigger_error("Read only value set#1 [$path]",E_USER_NOTICE); return(false); // return false on error } } unset($type,$tmp,$tmp_v,$variavel,$ow,$c); $this->disconnect(); $this->connect(); if (!$this->link_connected){ trigger_error("Can't connect set#1",E_USER_NOTICE); return(false); // return false on error } if (!is_string($value)) $value=(string)$value; // be sure that's an string $msg=$this->pack(OWNET_MSG_WRITE,strlen($path)+1+strlen($value)+1,strlen($value)+1); // pack data if ( $this->send_msg($msg)===false ){ trigger_error("Can't write to resource set#1",E_USER_NOTICE); return(false); // error sending } if ( $this->send_msg($path.chr(0).$value.chr(0))===false ){ trigger_error("Can't write to resource set#2",E_USER_NOTICE); return(false); // error sending value } $data='';$tmp_ret=''; $start=microtime(1); // start timeout counter while(1){ $tmp_ret=$this->get_msg(24); if ($tmp_ret===false){ trigger_error("Can't read from resource set#1",E_USER_NOTICE); $this->disconnect(); return(false); // error reading return } if (strlen($tmp_ret)>0) $start=microtime(1); $data.=$tmp_ret;unset($tmp_ret); if(strlen($data)>=24 || (microtime(1)-$start)>$this->timeout) // timed out or got content break; } $ret=$this->unpack($data); // unpack data return if (count($ret)<6){ trigger_error("Error unpacking data set#1 [".strlen($data)."] ".$data,E_USER_NOTICE); $this->disconnect(); return(false); // return false on error } if (!isset($ret[2])) $ret[2]=1; // be sure that we will work with error_reporting(E_ALL) if ($ret[2]!=0) $ret=false; // return false on error $this->disconnect(); // disconnect from server if ($ret!==false) return(true); // very fine :) return($ret); // :( } private function unpack($data){ // unpack returned contents (24 bytes data) $unpack=$this->unpack_ntohl($data); return($unpack); // version= 0, payload_len=1, ret_value=2, format_flags=3, data_len=4, offset=5 } private function pack($function,$payload_len,$data_len){ // pack msg information (24 bytes) $pack= $this->pack_htonl(0). $this->pack_htonl($payload_len). $this->pack_htonl($function). $this->pack_htonl(258). $this->pack_htonl($data_len). $this->pack_htonl(0); return($pack); } } /* explanation: EVERY FUNCTION TRIGGER AN ERROR! you should use @$ow->function to don't handle errors $ow=new OWNet($host,$timeout=5,$use_swig_dir=true); in top of file we have some constants: (line 58) define('OWNET_DEFAULT_HOST' ,'127.0.0.1'); define('OWNET_DEFAULT_PORT' ,4304); i don't know what's the default OW port, i'm using today 4304 :) for OWNet($host) we can use this types of host value: "scheme://host:port" "scheme://host" "anything that can't be parsed with parseurl" if port isn't set we get default port, if host isn't set we get default host if scheme == "stream" or scheme == "ow-stream" we will prefer to use PHP stream_socket_client functions else if function socket_create exists we will use socket_connect() with sockets we can set TCP_NODELAY SO_REUSEADDR SO_OOBINLINE(we use it?) SO_RCVBUF SO_SNDBUF $ow->setHost($host) is the same thing that new OWNet($host) $ow->getHost() get host URI owstream://host:port if using stream_socket_client ow://host:port if using sockets $ow->setTimeout($timeout=5) set read timeout, default 5 $ow->getTimeout() get read timeout $ow->set($path,$value='') set an value to path true on success false on error or if file is readonly $ow->read($path,$parse_value=true) return value if parse_value return an php parsed value, if not return an string $ow->dir($path) return an dir (see setUserSwigDir and OWNet constructor) $ow->presence($path) get presence $ow->get($path='/',$get_type=OWNET_MSG_READ_ANY,$return_full_info_array=false,$parse_php_type=true) on error return NULL get_type can be: OWNET_MSG_READ (execute OWNET_MSG_READ and if don't find execute OWNET_MSG_DIR) OWNET_MSG_READ *default read an file from owserver OWNET_MSG_DIR read an dir from owserver OWNET_MSG_PRESENCE read presence from owserver (return false or true) return_full_info_array if true return an array with everything that was received from owserver more data_php and unit if file is an temperature value parse_php_type try to check what type is an file (temperature, boolean, string, number (double or integer)) $ow->setUseSwigDir($use) // use swig dir style (dir,dir,dir) and not php array (array(dir,dir,dir)) $ow->getUseSwigDir() // get if using swig dir style END :) examples: $ow=new OWNet("tcp://172.16.1.100:4304"); var_dump($ow->get("/",OWNET_MSG_DIR,true)); var_dump($ow->get("/10.E8C1C9000800/temperature",OWNET_MSG_READ,true)); var_dump($ow->get("/10.E8C1C9000800",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,true)); var_dump($ow->get("/",OWNET_MSG_DIR,false)); var_dump($ow->get("/10.E8C1C9000800/temperature",OWNET_MSG_READ,false)); var_dump($ow->get("/10.E8C1C9000800",OWNET_MSG_PRESENCE,false)); var_dump($ow->get("/WRONG VALUE",OWNET_MSG_PRESENCE,false)); return: array(9) { [0]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(5) [5]=> int(0) ["data"]=> string(42) "bus.0athaðãaPÜa»a0" ["data_len"]=> int(42) ["data_php"]=> string(5) "bus.0" } [1]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(8) [5]=> int(0) ["data"]=> string(42) "settings0" ["data_len"]=> int(42) ["data_php"]=> string(8) "settings" } [2]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(6) [5]=> int(0) ["data"]=> string(42) "system0" ["data_len"]=> int(42) ["data_php"]=> string(6) "system" } [3]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(10) [5]=> int(0) ["data"]=> string(42) "statistics0" ["data_len"]=> int(42) ["data_php"]=> string(10) "statistics" } [4]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(16) [5]=> int(0) ["data"]=> string(42) "/10.E8C1C9000800P×aàÑa »a0" ["data_len"]=> int(42) ["data_php"]=> string(16) "/10.E8C1C9000800" } [5]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(16) [5]=> int(0) ["data"]=> string(42) "/10.54FDED000800P×aàÑa »a0" ["data_len"]=> int(42) ["data_php"]=> string(16) "/10.54FDED000800" } [6]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(16) [5]=> int(0) ["data"]=> string(42) "/10.6F7EC9000800P×aàÑa »a0" ["data_len"]=> int(42) ["data_php"]=> string(16) "/10.6F7EC9000800" } [7]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(16) [5]=> int(0) ["data"]=> string(42) "/28.924FE0000000P×aàÑa »a0" ["data_len"]=> int(42) ["data_php"]=> string(16) "/28.924FE0000000" } [8]=> array(9) { [0]=> int(0) [1]=> int(42) [2]=> int(0) [3]=> int(258) [4]=> int(16) [5]=> int(0) ["data"]=> string(42) "/28.5D59E0000000P×aàÑa »a0" ["data_len"]=> int(42) ["data_php"]=> string(16) "/28.5D59E0000000" } } array(10) { [0]=> int(0) [1]=> int(8192) [2]=> int(12) [3]=> int(0) [4]=> int(12) [5]=> int(0) ["data"]=> string(12) " 28.625" ["data_len"]=> int(12) ["data_php"]=> float(28.625) ["unit"]=> string(1) "C" } bool(true) bool(false) array(9) { [0]=> string(5) "bus.0" [1]=> string(8) "settings" [2]=> string(6) "system" [3]=> string(10) "statistics" [4]=> string(16) "/10.E8C1C9000800" [5]=> string(16) "/10.54FDED000800" [6]=> string(16) "/10.6F7EC9000800" [7]=> string(16) "/28.924FE0000000" [8]=> string(16) "/28.5D59E0000000" } float(28.625) bool(true) */ ?> owfs-2.8p15/module/ownet/php/Makefile.am0000664000175000017500000000036211536703141015060 00000000000000## $Id: Makefile.am,v 1.7 2011/03/12 14:42:41 alfille Exp $ EXTRA_DIST = ownet.php examples/bcadd.php examples/ownet_example.php.in examples/ownet_example.php phpdir=${datadir}/php/OWNet php_DATA=ownet.php clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/Makefile.in0000664000175000017500000005166311756250030014312 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = c php python perl5 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @ENABLE_OWPHP_TRUE@@ENABLE_PHP_TRUE@OWNET_SUBDIRPHP = php @ENABLE_OWPYTHON_TRUE@@ENABLE_PYTHON_TRUE@OWNET_SUBDIRPYTHON = python @ENABLE_OWPERL_TRUE@@ENABLE_PERL_TRUE@OWNET_SUBDIRPERL = perl5 @ENABLE_OWNETLIB_TRUE@OWNET_SUBDIROWNETLIB = c SUBDIRS = $(OWNET_SUBDIROWNETLIB) $(OWNET_SUBDIRPHP) $(OWNET_SUBDIRPYTHON) $(OWNET_SUBDIRPERL) all: all-recursive .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 module/ownet/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/perl5/0000775000175000017500000000000011756315510013346 500000000000000owfs-2.8p15/module/ownet/perl5/OWNet/0000775000175000017500000000000011756315510014342 500000000000000owfs-2.8p15/module/ownet/perl5/OWNet/lib/0000775000175000017500000000000011756315510015110 500000000000000owfs-2.8p15/module/ownet/perl5/OWNet/lib/OWNet.pm0000775000175000017500000005155111542520427016372 00000000000000package OWNet ; # OWNet module for perl # $Id: OWNet.pm,v 1.22 2011/03/24 01:40:39 alfille Exp $ # # Paul H Alfille -- copyright 2007 # Part of the OWFS suite: # http://www.owfs.org # http://owfs.sourceforge.net =head1 NAME OWNet - Light weight access to B =head1 SYNOPSIS OWNet is an easy way to access B and thence the 1-wire bus. Dallas Semiconductor's 1-wire system uses simple wiring and unique addresses for its interesting devices. The B is a suite of programs that hide 1-wire details behind a file system metaphor. B connects to the 1-wire bus and provides network access. B is a perl module that connects to B and allows reading, writing and listing the 1-wire bus. Example perl program that prints the temperature: use OWNet ; print OWNet::read( "localhost:4304" , "/10.67C6697351FF/temperature" ) ."\n" ; There is the alternative object oriented form: use OWNet ; my $owserver = OWNet->new( "localhost:4304" ) ; print $owserver->read( "/10.67C6697351FF/temperature" ) ."\n" ; =head1 SYNTAX =head2 methods =over =item B my $owserver = OWNet -> new( address ) ; =item B OWNet::read( address, path [,size [,offset]] ) $owserver -> read( path [,size [,offset]] ) =item B OWNet::write( address, path, value [,offset] ) $owserver -> write( path, value [,offset] ) =item B OWNet::dir( address, path ) $owserver -> dir( path ) =back =head2 I
TCP/IP I
of B. Valid forms: =over =item I test.owfs.net:4304 =item I number: 123.231.312.213:4304 =item I localhost:4304 =item I 4304 =back =head2 I Additional arguments to add to address Temperature scale can also be specified in the I
. Same syntax as the other OWFS programs: =over =item -C Celsius (Centigrade) =item -F Fahrenheit =item -K Kelvin =item -R Rankine =back Pressure scale can also be specified in the I
. Same syntax as the other OWFS programs: =over =item --mbar millibar (default) =item --atm atmosphere =item --mmHg mm Mercury =item --inHg inch Mercury =item --psi pounds per inch^2 =item --Pa pascal =back Device display format (1-wire unique address) can also be specified in the I
, with the general form of -ff[.]i[[.]c] (Iamily Id Irc): =over =item -ff.i /10.67C6697351FF (default) =item -ffi /1067C6697351FF =item -ff.i.c /10.67C6697351FF.8D =item -ff.ic /10.67C6697351FF8D =item -ffi.c /1067C6697351FF.8D =item -ffic /1067C6697351FF8D =back Show directories that are themselves directories with a '/' suffix ( e.g. /10.67C6697351FF/ ) =over =item -slash show directory elements =back Warning messages will only be displayed if verbose flag is specified in I
=over =item -v verbose =back =head2 I B-type I to an item on the 1-wire bus. Valid forms: =over =item main directories Used for the I method. E.g. "/" "/uncached" "/1F.321432320000/main" =item device directory Used for the I and I method. E.g. "/10.4300AC220000" "/statistics" =item device properties Used to I, I. E.g. "/10.4300AC220000/temperature" =back =head2 I New I for a device property. Used by I. =head1 METHODS =over =cut BEGIN { } use 5.008 ; use warnings ; use strict ; use IO::Socket::INET ; use bytes ; my $MSG_READ = 2 ; my $MSG_WRITE = 3 ; my $MSG_DIR = 4 ; my $MSG_PRESENCE = 6 ; my $MSG_DIRALL = 7 ; my $MSG_DIRALLSLASH = 9 ; # return value should be negative for error, but the networking layer uses 32bit unsigned integers. This is the boundary. my $MAX_RETURN = 66000 ; # Network timeout in ms my $MAX_WAIT = 3000 ; my $RECV_FLAGS = 0 ; my $SEND_FLAGS = 0 ; my $NO_OFFSET = 0 ; my $PERSISTENCE_BIT = 0x04 ; # PresenceCheck, Return bus list, and apply aliases my $DEFAULT_SG = 0x100 + 0x2 + 0x8 ; my $DEFAULT_BLOCK_LENGTH = 33000 ; our $VERSION=(split(/ /,q[$Revision: 1.22 $]))[1] ; sub _new($$) { my ($self,$addr) = @_ ; $addr =~ s/--/-/g ; my $tempscale = 0 ; TEMPSCALE: { $tempscale = 0x00000 , last TEMPSCALE if $addr =~ /-C/ ; $tempscale = 0x10000 , last TEMPSCALE if $addr =~ /-F/ ; $tempscale = 0x20000 , last TEMPSCALE if $addr =~ /-K/ ; $tempscale = 0x30000 , last TEMPSCALE if $addr =~ /-R/ ; } my $presscale = 0 ; PRESSCALE: { $presscale = 0x000000 , last PRESSCALE if $addr =~ /-mbar/i ; $presscale = 0x040000 , last PRESSCALE if $addr =~ /-atm/i ; $presscale = 0x080000 , last PRESSCALE if $addr =~ /-mmhg/i ; $presscale = 0x0C0000 , last PRESSCALE if $addr =~ /-inhg/i ; $presscale = 0x100000 , last PRESSCALE if $addr =~ /-psi/i ; $presscale = 0x140000 , last PRESSCALE if $addr =~ /-pa/i ; } my $format = 0 ; FORMAT: { $format = 0x2000000 , last FORMAT if $addr =~ /-ff\.i\.c/ ; $format = 0x4000000 , last FORMAT if $addr =~ /-ffi\.c/ ; $format = 0x3000000 , last FORMAT if $addr =~ /-ff\.ic/ ; $format = 0x5000000 , last FORMAT if $addr =~ /-ffic/ ; $format = 0x0000000 , last FORMAT if $addr =~ /-ff\.i/ ; $format = 0x1000000 , last FORMAT if $addr =~ /-ffi/ ; $format = 0x2000000 , last FORMAT if $addr =~ /-f\.i\.c/ ; $format = 0x4000000 , last FORMAT if $addr =~ /-fi\.c/ ; $format = 0x3000000 , last FORMAT if $addr =~ /-f\.ic/ ; $format = 0x5000000 , last FORMAT if $addr =~ /-fic/ ; $format = 0x0000000 , last FORMAT if $addr =~ /-f\.i/ ; $format = 0x1000000 , last FORMAT if $addr =~ /-fi/ ; } # Verbose flag $self->{VERBOSE} = 1 if $addr =~ /-v/i ; # slash after directory elements $self->{SLASH} = 1 if $addr =~ /-slash/i ; $addr =~ s/-[\w\.]*//g ; $addr =~ s/ //g ; my $port ; if ( $addr =~ /(.*):(.*)/ ) { $addr = $1 ; $port = $2 ; } elsif ( $addr =~/\D/ ) { $port = '' ; } else { $port = $addr ; $addr = '' ; } $self->{ADDR} = $addr ; $self->{PORT} = $port ; $self->{SG} = $DEFAULT_SG + $tempscale + $presscale + $format ; $self->{VER} = 0 ; } sub _Sock($) { my $self = shift ; # persistent socket already there? if ( defined($self->{SOCK} && $self->{PERSIST} != 0 ) ) { return 1 ; } # defaults my $addr = $self->{ADDR} ; my $port = $self->{PORT} ; $addr = '127.0.0.1' if $addr eq '' ; $port = 'owserver(4304)' if $port eq '' ; # New socket $self->{SOCK} = IO::Socket::INET->new( PeerAddr=>$addr, PeerPort=>$port, Proto=>'tcp') || do { warn("Can't open $addr:$port ($!) \n") if $self->{VERBOSE} ; $self->{SOCK} = undef ; return ; } ; return 1 ; } sub _self($) { my $addr = shift ; my $self ; if ( ref($addr) ) { $self = $addr ; $self->{PERSIST} = $PERSISTENCE_BIT ; } else { $self = {} ; _new($self,$addr) ; $self->{PERSIST} = 0 ; } if ( ($self->{ADDR} eq '') && ($self->{PORT} eq '') ) { _BonjourLookup($self) || _Sock($self) || return ; } else { _Sock($self) || return ; } return $self; } sub _BonjourLookup($) { my $self = shift ; eval { require Net::Rendezvous; }; if ($@) { print "$@\n" if $self->{VERBOSE} ; return ; } my $owservers = Net::Rendezvous->new('owserver') || do { print "Unable to start owserver discovery via Net::Rendezvous $!\n" if $self->{VERBOSE} ; return ; } ; $owservers->discover ; my $owserver_selected = $owservers->shift_entry || do { print "No owserver discovered by Net::Rendezvous\n" if $self->{VERBOSE} ; return ; } ; print $owserver_selected->host.":".$owserver_selected->port."\n" if $self->{VERBOSE} ; # New socket $self->{SOCK} = IO::Socket::INET->new(PeerAddr=>$owserver_selected->host,PeerPort=>$owserver_selected->port,Proto=>'tcp') || do { warn("Can't open Bonjour (autodiscovered) port ($!) \n") if $self->{VERBOSE} ; $self->{SOCK} = undef ; return ; } ; $self->{ADDR} = $self->{SOCK}->peeraddr ; $self->{PORT} = $self->{SOCK}->peerport ; return 1 ; } sub _ToServer ($$$$;$) { my ($self, $msg_type, $size, $offset, $payload_data) = @_ ; my $f = "N6" ; my $payload_length = length($payload_data) + 1 ; $f .= 'Z'.$payload_length ; my $message = pack($f,$self->{VER},$payload_length,$msg_type,$self->{SG}|$self->{PERSIST},$size,$offset,$payload_data) ; # try to send send( $self->{SOCK}, $message, $SEND_FLAGS ) && return 1 ; # maybe bad persistent connection if ( $self->{PERSIST} != 0 ) { $self->{SOCK} = undef ; _Sock($self) || return ; send( $self->{SOCK}, $message, $SEND_FLAGS ) && return 1 ; } warn("Send problem $! \n") if $self->{VERBOSE} ; return ; } sub _FromServerBinaryParse($$) { my $self = shift ; my $length_wanted = shift ; return '' if $length_wanted == 0 ; my $fileno = $self->{SOCK}->fileno ; my $selectreadbits = '' ; vec($selectreadbits,$fileno,1) = 1 ; my $remaininglength = $length_wanted ; my $fullread = '' ; do { select($selectreadbits,undef,undef,$MAX_WAIT) ; return if vec($selectreadbits,$fileno,1) == 0 ; my $partialread ; defined( recv( $self->{SOCK}, $partialread, $remaininglength, $RECV_FLAGS ) ) || do { warn("Trouble getting data back $! after $remaininglength of $length_wanted") if $self->{VERBOSE} ; return ; } ; $fullread .= $partialread ; $remaininglength = $length_wanted - length($fullread) ; } while $remaininglength > 0 ; return $fullread ; } sub _FromServer($) { my $self = shift ; my ( $version, $payload_length, $return_status, $sg, $size, $offset, $payload_data ) ; do { my $r = _FromServerBinaryParse( $self,24 ) || do { warn("Trouble getting header $!") if $self->{VERBOSE} ; return ; } ; ($version, $payload_length, $return_status, $sg, $size, $offset) = unpack('N6', $r ) ; return if $return_status > $MAX_RETURN ; } while $payload_length > $MAX_RETURN ; $payload_data = _FromServerBinaryParse( $self,$payload_length ) ; if ( !defined($payload_data) ) { warn("Trouble getting payload $!") if $self->{VERBOSE} ; return ; } ; $payload_data = substr($payload_data,0,$size) ; $self->{PERSIST} = $sg & $PERSISTENCE_BIT ; return ($version, $payload_length, $return_status, $sg, $size, $offset, $payload_data ) ; } =item B Object-oriented (only): B( I
) Create a new OWNet object -- corresponds to an B. Error (and undef return value) if: =over =item 1 Badly formed tcp/ip I
=item 2 No B at I
=item =back =cut sub new($$) { my $class = shift ; my $addr = shift || "" ; my $self = {} ; _new($self,$addr) ; if ( !defined($self->{ADDR}) ) { return ; } ; bless $self, $class ; return $self ; } =item B =over =item Non object-oriented: B( I
, I [ , I [ , I ] ] ) =item Object-oriented: $ownet->B( I [ , I [ , I ] ] ) =back Read the value of a 1-wire device property. Returns the (scalar string) value of the property. I (number of bytes to read) is optional I (number of bytes from start of field to start write) is optional Error (and undef return value) if: =over =item 1 (Non object) No B at I
=item 2 (Object form) Not called with a valid OWNet object =item 3 Bad I =item 4 I not a readable device property =item =back =cut sub read($$) { my $self = _self(shift) || return ; my $path = shift ; my $read_length = shift || $DEFAULT_BLOCK_LENGTH ; my $offset = shift || $NO_OFFSET ; _ToServer($self,$MSG_READ,$read_length,$offset,$path) ; my @r = _FromServer($self) ; if ( !@r ) { return ; } return $r[6] ; } =item B =over =item Non object-oriented: B( I
, I , I [ , I ] ) =item Object-oriented: $ownet->B( I , I [ , I ] ) =back Set the value of a 1-wire device property. Returns "1" on success. I (number of bytes from start of field to start write) is optional Error (and undef return value) if: =over =item 1 (Non object) No B at I
=item 2 (Object form) Not called with a valid OWNet object =item 3 Bad I =item 4 I not a writable device property =item 5 I incorrect size or format =item =back =cut sub write($$$;$) { my $self = _self(shift) || return ; my $path = shift ; my $val = shift ; my $offset = shift || $NO_OFFSET ; my $value_length = length($val) ; my $path_length = length($path)+1 ; my $payload = pack( 'Z'.$path_length.'A'.$value_length,$path,$val ) ; _ToServer($self,$MSG_WRITE,$value_length,$offset,$payload) ; my @r = _FromServer($self) ; if ( !@r ) { return; } return $r[2]>=0 ; } =item B =over =item Non object-oriented: B( I
, I ) =item Object-oriented: $ownet->B( I ) =back Return a comma-separated list of the entries in I. Entries are equivalent to "fully qualified names" -- full path names. Error (and undef return value) if: =over =item 1 (Non object) No B at I
=item 2 (Object form) Not called with a valid OWNet object =item 3 Bad I =item 4 I not a directory =item =back =cut sub dir($$) { my $self = _self(shift) || return ; my $path = shift ; # DIRALLSLASH method -- single packet with slash (/) after each dir entry if ( $self->{SLASH}) { _ToServer($self,$MSG_DIRALLSLASH,$DEFAULT_BLOCK_LENGTH,$NO_OFFSET,$path) || return ; my @r = _FromServer($self) ; if (@r) { $self->{SOCK} = undef if $self->{PERSIST} == 0 ; return $r[6] ; } ; } # new MSG_DIRALL method -- single packet _ToServer($self,$MSG_DIRALL,$DEFAULT_BLOCK_LENGTH,$NO_OFFSET,$path) || return ; my @r = _FromServer($self) ; if (@r) { $self->{SOCK} = undef if $self->{PERSIST} == 0 ; return $r[6] ; } ; # old MSG_DIR method -- many packets _Sock($self) || return ; _ToServer($self,$MSG_DIR,$DEFAULT_BLOCK_LENGTH,$NO_OFFSET,$path) || return ; my $dirlist = '' ; while (1) { @r = _FromServer($self) || return ; return if !@r ; if ( $r[1] == 0 ) { # last null packet $self->{SOCK} = undef if $self->{PERSIST} == 0 ; return substr($dirlist,1) ; # not starting comma } $dirlist .= ','.$r[6] ; } } return 1 ; END { } =item B (deprecated) =over =item Non object-oriented: B( I
, I ) =item Object-oriented: $ownet->B( I ) =back Test if a 1-wire device exists. Error (and undef return value) if: =over =item 1 (Non object) No B at I
=item 2 (Object form) Not called with a valid OWNet object =item 3 Bad I =item 4 I not a device =item =back =cut sub present($$) { my $self = _self(shift) || return ; my $path = shift ; _ToServer($self,$MSG_PRESENCE,$DEFAULT_BLOCK_LENGTH,$NO_OFFSET,$path) ; my @r = _FromServer($self) ; return if !@r ; return $r[2]>=0 ; } =back =head1 DESCRIPTION =head2 OWFS I is a suite of programs that allows easy access to I's 1-wire bus and devices. I provides a consistent naming scheme, safe multplexing of 1-wire traffice, multiple methods of access and display, and network access. The basic I metaphor is a file-system, with the bus beinng the root directory, each device a subdirectory, and the the device properties (e.g. voltage, temperature, memory) a file. =head2 1-Wire I<1-wire> is a protocol allowing simple connection of inexpensive devices. Each device has a unique ID number (used in its OWFS address) and is individually addressable. The bus itself is extremely simple -- a data line and a ground. The data line also provides power. 1-wire devices come in a variety of packages -- chips, commercial boxes, and iButtons (stainless steel cans). 1-wire devices have a variety of capabilities, from simple ID to complex voltage, temperature, current measurements, memory, and switch control. =head2 Programs Connection to the 1-wire bus is either done by bit-banging a digital pin on the processor, or by using a bus master -- USB, serial, i2c, parallel. The heavy-weight I programs: B B B B and the heavy-weight perl module B all link in the full I library and can connect directly to the bus master(s) and/or to B. B is a light-weight module. It connects only to an B, does not link in the I library, and should be more portable.. =head2 Object-oriented B can be used in either a classical (non-object-oriented) manner, or with objects. The object stored the ip address of the B and a network socket to communicate. B will use persistent tcp connections for the object form -- potentially a performance boost over a slow network. =head1 EXAMPLES =head2 owserver B is a separate process that must be accessible on the network. It allows multiple clients, and can connect to many physical 1-wire adapters and 1-wire devices. It's address must be discoverable -- either set on the command line, or at it's default location, or by using Bonjour (zeroconf) service discovery. An example owserver invocation for a serial adapter and explicitly chooses the default port: owserver -d /dev/ttyS0 -p 4304 =head2 OWNet use OWNet ; # Create owserver object my $owserver = OWNet->new('localhost:4304 -v -F') ; #default location, verbose errors, Fahrenheit degrees # my $owserver = OWNet->new() ; #simpler, again default location, no error messages, default Celsius #print directory print $owserver->dir('/') ; #print temperature from known device (DS18S20, ID: 10.13224366A280) print "Temperature: ".$owserver->read('/uncached/10.13224366A280/temperature') ; # Now for some fun -- a tree of everything: sub Tree($$) { my $ow = shift ; my $path = shift ; print "$path\t" ; # first try to read my $value = $ow->read($path) ; if ( defined($value) ) { print "$value\n"; return ; } # not readable, try as directory my $dirstring = $ow->dir($path) ; if ( defined($dirstring) ) { print "\n" ; my @dir = split /,/ , $ow->dir($path) ; foreach (@dir) { Tree($ow,$_) ; } return ; } # can't read, not directory print "\n" ; return ; } Tree( $owserver, '/' ) ; =head1 INTERNALS =head2 Object properties (All private) =over =item ADDR literal sting for the IP address, in dotted-quad or host format. This property is also used to indicate a substantiated object. =item PORT string for the port number (or service name). Service name must be specified as :owserver or the like. =item SG Flag sent to server, and returned, that encodes temperature scale and display format. Persistence is also encoded in this word in the actual tcp message, but kept separately in the object. =item VERBOSE Print error messages? Set by "-v" in object invocation. =item SLASH Add "/" to the end of directory entries. Set by "-slash" in object invocation. =item SOCK Socket address (object) for communication. Stays defined for persistent connections, else deleted between calls. =item PERSIST State of socket connection (persistent means the same socket is used which speeds network communication). =item VER owprotocol version number (currently 0) =back =head2 Private methods =over =item _self Takes either the implicit object reference (if called on an object) or the ip address in non-object format. In either case a socket is created, the persistence bit is properly set, and the address parsed. Returns the object reference, or undef on error. Called by each external method (read,write,dir) on the first parameter. =item _new Takes command line invocation parameters (for an object or not) and properly parses and sets up the properties in a hash array. =item _Sock Socket processing, including tests for persistence and opening. If no host is specified, localhost (127.0.0.1) is used. If no port is specified, uses the IANA allocated well known port (4304) for owserver. First looks in /etc/services, then just tries 4304. =item _ToServer Sends a message to owserver. Formats in owserver protocol. If a persistent socket fails, retries after new socket created. =item _FromServerBinaryParse Reads a specified length from server =item _FromServer Reads whole packet from server, using _FromServerBinaryParse (first for header, then payload). Discards ping packets silently. =item _BonjourLookup Uses the mDNS service discovery protocol to find an available owserver. Employs NET::Rendezvous (an earlier name or Apple's Bonjour) This module is loaded only if available. (Uses the method of http://sial.org/blog/2006/12/optional_perl_module_loading.html) =back =head1 AUTHOR Paul H Alfille paul.alfille@gmail.com =head1 BUGS Support for proper timeout using the "select" function seems broken in perl. This might leave the routines vulnerable to network timing errors. =head1 SEE ALSO =over =item http://www.owfs.org Documentation for the full B program suite, including man pages for each of the supported 1-wire devices, and more extensive explanatation of owfs components. =item http://owfs.sourceforge.net/projects/owfs Location where source code is hosted. =back =head1 COPYRIGHT Copyright (c) 2007 Paul H Alfille. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut owfs-2.8p15/module/ownet/perl5/OWNet/t/0000775000175000017500000000000011756315510014605 500000000000000owfs-2.8p15/module/ownet/perl5/OWNet/t/OWNet.t0000664000175000017500000000100211405553426015700 00000000000000# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl OWNet.t' # $Id: OWNet.t,v 1.2 2010/06/15 01:27:50 alfille Exp $ ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; BEGIN { use_ok('OWNet') }; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script. owfs-2.8p15/module/ownet/perl5/OWNet/MANIFEST0000664000175000017500000000021210557035574015415 00000000000000Changes Makefile.PL MANIFEST README t/OWNet.t lib/OWNet.pm META.yml Module meta-data (added by MakeMaker) owfs-2.8p15/module/ownet/perl5/OWNet/Changes0000664000175000017500000000110311405553426015551 00000000000000Revision history for Perl extension OWNet. $Id: Changes,v 1.4 2010/06/15 01:27:50 alfille Exp $ 0.01 Wed Jan 3 21:42:03 2007 - original version; created by h2xs 1.23 with options -X -n OWNet -b 5.8.0 -O 1.5 1/25/2007 - Add persistent tcp support - Add default port (4304) - Add Bonjour support 1.20 6/14/2010 - Add pressure scale options - Add "-slash" to show trailing / on directory entries - Add optional offset to write - Add optional size and offset to read - Fix bug in write than shortened string - Fix typos in documentation owfs-2.8p15/module/ownet/perl5/OWNet/Makefile.PL0000664000175000017500000000122511405553426016235 00000000000000use 5.008; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. # $Id: Makefile.PL,v 1.5 2010/06/15 01:27:50 alfille Exp $ WriteMakefile( NAME => 'OWNet', VERSION_FROM => 'lib/OWNet.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.008 ? ## Add these new keywords supported since 5.008 (ABSTRACT => 'Light-weight connection to owserver to access the Dallas 1-wire system for monitoring and control', POLLUTE => 1, AUTHOR => 'Paul H Alfille ') : ()), ); owfs-2.8p15/module/ownet/perl5/OWNet/README0000664000175000017500000000363211405553426015147 00000000000000OWNet version 1.20 $Id: README,v 1.4 2010/06/15 01:27:50 alfille Exp $ ================== OWNet is a light-weight module for accessing owserver. The overall goal is an easy way to use the 1-Wire bus and devices. Useful for monitoring, security, hobby, control. (Projects include weather monitoring, heating and cooling control, aquarium, tractor, motorcycle, swimming pool and others.) The full explanation can be found at http://www.owfs.org Basically 1-Wire is a simple and inexpensive way to connect chips made by Dallas Semicondictor to a computer. These chips each have a unique ID, and are individually addressable, even with a bus that has only a combined power/data line and ground. The underlying idea of OWFS (One Wire File System) is to make the whole 1-wire bus look like a file system. Devices are directories (named by their unique ID) and their properties (memory, contact, voltage, temperature,...) are files. owserver is one of the OWFS programs that connects and virtuallizes the 1-wire bus. It communicates via a well-documented tcp/ip protocol, see: http://www.owfs.org/index.php?page=owserver-protocol OWNet is a perl module to connect to a owserver process. There are four methods: read, write, dir, present All that's needed is the ip address of the owserver, and the "path" -- unique name or the 1-wire resource wanted. --------------- OWNet is pure perl. It uses the IO::Socket::INET module for tcp/ip communication. It should be usable on any system with perl, and a network stack. --------------- INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: IO::Socket::INET Net::Rendezvous (optional) COPYRIGHT AND LICENCE Copyright (C) 2007 by Paul H Alfille This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. owfs-2.8p15/module/ownet/perl5/examples/0000775000175000017500000000000011756315510015164 500000000000000owfs-2.8p15/module/ownet/perl5/examples/test2.pl0000775000175000017500000000142511027666076016516 00000000000000#!/usr/bin/perl -w # OWFS test program # See owfs.sourceforge.net for details # {copyright} 2007 Paul H. Alfille # GPL license # $Id: test2.pl,v 1.2 2008/06/23 09:26:22 d1mag Exp $ # Start a test-server before running this script: # owserver -p 4304 --fake 10,10 use OWNet ; die ( "OWFS 1-wire OWNet perl program\n" ." by Paul Alfille 2007 see http://www.owfs.org\n" ."Syntax:\n" ."\t$0 \n" ."Example:\n" ."\t$0 127.0.0.1:4304\n" ) if ( $#ARGV != 0 ) ; print "\nCall dir\n" ; print OWNet::dir($ARGV[0] . " -v", "/") ; print "\nCall read\n" ; print OWNet::read($ARGV[0] . " -v", "/10.67C6697351FF/temperature") ; print "\nCall read (Fahrenheit)\n" ; print OWNet::read($ARGV[0] . " -v -F", "/10.67C6697351FF/temperature") ; print "\n" ; owfs-2.8p15/module/ownet/perl5/examples/test.pl0000775000175000017500000000144711027666076016440 00000000000000#!/usr/bin/perl -w # OWFS test program # See owfs.sourceforge.net for details # {copyright} 2007 Paul H. Alfille # GPL license # $Id: test.pl,v 1.9 2008/06/23 09:26:22 d1mag Exp $ # Start a test-server before running this script: # owserver -p 4304 --fake 10,10 use OWNet ; die ( "OWFS 1-wire OWNet perl program\n" ." by Paul Alfille 2007 see http://www.owfs.org\n" ."Syntax:\n" ."\t$0 \n" ."Example:\n" ."\t$0 127.0.0.1:4304\n" ) if ( $#ARGV != 0 ) ; my $ow ; $ow = OWNet->new($ARGV[0]) ; print "\nTry dir\n" ; print $ow->dir("/") ; die ("Cannot open OWNet connection") if (!defined($ow->{SOCK})) ; print "\nTry present\n" ; print $ow->present("/10.67C6697351FF") ; print "\nTry read\n" ; print $ow->read("/10.67C6697351FF/temperature") ; print "\n" ; owfs-2.8p15/module/ownet/perl5/Makefile.in0000664000175000017500000003460111756250030015332 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/perl5 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = OWNet/README OWNet/MANIFEST OWNet/Changes OWNet/Makefile.PL OWNet/lib/OWNet.pm OWNet/t/OWNet.t examples/test.pl examples/test2.pl 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 module/ownet/perl5/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/perl5/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): 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-data-local 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-data-local 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 all: OWNet/Makefile cd OWNet; $(MAKE) all # Can't really install the perl-modules under prefix-directory.. it should be site-global. OWNet/Makefile: OWNet/Makefile.PL @HAVE_DEBIAN_TRUE@ cd OWNet; $(PERL) Makefile.PL INSTALLDIRS=vendor @HAVE_DEBIAN_FALSE@ cd OWNet; $(PERL) Makefile.PL install-data-local: OWNet/Makefile @HAVE_DEBIAN_TRUE@ (cd OWNet && $(MAKE) install_vendor DESTDIR="$(DESTDIR)") @HAVE_DEBIAN_FALSE@ (cd OWNet && $(MAKE) install DESTDIR="$(DESTDIR)") # $(MAKE) -C OWNet install DESTDIR="$(DESTDIR)" # ( cd OWNet; $(MAKE) ; $(MAKE) test; $(MAKE) install ) clean-generic: @RM@ -f *~ .*~ if test -f OWNet/Makefile; then cd OWNet; $(MAKE) clean; fi @RM@ -f OWNet/Makefile.old OWNet/Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: owfs-2.8p15/module/ownet/perl5/Makefile.am0000664000175000017500000000160011306075356015321 00000000000000## $Id: Makefile.am,v 1.14 2009/12/04 02:58:54 alfille Exp $ EXTRA_DIST = OWNet/README OWNet/MANIFEST OWNet/Changes OWNet/Makefile.PL OWNet/lib/OWNet.pm OWNet/t/OWNet.t examples/test.pl examples/test2.pl all: OWNet/Makefile cd OWNet; $(MAKE) all # Can't really install the perl-modules under prefix-directory.. it should be site-global. OWNet/Makefile: OWNet/Makefile.PL if HAVE_DEBIAN cd OWNet; $(PERL) Makefile.PL INSTALLDIRS=vendor else cd OWNet; $(PERL) Makefile.PL endif install-data-local: OWNet/Makefile if HAVE_DEBIAN (cd OWNet && $(MAKE) install_vendor DESTDIR="$(DESTDIR)") else (cd OWNet && $(MAKE) install DESTDIR="$(DESTDIR)") endif # $(MAKE) -C OWNet install DESTDIR="$(DESTDIR)" # ( cd OWNet; $(MAKE) ; $(MAKE) test; $(MAKE) install ) clean-generic: @RM@ -f *~ .*~ if test -f OWNet/Makefile; then cd OWNet; $(MAKE) clean; fi @RM@ -f OWNet/Makefile.old OWNet/Makefile owfs-2.8p15/module/ownet/Makefile.am0000664000175000017500000000071211023750072014264 00000000000000## $Id: Makefile.am,v 1.9 2008/06/11 13:16:42 d1mag Exp $ if ENABLE_OWPHP if ENABLE_PHP OWNET_SUBDIRPHP = php endif endif if ENABLE_OWPYTHON if ENABLE_PYTHON OWNET_SUBDIRPYTHON = python endif endif if ENABLE_OWPERL if ENABLE_PERL OWNET_SUBDIRPERL = perl5 endif endif if ENABLE_OWNETLIB OWNET_SUBDIROWNETLIB = c endif SUBDIRS = $(OWNET_SUBDIROWNETLIB) $(OWNET_SUBDIRPHP) $(OWNET_SUBDIRPYTHON) $(OWNET_SUBDIRPERL) clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/c/0000775000175000017500000000000011756315510012541 500000000000000owfs-2.8p15/module/ownet/c/src/0000775000175000017500000000000011756315510013330 500000000000000owfs-2.8p15/module/ownet/c/src/Makefile.in0000664000175000017500000005144611756250030015322 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/c/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include # don't want to add the example as a subdirectory right now... EXTRA_DIST = example/ownetexample.c example/Makefile.example example/Makefile example/Makefile.in all: all-recursive .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 module/ownet/c/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/c/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/c/src/example/0000775000175000017500000000000011756315510014763 500000000000000owfs-2.8p15/module/ownet/c/src/example/Makefile0000664000175000017500000000174011756250044016345 00000000000000# Makefile for ownet example program -- invoked separately from this directory # $Id: Makefile.in,v 1.3 2009/03/24 17:20:09 alfille Exp $ CFLAGS = -g -I/opt/owfs/include EXAMPLEA = ownetexample EXAMPLEA_OBJS = ownetexample.o EXAMPLEB = ownet_tree EXAMPLEB_OBJS = ownet_tree.o all: $(EXAMPLEA) $(EXAMPLEB) ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L/opt/owfs/lib -lownet -low -L/usr/lib/x86_64-linux-gnu -lusb $(EXAMPLEA): $(EXAMPLEA_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEA_OBJS) $(DARWINLDFLAGS) $(EXAMPLEB): $(EXAMPLEB_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEB_OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lownet $(EXAMPLEA): $(EXAMPLEA_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEA_OBJS) $(LDFLAGS) $(EXAMPLEB): $(EXAMPLEB_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEB_OBJS) $(LDFLAGS) endif %.o: %.c gcc $(CFLAGS) -c -o $@ $< clean: $(RM) -f $(EXAMPLEA) $(EXAMPLEB) *.o *~ .~ Makefile owfs-2.8p15/module/ownet/c/src/example/Makefile.example0000664000175000017500000000043010741364106017770 00000000000000 LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lownet CFLAGS = -g -I/opt/owfs/include OBJS = ownetexample.o all: ownetexample ownetexample: $(OBJS) gcc $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) %.o: %.c gcc $(CFLAGS) -c -o $@ $< clean: $(RM) -f ownetexample *.o *~ .~ owfs-2.8p15/module/ownet/c/src/example/ownetexample.c0000664000175000017500000000734711403012330017551 00000000000000/* $Id: ownetexample.c,v 1.8 2010/06/06 21:36:24 alfille Exp $ */ #include #include #include #include #include #include //------------- Globals vaiables ---------- char *owserver_address = "4304"; char *one_wire_path = "/"; //------------- Usage information -------- void usage(int argc, char **argv) { printf("%s shows examples of directory and read functions\n", argv[0]); printf("\n"); printf("Usage of %s:\n", argv[0]); printf("\t%s -s owserver_address\n", argv[0]); printf("\t\towserver_address -- tcp/ip address:port of owserver\n"); printf("\t\t\te.g. 192.168.0.77:3000 or just port number\n"); printf("\t\t\tdefault localhost:4304\n"); printf("\n"); printf("see http://www.owfs.org for information on owserver.\n"); exit(1); } //------------- Command line parsing ----- void parse_command_line(int argc, char **argv) { int argc_index; int next_is_owserver = 1; if (argc < 1) { usage(argc, argv); } for (argc_index = 1; argc_index < argc; ++argc_index) { if (strcmp(argv[argc_index], "-h") == 0) { usage(argc, argv); } else if (strcmp(argv[argc_index], "--help") == 0) { usage(argc, argv); } else if (strcmp(argv[argc_index], "-s") == 0) { next_is_owserver = 1; } else if (strcmp(argv[argc_index], "--server") == 0) { next_is_owserver = 1; } else { if (next_is_owserver) { owserver_address = argv[argc_index]; next_is_owserver = 0; } else { fprintf(stderr,"Extra argument <%s> in command line\n",argv[argc_index]); exit(1) ; } } } } //------------- Example-specific --------- struct pass_on { OWNET_HANDLE h; int depth; }; // directory_element callback function void Show_property(void *v, const char *filename) { // cast the void pointer to a known structure pointer struct pass_on *this_pass = v; // set up a structure to pass to future call-back struct pass_on next_pass = { this_pass->h, this_pass->depth + 1, }; char * read_data = NULL ; int read_length = OWNET_read(this_pass->h, filename, &read_data); // space in to level (for example) int indent_index; for (indent_index = 0; indent_index < this_pass->depth; ++indent_index) { printf(" "); } // print this filename printf("%s", filename); if ( read_length >= 0 ) { int i ; for ( i = 0 ; i < read_length ; ++i ) { if ( ! isprint(read_data[i]) ) { read_data[i] = '.' ; } } printf("\t<%s>",read_data); } if ( read_data != NULL ) { free( read_data ) ; } printf("\n") ; // recursive call on children OWNET_dirprocess(this_pass->h, filename, Show_property, &next_pass); } // directory_element callback function void Show_device(void *v, const char *filename) { // cast the void pointer to a known structure pointer struct pass_on *this_pass = v; // set up a structure to pass to future call-back struct pass_on next_pass = { this_pass->h, this_pass->depth + 1, }; // space in to level (for example) int indent_index; for (indent_index = 0; indent_index < this_pass->depth; ++indent_index) { printf(" "); } // print this filename printf("%s\n", filename); // Only continue for real devices if ( !isxdigit(filename[1]) || !isxdigit(filename[2]) ) { return ; } // recursive call on children OWNET_dirprocess(this_pass->h, filename, Show_property, &next_pass); } int main(int argc, char **argv) { ssize_t ret = 0; OWNET_HANDLE owh; struct pass_on first_pass; parse_command_line(argc, argv); if ((owh = OWNET_init(owserver_address)) < 0) { printf("OWNET_init(%s) failed.\n", owserver_address); exit(1); } first_pass.h = owh; first_pass.depth = 0; ret = OWNET_dirprocess(owh, one_wire_path, Show_device, &first_pass); if (ret < 0) { printf("OWNET_dirprocess error: %ld)\n", ret); } OWNET_close(owh); return 0; } owfs-2.8p15/module/ownet/c/src/example/Makefile.in0000664000175000017500000000171111162213111016731 00000000000000# Makefile for ownet example program -- invoked separately from this directory # $Id: Makefile.in,v 1.3 2009/03/24 17:20:09 alfille Exp $ CFLAGS = -g -I@prefix@/include EXAMPLEA = ownetexample EXAMPLEA_OBJS = ownetexample.o EXAMPLEB = ownet_tree EXAMPLEB_OBJS = ownet_tree.o all: $(EXAMPLEA) $(EXAMPLEB) ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L@prefix@/lib -lownet -low @LIBUSB_LIBS@ $(EXAMPLEA): $(EXAMPLEA_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEA_OBJS) $(DARWINLDFLAGS) $(EXAMPLEB): $(EXAMPLEB_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEB_OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L@prefix@/lib -Wl,--rpath -Wl,@prefix@/lib -lownet $(EXAMPLEA): $(EXAMPLEA_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEA_OBJS) $(LDFLAGS) $(EXAMPLEB): $(EXAMPLEB_OBJS) gcc $(CFLAGS) -o $@ $(EXAMPLEB_OBJS) $(LDFLAGS) endif %.o: %.c @CC@ $(CFLAGS) -c -o $@ $< clean: $(RM) -f $(EXAMPLEA) $(EXAMPLEB) *.o *~ .~ Makefile owfs-2.8p15/module/ownet/c/src/Makefile.am0000664000175000017500000000033010741364106015276 00000000000000SUBDIRS = c include # don't want to add the example as a subdirectory right now... EXTRA_DIST = example/ownetexample.c example/Makefile.example example/Makefile example/Makefile.in clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/c/src/include/0000775000175000017500000000000011756315510014753 500000000000000owfs-2.8p15/module/ownet/c/src/include/rwlock.h0000664000175000017500000000174311130373466016352 00000000000000/* From Paul Alfille */ /* $Id: rwlock.h,v 1.5 2009/01/05 12:04:06 d1mag Exp $ */ /* Implementation of Reader/Writer locks using semaphores and mutexes */ /* based on "The Little Book of Semaphores" bu Allen B. Downey */ /* http://www.greenteapress.com */ /* Note, these are relatively light-weight rwlocks, only solve writer starvation and no timeout or queued wakeup */ #ifndef RWLOCK_H #define RWLOCK_H #include "owfs_config.h" #if OW_MT #include #include "sem.h" typedef struct { pthread_mutex_t protect_reader_count; int reader_count; sem_t allow_readers; sem_t no_processes; } my_rwlock_t; void my_rwlock_init(my_rwlock_t * rwlock); inline void my_rwlock_write_lock(my_rwlock_t * rwlock); inline void my_rwlock_write_unlock(my_rwlock_t * rwlock); inline void my_rwlock_read_lock(my_rwlock_t * rwlock); inline void my_rwlock_read_unlock(my_rwlock_t * rwlock); void my_rwlock_destroy(my_rwlock_t * rwlock); #endif /* OW_MT */ #endif /* RWLOCK */ owfs-2.8p15/module/ownet/c/src/include/ow_charblob.h0000664000175000017500000000622411331474552017332 00000000000000/* $Id: ow_charblob.h,v 1.3 2010/02/01 06:49:14 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #ifndef OW_CHARBLOB_H /* tedious wrapper */ #define OW_CHARBLOB_H struct charblob { int troubled; size_t allocated; size_t used; ASCII *blob; }; void CharblobClear(struct charblob *cb); void CharblobInit(struct charblob *cb); int CharblobPure(struct charblob *cb); int CharblobAdd(const ASCII * a, size_t s, struct charblob *cb); int CharblobAddChar(ASCII a, struct charblob *cb); size_t CharblobLength( struct charblob * cb ) ; ASCII * CharblobData(struct charblob * cb) ; #endif /* OW_CHARBLOB_H */ owfs-2.8p15/module/ownet/c/src/include/sem.h0000664000175000017500000000341111377034702015627 00000000000000/* From Geo Carncross geocar@internetconnection.net -- GPL */ /* File for incomplete semaphore implementations */ /* $Id: sem.h,v 1.5 2010/05/25 20:57:38 alfille Exp $ */ /* Note: gcc wants inline before int */ #ifndef __semaphore_h #define __semaphore_h #ifdef HAVE_SEMAPHORE_H #include #else /* HAVE_SEMAPHORE_H */ #include #include #include typedef struct { pthread_mutex_t m; pthread_cond_t c; volatile unsigned int v, w; } sem_t; //static int inline sem_destroy(sem_t *s) { static inline int sem_destroy(sem_t * s) { pthread_mutex_lock(&s->m); if (s->w) { pthread_mutex_unlock(&s->m); errno = EBUSY; return -1; } pthread_cond_destroy(&s->c); pthread_mutex_unlock(&s->m); pthread_mutex_destroy(&s->m); return 0; } //static int inline sem_init(sem_t *s, int ign, int val) { static inline int sem_init(sem_t * s, int ign, int val) { if (ign != 0) { errno = ENOSYS; return -1; } if (pthread_mutex_init(&s->m, NULL) != 0) return -1; if (pthread_cond_init(&s->c, NULL) != 0) return -1; s->v = val; s->w = 0; return 0; } //static int inline sem_post(sem_t *s) { static inline int sem_post(sem_t * s) { int ok; if (pthread_mutex_lock(&s->m) == -1) return -1; s->v++; if (s->w == 1) ok = pthread_cond_signal(&s->c); else if (s->w > 1) ok = pthread_cond_broadcast(&s->c); pthread_mutex_unlock(&s->m); return ok; } //static int inline sem_wait(sem_t *s) { static inline int sem_wait(sem_t * s) { int ok = 0; if (pthread_mutex_lock(&s->m) == -1) return -1; while (s->v == 0) { s->w++; if (pthread_cond_wait(&s->c, &s->m) == -1) { ok = -1; break; } s->w--; } s->v--; pthread_mutex_unlock(&s->m); return ok; } #endif /* HAVE_SEMAPHORE_H */ #endif /* __semaphore_h */ owfs-2.8p15/module/ownet/c/src/include/ownetapi.h0000664000175000017500000001163011131152075016663 00000000000000/* $Id: ownetapi.h,v 1.9 2009/01/07 16:11:41 d1mag Exp $ OWFS (owfs, owhttpd, owserver, owperl, owtcl, owphp, owpython, owcapi) one-wire file system and related programs By Paul H Alfille {c} 2008 GPL palfille@earthlink.net */ /* This is the libownet header a C programmikng interface to easily access owserver and thus the entire Dallas/Maxim 1-wire system. This header has all the public routines for a program linking in the library */ /* OWNETAPI - specific header */ /* OWNETAPI is the simple C library for OWFS */ #ifndef OWNETAPI_H #define OWNETAPI_H #ifdef __cplusplus extern "C" { #endif #include #define MAX_READ_BUFFER_SIZE 10000 /* OWNET_HANDLE A (non-negative) integer corresponding to a particular owserver connection. It is used for each function call, and allows multiple owservers to be accessed */ typedef int OWNET_HANDLE; /* OWNET_HANDLE OWNET_init( const char * owserver ) Starting routine -- takes a string corresponding to the tcp address of owserver e.g. "192.168.0.1:5000" or "5001" or even "" for the default localhost:4304 returns a non-negative HANDLE, or <0 for error */ OWNET_HANDLE OWNET_init(const char *owserver_tcp_address_and_port); /* int OWNET_dirlist( OWNET_HANDLE h, const char * onewire_path, char ** return_string ) Get the 1-wire directory as a comma-separated list. return_string is allocated by this program, and must be free-ed by your program. return non-negative length of return_string on success return <0 error and NULL on error */ int OWNET_dirlist(OWNET_HANDLE h, const char *onewire_path, char **return_string); /* int OWNET_dirprocess( OWNET_HANDLE h, const char * onewire_path, void (*dirfunc) (void * passed_on_value, const char* directory_element), void * passed_on_value ) Get the 1-wire directory corresponding to the given path Call function dirfunc on each element passed_on_value is an arbitrary pointer that gets included in the dirfunc call to add some state information returns number of elements processed, or <0 for error */ int OWNET_dirprocess(OWNET_HANDLE h, const char *onewire_path, void (*dirfunc) (void *passed_on_value, const char *directory_element), void *passed_on_value); /* int OWNET_present( OWNET_HANDLE h, const char * onewire_path) Check if a one-wire device is present returns = 0 on success, returns <0 on error */ int OWNET_present(OWNET_HANDLE h, const char *onewire_path); /* int OWNET_read( OWNET_HANDLE h, const char * onewire_path, unsigned char ** return_string ) Read a value from a one-wire device property return_string has the result but must be free-ed by the calling program. returns length of result on success, returns <0 on error */ int OWNET_read(OWNET_HANDLE h, const char *onewire_path, char **return_string); /* int OWNET_lread( OWNET_HANDLE h, const char * onewire_path, unsigned char * return_string, size_t size, off_t offset ) Read a value from a one-wire device property Buffer should be pre-allocated, and size and offset specified. return_string has the result. returns length of result on success, returns <0 on error */ int OWNET_lread(OWNET_HANDLE h, const char *onewire_path, char *return_string, size_t size, off_t offset); /* int OWNET_put( OWNET_HANDLE h, const char * onewire_path, const unsigned char * value_string, size_t size) Write a value to a one-wire device property, of specified size and offset return 0 on success return <0 on error */ int OWNET_put(OWNET_HANDLE h, const char *onewire_path, const char *value_string, size_t size); /* int OWNET_lwrite( OWNET_HANDLE h, const char * onewire_path, const unsigned char * value_string, size_t size, off_t offset ) Write a value to a one-wire device property, of specified size and offset return 0 on success return <0 on error */ int OWNET_lwrite(OWNET_HANDLE h, const char *onewire_path, const char *value_string, size_t size, off_t offset); /* void OWNET_close( OWNET_HANDLE h) close a particular owserver connection */ void OWNET_close(OWNET_HANDLE h); /* void OWNET_closeall( void ) close all owserver connections */ void OWNET_closeall(void); /* void OWNET_finish( void ) close all owserver connections and free all memory */ void OWNET_finish(void); /* get and set temperature scale Note that temperature scale applies to all HANDLES C - celsius F - farenheit R - rankine K - kelvin 0 -> set default (C) */ void OWNET_set_temperature_scale(char temperature_scale); char OWNET_get_temperature_scale(void); /* get and set device format Note that device format applies to all HANDLES f.i default f.i.c fi.c fi f.ic fic NULL or "" -> set default */ void OWNET_set_device_format(const char *device_format); const char *OWNET_get_device_format(void); #ifdef __cplusplus } #endif #endif /* OWNETAPI_H */ owfs-2.8p15/module/ownet/c/src/include/ow_dnssd.h0000664000175000017500000022766310750074146016704 00000000000000/* * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef OW_DNSSD_H #define OW_DNSSD_H #define ORIGINAL_DNSSD_INCLUDE 0 #ifdef __cplusplus extern "C" { #endif /* */ int OW_Load_dnssd_library(void); int OW_Free_dnssd_library(void); /* standard calling convention under Win32 is __stdcall */ /* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */ /* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */ #if defined(_WIN32) && !defined(EFI32) && !defined(EFI64) #define DNSSD_API __stdcall #else /* */ #define DNSSD_API #endif /* */ /* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */ #if defined(__FreeBSD_version) && (__FreeBSD_version < 500000) #include /* Likewise, on Sun, standard integer types are in sys/types.h */ #elif defined(__sun__) #include /* EFI does not have stdint.h, or anything else equivalent */ #elif defined(EFI32) || defined(EFI64) typedef UINT8 uint8_t; typedef INT8 int8_t; typedef UINT16 uint16_t; typedef INT16 int16_t; typedef UINT32 uint32_t; typedef INT32 int32_t; /* Windows has its own differences */ #elif defined(_WIN32) #include #define _UNUSED #define bzero(a, b) memset(a, 0, b) #ifndef _MSL_STDINT_H typedef UINT8 uint8_t; typedef INT8 int8_t; typedef UINT16 uint16_t; typedef INT16 int16_t; typedef UINT32 uint32_t; typedef INT32 int32_t; #endif /* */ /* All other Posix platforms use stdint.h */ #else /* */ #include #endif /* */ /* DNSServiceRef, DNSRecordRef * * Opaque internal data types. * Note: client is responsible for serializing access to these structures if * they are shared between concurrent threads. */ typedef struct _DNSServiceRef_t *DNSServiceRef; typedef struct _DNSRecordRef_t *DNSRecordRef; /* General flags used in functions defined below */ enum { kDNSServiceFlagsMoreComing = 0x1, /* MoreComing indicates to a callback that at least one more result is * queued and will be delivered following immediately after this one. * Applications should not update their UI to display browse * results when the MoreComing flag is set, because this would * result in a great deal of ugly flickering on the screen. * Applications should instead wait until until MoreComing is not set, * and then update their UI. * When MoreComing is not set, that doesn't mean there will be no more * answers EVER, just that there are no more answers immediately * available right now at this instant. If more answers become available * in the future they will be delivered as usual. */ kDNSServiceFlagsAdd = 0x2, kDNSServiceFlagsDefault = 0x4, /* Flags for domain enumeration and browse/query reply callbacks. * "Default" applies only to enumeration and is only valid in * conjuction with "Add". An enumeration callback with the "Add" * flag NOT set indicates a "Remove", i.e. the domain is no longer * valid. */ kDNSServiceFlagsNoAutoRename = 0x8, /* Flag for specifying renaming behavior on name conflict when registering * non-shared records. By default, name conflicts are automatically handled * by renaming the service. NoAutoRename overrides this behavior - with this * flag set, name conflicts will result in a callback. The NoAutorename flag * is only valid if a name is explicitly specified when registering a service * (i.e. the default name is not used.) */ kDNSServiceFlagsShared = 0x10, kDNSServiceFlagsUnique = 0x20, /* Flag for registering individual records on a connected * DNSServiceRef. Shared indicates that there may be multiple records * with this name on the network (e.g. PTR records). Unique indicates that the * record's name is to be unique on the network (e.g. SRV records). */ kDNSServiceFlagsBrowseDomains = 0x40, kDNSServiceFlagsRegistrationDomains = 0x80, /* Flags for specifying domain enumeration type in DNSServiceEnumerateDomains. * BrowseDomains enumerates domains recommended for browsing, RegistrationDomains * enumerates domains recommended for registration. */ kDNSServiceFlagsLongLivedQuery = 0x100, /* Flag for creating a long-lived unicast query for the DNSServiceQueryRecord call. */ kDNSServiceFlagsAllowRemoteQuery = 0x200, /* Flag for creating a record for which we will answer remote queries * (queries from hosts more than one hop away; hosts not directly connected to the local link). */ kDNSServiceFlagsForceMulticast = 0x400 /* Flag for signifying that a query or registration should be performed exclusively via multicast DNS, * even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS. */ }; /* * The values for DNS Classes and Types are listed in RFC 1035, and are available * on every OS in its DNS header file. Unfortunately every OS does not have the * same header file containing DNS Class and Type constants, and the names of * the constants are not consistent. For example, BIND 8 uses "T_A", * BIND 9 uses "ns_t_a", Windows uses "DNS_TYPE_A", etc. * For this reason, these constants are also listed here, so that code using * the DNS-SD programming APIs can use these constants, so that the same code * can compile on all our supported platforms. */ enum { kDNSServiceClass_IN = 1 /* Internet */ }; enum { kDNSServiceType_A = 1, /* Host address. */ kDNSServiceType_NS = 2, /* Authoritative server. */ kDNSServiceType_MD = 3, /* Mail destination. */ kDNSServiceType_MF = 4, /* Mail forwarder. */ kDNSServiceType_CNAME = 5, /* Canonical name. */ kDNSServiceType_SOA = 6, /* Start of authority zone. */ kDNSServiceType_MB = 7, /* Mailbox domain name. */ kDNSServiceType_MG = 8, /* Mail group member. */ kDNSServiceType_MR = 9, /* Mail rename name. */ kDNSServiceType_NULL = 10, /* Null resource record. */ kDNSServiceType_WKS = 11, /* Well known service. */ kDNSServiceType_PTR = 12, /* Domain name pointer. */ kDNSServiceType_HINFO = 13, /* Host information. */ kDNSServiceType_MINFO = 14, /* Mailbox information. */ kDNSServiceType_MX = 15, /* Mail routing information. */ kDNSServiceType_TXT = 16, /* One or more text strings. */ kDNSServiceType_RP = 17, /* Responsible person. */ kDNSServiceType_AFSDB = 18, /* AFS cell database. */ kDNSServiceType_X25 = 19, /* X_25 calling address. */ kDNSServiceType_ISDN = 20, /* ISDN calling address. */ kDNSServiceType_RT = 21, /* Router. */ kDNSServiceType_NSAP = 22, /* NSAP address. */ kDNSServiceType_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */ kDNSServiceType_SIG = 24, /* Security signature. */ kDNSServiceType_KEY = 25, /* Security key. */ kDNSServiceType_PX = 26, /* X.400 mail mapping. */ kDNSServiceType_GPOS = 27, /* Geographical position (withdrawn). */ kDNSServiceType_AAAA = 28, /* Ip6 Address. */ kDNSServiceType_LOC = 29, /* Location Information. */ kDNSServiceType_NXT = 30, /* Next domain (security). */ kDNSServiceType_EID = 31, /* Endpoint identifier. */ kDNSServiceType_NIMLOC = 32, /* Nimrod Locator. */ kDNSServiceType_SRV = 33, /* Server Selection. */ kDNSServiceType_ATMA = 34, /* ATM Address */ kDNSServiceType_NAPTR = 35, /* Naming Authority PoinTeR */ kDNSServiceType_KX = 36, /* Key Exchange */ kDNSServiceType_CERT = 37, /* Certification record */ kDNSServiceType_A6 = 38, /* IPv6 address (deprecates AAAA) */ kDNSServiceType_DNAME = 39, /* Non-terminal DNAME (for IPv6) */ kDNSServiceType_SINK = 40, /* Kitchen sink (experimentatl) */ kDNSServiceType_OPT = 41, /* EDNS0 option (meta-RR) */ kDNSServiceType_TKEY = 249, /* Transaction key */ kDNSServiceType_TSIG = 250, /* Transaction signature. */ kDNSServiceType_IXFR = 251, /* Incremental zone transfer. */ kDNSServiceType_AXFR = 252, /* Transfer zone of authority. */ kDNSServiceType_MAILB = 253, /* Transfer mailbox records. */ kDNSServiceType_MAILA = 254, /* Transfer mail agent records. */ kDNSServiceType_ANY = 255 /* Wildcard match. */ }; /* possible error code values */ enum { kDNSServiceErr_NoError = 0, kDNSServiceErr_Unknown = -65537, /* 0xFFFE FFFF */ kDNSServiceErr_NoSuchName = -65538, kDNSServiceErr_NoMemory = -65539, kDNSServiceErr_BadParam = -65540, kDNSServiceErr_BadReference = -65541, kDNSServiceErr_BadState = -65542, kDNSServiceErr_BadFlags = -65543, kDNSServiceErr_Unsupported = -65544, kDNSServiceErr_NotInitialized = -65545, kDNSServiceErr_AlreadyRegistered = -65547, kDNSServiceErr_NameConflict = -65548, kDNSServiceErr_Invalid = -65549, kDNSServiceErr_Firewall = -65550, kDNSServiceErr_Incompatible = -65551, /* client library incompatible with daemon */ kDNSServiceErr_BadInterfaceIndex = -65552, kDNSServiceErr_Refused = -65553, kDNSServiceErr_NoSuchRecord = -65554, kDNSServiceErr_NoAuth = -65555, kDNSServiceErr_NoSuchKey = -65556, kDNSServiceErr_NATTraversal = -65557, kDNSServiceErr_DoubleNAT = -65558, kDNSServiceErr_BadTime = -65559 /* mDNS Error codes are in the range * FFFE FF00 (-65792) to FFFE FFFF (-65537) */ }; /* Maximum length, in bytes, of a service name represented as a */ /* literal C-String, including the terminating NULL at the end. */ #define kDNSServiceMaxServiceName 64 /* Maximum length, in bytes, of a domain name represented as an *escaped* C-String */ /* including the final trailing dot, and the C-String terminating NULL at the end. */ #define kDNSServiceMaxDomainName 1005 /* * Notes on DNS Name Escaping * -- or -- * "Why is kDNSServiceMaxDomainName 1005, when the maximum legal domain name is 255 bytes?" * * All strings used in DNS-SD are UTF-8 strings. * With few exceptions, most are also escaped using standard DNS escaping rules: * * '\\' represents a single literal '\' in the name * '\.' represents a single literal '.' in the name * '\ddd', where ddd is a three-digit decimal value from 000 to 255, * represents a single literal byte with that value. * A bare unescaped '.' is a label separator, marking a boundary between domain and subdomain. * * The exceptions, that do not use escaping, are the routines where the full * DNS name of a resource is broken, for convenience, into servicename/regtype/domain. * In these routines, the "servicename" is NOT escaped. It does not need to be, since * it is, by definition, just a single literal string. Any characters in that string * represent exactly what they are. The "regtype" portion is, technically speaking, * escaped, but since legal regtypes are only allowed to contain letters, digits, * and hyphens, there is nothing to escape, so the issue is moot. The "domain" * portion is also escaped, though most domains in use on the public Internet * today, like regtypes, don't contain any characters that need to be escaped. * As DNS-SD becomes more popular, rich-text domains for service discovery will * become common, so software should be written to cope with domains with escaping. * * The servicename may be up to 63 bytes of UTF-8 text (not counting the C-String * terminating NULL at the end). The regtype is of the form _service._tcp or * _service._udp, where the "service" part is 1-14 characters, which may be * letters, digits, or hyphens. The domain part of the three-part name may be * any legal domain, providing that the resulting servicename+regtype+domain * name does not exceed 255 bytes. * * For most software, these issues are transparent. When browsing, the discovered * servicenames should simply be displayed as-is. When resolving, the discovered * servicename/regtype/domain are simply passed unchanged to DNSServiceResolve(). * When a DNSServiceResolve() succeeds, the returned fullname is already in * the correct format to pass to standard system DNS APIs such as res_query(). * For converting from servicename/regtype/domain to a single properly-escaped * full DNS name, the helper function DNSServiceConstructFullName() is provided. * * The following (highly contrived) example illustrates the escaping process. * Suppose you have an service called "Dr. Smith\Dr. Johnson", of type "_ftp._tcp" * in subdomain "4th. Floor" of subdomain "Building 2" of domain "apple.com." * The full (escaped) DNS name of this service's SRV record would be: * Dr\.\032Smith\\Dr\.\032Johnson._ftp._tcp.4th\.\032Floor.Building\0322.apple.com. */ /* * Constants for specifying an interface index * * Specific interface indexes are identified via a 32-bit unsigned integer returned * by the if_nametoindex() family of calls. * * If the client passes 0 for interface index, that means "do the right thing", * which (at present) means, "if the name is in an mDNS local multicast domain * (e.g. 'local.', '254.169.in-addr.arpa.', '0.8.E.F.ip6.arpa.') then multicast * on all applicable interfaces, otherwise send via unicast to the appropriate * DNS server." Normally, most clients will use 0 for interface index to * automatically get the default sensible behaviour. * * If the client passes a positive interface index, then for multicast names that * indicates to do the operation only on that one interface. For unicast names the * interface index is ignored unless kDNSServiceFlagsForceMulticast is also set. * * If the client passes kDNSServiceInterfaceIndexLocalOnly when registering * a service, then that service will be found *only* by other local clients * on the same machine that are browsing using kDNSServiceInterfaceIndexLocalOnly * or kDNSServiceInterfaceIndexAny. * If a client has a 'private' service, accessible only to other processes * running on the same machine, this allows the client to advertise that service * in a way such that it does not inadvertently appear in service lists on * all the other machines on the network. * * If the client passes kDNSServiceInterfaceIndexLocalOnly when browsing * then it will find *all* records registered on that same local machine. * Clients explicitly wishing to discover *only* LocalOnly services can * accomplish this by inspecting the interfaceIndex of each service reported * to their DNSServiceBrowseReply() callback function, and discarding those * where the interface index is not kDNSServiceInterfaceIndexLocalOnly. */ #define kDNSServiceInterfaceIndexAny 0 #define kDNSServiceInterfaceIndexLocalOnly ( (uint32_t) -1 ) typedef uint32_t DNSServiceFlags; typedef int32_t DNSServiceErrorType; /********************************************************************************************* * * Unix Domain Socket access, DNSServiceRef deallocation, and data processing functions * *********************************************************************************************/ /* DNSServiceRefSockFD() * * Access underlying Unix domain socket for an initialized DNSServiceRef. * The DNS Service Discovery implmementation uses this socket to communicate between * the client and the mDNSResponder daemon. The application MUST NOT directly read from * or write to this socket. Access to the socket is provided so that it can be used as a * run loop source, or in a select() loop: when data is available for reading on the socket, * DNSServiceProcessResult() should be called, which will extract the daemon's reply from * the socket, and pass it to the appropriate application callback. By using a run loop or * select(), results from the daemon can be processed asynchronously. Without using these * constructs, DNSServiceProcessResult() will block until the response from the daemon arrives. * The client is responsible for ensuring that the data on the socket is processed in a timely * fashion - the daemon may terminate its connection with a client that does not clear its * socket buffer. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls. * * return value: The DNSServiceRef's underlying socket descriptor, or -1 on * error. */ #if ORIGINAL_DNSSD_INCLUDE int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef); #else /* */ typedef int DNSSD_API(*_DNSServiceRefSockFD) (DNSServiceRef sdRef); extern _DNSServiceRefSockFD DNSServiceRefSockFD; #endif /* */ /* DNSServiceProcessResult() * * Read a reply from the daemon, calling the appropriate application callback. This call will * block until the daemon's response is received. Use DNSServiceRefSockFD() in * conjunction with a run loop or select() to determine the presence of a response from the * server before calling this function to process the reply without blocking. Call this function * at any point if it is acceptable to block until the daemon's response arrives. Note that the * client is responsible for ensuring that DNSServiceProcessResult() is called whenever there is * a reply from the daemon - the daemon may terminate its connection with a client that does not * process the daemon's responses. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls * that take a callback parameter. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns * an error code indicating the specific failure that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceProcessResult) (DNSServiceRef sdRef); extern _DNSServiceProcessResult DNSServiceProcessResult; #endif /* */ /* DNSServiceRefDeallocate() * * Terminate a connection with the daemon and free memory associated with the DNSServiceRef. * Any services or records registered with this DNSServiceRef will be deregistered. Any * Browse, Resolve, or Query operations called with this reference will be terminated. * * Note: If the reference's underlying socket is used in a run loop or select() call, it should * be removed BEFORE DNSServiceRefDeallocate() is called, as this function closes the reference's * socket. * * Note: If the reference was initialized with DNSServiceCreateConnection(), any DNSRecordRefs * created via this reference will be invalidated by this call - the resource records are * deregistered, and their DNSRecordRefs may not be used in subsequent functions. Similarly, * if the reference was initialized with DNSServiceRegister, and an extra resource record was * added to the service via DNSServiceAddRecord(), the DNSRecordRef created by the Add() call * is invalidated when this function is called - the DNSRecordRef may not be used in subsequent * functions. * * Note: This call is to be used only with the DNSServiceRef defined by this API. It is * not compatible with dns_service_discovery_ref objects defined in the legacy Mach-based * DNSServiceDiscovery.h API. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls. * */ #if ORIGINAL_DNSSD_INCLUDE void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef); #else /* */ typedef void DNSSD_API(*_DNSServiceRefDeallocate) (DNSServiceRef sdRef); extern _DNSServiceRefDeallocate DNSServiceRefDeallocate; #endif /* */ /********************************************************************************************* * * Domain Enumeration * *********************************************************************************************/ /* DNSServiceEnumerateDomains() * * Asynchronously enumerate domains available for browsing and registration. * * The enumeration MUST be cancelled via DNSServiceRefDeallocate() when no more domains * are to be found. * * Note that the names returned are (like all of DNS-SD) UTF-8 strings, * and are escaped using standard DNS escaping rules. * (See "Notes on DNS Name Escaping" earlier in this file for more details.) * A graphical browser displaying a hierarchical tree-structured view should cut * the names at the bare dots to yield individual labels, then de-escape each * label according to the escaping rules, and then display the resulting UTF-8 text. * * DNSServiceDomainEnumReply Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceEnumerateDomains(). * * flags: Possible values are: * kDNSServiceFlagsMoreComing * kDNSServiceFlagsAdd * kDNSServiceFlagsDefault * * interfaceIndex: Specifies the interface on which the domain exists. (The index for a given * interface is determined via the if_nametoindex() family of calls.) * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise indicates * the failure that occurred (other parameters are undefined if errorCode is nonzero). * * replyDomain: The name of the domain. * * context: The context pointer passed to DNSServiceEnumerateDomains. * */ typedef void (DNSSD_API * DNSServiceDomainEnumReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *replyDomain, void *context ); /* DNSServiceEnumerateDomains() Parameters: * * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the enumeration operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Possible values are: * kDNSServiceFlagsBrowseDomains to enumerate domains recommended for browsing. * kDNSServiceFlagsRegistrationDomains to enumerate domains recommended * for registration. * * interfaceIndex: If non-zero, specifies the interface on which to look for domains. * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to enumerate domains on * all interfaces. See "Constants for specifying an interface index" for more details. * * callBack: The function to be called when a domain is found or the call asynchronously * fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is not invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceDomainEnumReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceEnumerateDomains) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceDomainEnumReply callBack, void *context /* may be NULL */ ); extern _DNSServiceEnumerateDomains DNSServiceEnumerateDomains; #endif /* */ /********************************************************************************************* * * Service Registration * *********************************************************************************************/ /* Register a service that is discovered via Browse() and Resolve() calls. * * * DNSServiceRegisterReply() Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceRegister(). * * flags: Currently unused, reserved for future use. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred (including name conflicts, * if the kDNSServiceFlagsNoAutoRename flag was used when registering.) * Other parameters are undefined if errorCode is nonzero. * * name: The service name registered (if the application did not specify a name in * DNSServiceRegister(), this indicates what name was automatically chosen). * * regtype: The type of service registered, as it was passed to the callout. * * domain: The domain on which the service was registered (if the application did not * specify a domain in DNSServiceRegister(), this indicates the default domain * on which the service was registered). * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceRegisterReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context ); /* DNSServiceRegister() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the registration will remain active indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * interfaceIndex: If non-zero, specifies the interface on which to register the service * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to register on all * available interfaces. See "Constants for specifying an interface index" for more details. * * flags: Indicates the renaming behavior on name conflict (most applications * will pass 0). See flag definitions above for details. * * name: If non-NULL, specifies the service name to be registered. * Most applications will not specify a name, in which case the computer * name is used (this name is communicated to the client via the callback). * If a name is specified, it must be 1-63 bytes of UTF-8 text. * If the name is longer than 63 bytes it will be automatically truncated * to a legal length, unless the NoAutoRename flag is set, * in which case kDNSServiceErr_BadParam will be returned. * * regtype: The service type followed by the protocol, separated by a dot * (e.g. "_ftp._tcp"). The service type must be an underscore, followed * by 1-14 characters, which may be letters, digits, or hyphens. * The transport protocol must be "_tcp" or "_udp". New service types * should be registered at . * * domain: If non-NULL, specifies the domain on which to advertise the service. * Most applications will not specify a domain, instead automatically * registering in the default domain(s). * * host: If non-NULL, specifies the SRV target host name. Most applications * will not specify a host, instead automatically using the machine's * default host name(s). Note that specifying a non-NULL host does NOT * create an address record for that host - the application is responsible * for ensuring that the appropriate address record exists, or creating it * via DNSServiceRegisterRecord(). * * port: The port, in network byte order, on which the service accepts connections. * Pass 0 for a "placeholder" service (i.e. a service that will not be discovered * by browsing, but will cause a name conflict if another client tries to * register that same name). Most clients will not use placeholder services. * * txtLen: The length of the txtRecord, in bytes. Must be zero if the txtRecord is NULL. * * txtRecord: The TXT record rdata. A non-NULL txtRecord MUST be a properly formatted DNS * TXT record, i.e. ... * Passing NULL for the txtRecord is allowed as a synonym for txtLen=1, txtRecord="", * i.e. it creates a TXT record of length one containing a single empty string. * RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty * string is the smallest legal DNS TXT record. * * callBack: The function to be called when the registration completes or asynchronously * fails. The client MAY pass NULL for the callback - The client will NOT be notified * of the default values picked on its behalf, and the client will NOT be notified of any * asynchronous errors (e.g. out of memory errors, etc.) that may prevent the registration * of the service. The client may NOT pass the NoAutoRename flag if the callback is NULL. * The client may still deregister the service at any time via DNSServiceRefDeallocate(). * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) * */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRegister ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, /* may be NULL */ const char *regtype, const char *domain, /* may be NULL */ const char *host, /* may be NULL */ uint16_t port, uint16_t txtLen, const void *txtRecord, /* may be NULL */ DNSServiceRegisterReply callBack, /* may be NULL */ void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRegister) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, /* may be NULL */ const char *regtype, const char *domain, /* may be NULL */ const char *host, /* may be NULL */ uint16_t port, uint16_t txtLen, const void *txtRecord, /* may be NULL */ DNSServiceRegisterReply callBack, /* may be NULL */ void *context /* may be NULL */ ); extern _DNSServiceRegister DNSServiceRegister; #endif /* */ /* DNSServiceAddRecord() * * Add a record to a registered service. The name of the record will be the same as the * registered service's name. * The record can later be updated or deregistered by passing the RecordRef initialized * by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * * * Parameters; * * sdRef: A DNSServiceRef initialized by DNSServiceRegister(). * * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * If the above DNSServiceRef is passed to DNSServiceRefDeallocate(), RecordRef is also * invalidated and may not be used further. * * flags: Currently ignored, reserved for future use. * * rrtype: The type of the record (e.g. kDNSServiceType_TXT, kDNSServiceType_SRV, etc) * * rdlen: The length, in bytes, of the rdata. * * rdata: The raw rdata to be contained in the added resource record. * * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred (the RecordRef is not initialized). */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceAddRecord ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceAddRecord) ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl ); extern _DNSServiceAddRecord DNSServiceAddRecord; #endif /* */ /* DNSServiceUpdateRecord * * Update a registered resource record. The record must either be: * - The primary txt record of a service registered via DNSServiceRegister() * - A record added to a registered service via DNSServiceAddRecord() * - An individual record registered by DNSServiceRegisterRecord() * * * Parameters: * * sdRef: A DNSServiceRef that was initialized by DNSServiceRegister() * or DNSServiceCreateConnection(). * * RecordRef: A DNSRecordRef initialized by DNSServiceAddRecord, or NULL to update the * service's primary txt record. * * flags: Currently ignored, reserved for future use. * * rdlen: The length, in bytes, of the new rdata. * * rdata: The new rdata to be contained in the updated resource record. * * ttl: The time to live of the updated resource record, in seconds. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord ( DNSServiceRef sdRef, DNSRecordRef RecordRef, /* may be NULL */ DNSServiceFlags flags, uint16_t rdlen, const void *rdata, uint32_t ttl ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceUpdateRecord) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, /* may be NULL */ DNSServiceFlags flags, uint16_t rdlen, const void *rdata, uint32_t ttl ); extern _DNSServiceUpdateRecord DNSServiceUpdateRecord; #endif /* */ /* DNSServiceRemoveRecord * * Remove a record previously added to a service record set via DNSServiceAddRecord(), or deregister * an record registered individually via DNSServiceRegisterRecord(). * * Parameters: * * sdRef: A DNSServiceRef initialized by DNSServiceRegister() (if the * record being removed was registered via DNSServiceAddRecord()) or by * DNSServiceCreateConnection() (if the record being removed was registered via * DNSServiceRegisterRecord()). * * recordRef: A DNSRecordRef initialized by a successful call to DNSServiceAddRecord() * or DNSServiceRegisterRecord(). * * flags: Currently ignored, reserved for future use. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRemoveRecord) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags ); extern _DNSServiceRemoveRecord DNSServiceRemoveRecord; #endif /* */ /********************************************************************************************* * * Service Discovery * *********************************************************************************************/ /* Browse for instances of a service. * * * DNSServiceBrowseReply() Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceBrowse(). * * flags: Possible values are kDNSServiceFlagsMoreComing and kDNSServiceFlagsAdd. * See flag definitions for details. * * interfaceIndex: The interface on which the service is advertised. This index should * be passed to DNSServiceResolve() when resolving the service. * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * the errorCode is nonzero. * * serviceName: The discovered service name. This name should be displayed to the user, * and stored for subsequent use in the DNSServiceResolve() call. * * regtype: The service type, which is usually (but not always) the same as was passed * to DNSServiceBrowse(). One case where the discovered service type may * not be the same as the requested service type is when using subtypes: * The client may want to browse for only those ftp servers that allow * anonymous connections. The client will pass the string "_ftp._tcp,_anon" * to DNSServiceBrowse(), but the type of the service that's discovered * is simply "_ftp._tcp". The regtype for each discovered service instance * should be stored along with the name, so that it can be passed to * DNSServiceResolve() when the service is later resolved. * * domain: The domain of the discovered service instance. This may or may not be the * same as the domain that was passed to DNSServiceBrowse(). The domain for each * discovered service instance should be stored along with the name, so that * it can be passed to DNSServiceResolve() when the service is later resolved. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceBrowseReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context ); /* DNSServiceBrowse() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the browse operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Currently ignored, reserved for future use. * * interfaceIndex: If non-zero, specifies the interface on which to browse for services * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to browse on all available * interfaces. See "Constants for specifying an interface index" for more details. * * regtype: The service type being browsed for followed by the protocol, separated by a * dot (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp". * * domain: If non-NULL, specifies the domain on which to browse for services. * Most applications will not specify a domain, instead browsing on the * default domain(s). * * callBack: The function to be called when an instance of the service being browsed for * is found, or if the call asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is not invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceBrowse ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *regtype, const char *domain, /* may be NULL */ DNSServiceBrowseReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceBrowse) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *regtype, const char *domain, /* may be NULL */ DNSServiceBrowseReply callBack, void *context /* may be NULL */ ); extern _DNSServiceBrowse DNSServiceBrowse; #endif /* */ /* DNSServiceResolve() * * Resolve a service name discovered via DNSServiceBrowse() to a target host name, port number, and * txt record. * * Note: Applications should NOT use DNSServiceResolve() solely for txt record monitoring - use * DNSServiceQueryRecord() instead, as it is more efficient for this task. * * Note: When the desired results have been returned, the client MUST terminate the resolve by calling * DNSServiceRefDeallocate(). * * Note: DNSServiceResolve() behaves correctly for typical services that have a single SRV record * and a single TXT record. To resolve non-standard services with multiple SRV or TXT records, * DNSServiceQueryRecord() should be used. * * DNSServiceResolveReply Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceResolve(). * * flags: Currently unused, reserved for future use. * * interfaceIndex: The interface on which the service was resolved. * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * the errorCode is nonzero. * * fullname: The full service domain name, in the form ... * (This name is escaped following standard DNS rules, making it suitable for * passing to standard system DNS APIs such as res_query(), or to the * special-purpose functions included in this API that take fullname parameters. * See "Notes on DNS Name Escaping" earlier in this file for more details.) * * hosttarget: The target hostname of the machine providing the service. This name can * be passed to functions like gethostbyname() to identify the host's IP address. * * port: The port, in network byte order, on which connections are accepted for this service. * * txtLen: The length of the txt record, in bytes. * * txtRecord: The service's primary txt record, in standard txt record format. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceResolveReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const char *txtRecord, void *context ); /* DNSServiceResolve() Parameters * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the resolve operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Currently ignored, reserved for future use. * * interfaceIndex: The interface on which to resolve the service. If this resolve call is * as a result of a currently active DNSServiceBrowse() operation, then the * interfaceIndex should be the index reported in the DNSServiceBrowseReply * callback. If this resolve call is using information previously saved * (e.g. in a preference file) for later use, then use interfaceIndex 0, because * the desired service may now be reachable via a different physical interface. * See "Constants for specifying an interface index" for more details. * * name: The name of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * regtype: The type of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * domain: The domain of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * callBack: The function to be called when a result is found, or if the call * asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceResolve ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceResolve) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context /* may be NULL */ ); extern _DNSServiceResolve DNSServiceResolve; #endif /* */ /********************************************************************************************* * * Special Purpose Calls (most applications will not use these) * *********************************************************************************************/ /* DNSServiceCreateConnection() * * Create a connection to the daemon allowing efficient registration of * multiple individual records. * * * Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating * the reference (via DNSServiceRefDeallocate()) severs the * connection and deregisters all records registered on this connection. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns * an error code indicating the specific failure that occurred (in which * case the DNSServiceRef is not initialized). */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef * sdRef); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceCreateConnection) (DNSServiceRef * sdRef); extern _DNSServiceCreateConnection DNSServiceCreateConnection; #endif /* */ /* DNSServiceRegisterRecord * * Register an individual resource record on a connected DNSServiceRef. * * Note that name conflicts occurring for records registered via this call must be handled * by the client in the callback. * * * DNSServiceRegisterRecordReply() parameters: * * sdRef: The connected DNSServiceRef initialized by * DNSServiceDiscoveryConnect(). * * RecordRef: The DNSRecordRef initialized by DNSServiceRegisterRecord(). If the above * DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is * invalidated, and may not be used further. * * flags: Currently unused, reserved for future use. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred (including name conflicts.) * Other parameters are undefined if errorCode is nonzero. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceRegisterRecordReply) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, void *context ); /* DNSServiceRegisterRecord() Parameters: * * sdRef: A DNSServiceRef initialized by DNSServiceCreateConnection(). * * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * (To deregister ALL records registered on a single connected DNSServiceRef * and deallocate each of their corresponding DNSServiceRecordRefs, call * DNSServiceRefDealloocate()). * * flags: Possible values are kDNSServiceFlagsShared or kDNSServiceFlagsUnique * (see flag type definitions for details). * * interfaceIndex: If non-zero, specifies the interface on which to register the record * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Passing 0 causes the record to be registered on all interfaces. * See "Constants for specifying an interface index" for more details. * * fullname: The full domain name of the resource record. * * rrtype: The numerical type of the resource record (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN) * * rdlen: Length, in bytes, of the rdata. * * rdata: A pointer to the raw rdata, as it is to appear in the DNS record. * * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value. * * callBack: The function to be called when a result is found, or if the call * asynchronously fails (e.g. because of a name conflict.) * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSRecordRef is * not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, DNSServiceRegisterRecordReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRegisterRecord) ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, DNSServiceRegisterRecordReply callBack, void *context /* may be NULL */ ); extern _DNSServiceRegisterRecord DNSServiceRegisterRecord; #endif /* */ /* DNSServiceQueryRecord * * Query for an arbitrary DNS record. * * * DNSServiceQueryRecordReply() Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceQueryRecord(). * * flags: Possible values are kDNSServiceFlagsMoreComing and * kDNSServiceFlagsAdd. The Add flag is NOT set for PTR records * with a ttl of 0, i.e. "Remove" events. * * interfaceIndex: The interface on which the query was resolved (the index for a given * interface is determined via the if_nametoindex() family of calls). * See "Constants for specifying an interface index" for more details. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * errorCode is nonzero. * * fullname: The resource record's full domain name. * * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * rdlen: The length, in bytes, of the resource record rdata. * * rdata: The raw rdata of the resource record. * * ttl: The resource record's time to live, in seconds. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceQueryRecordReply) ( DNSServiceRef DNSServiceRef_, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context ); /* DNSServiceQueryRecord() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the query operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Pass kDNSServiceFlagsLongLivedQuery to create a "long-lived" unicast * query in a non-local domain. Without setting this flag, unicast queries * will be one-shot - that is, only answers available at the time of the call * will be returned. By setting this flag, answers (including Add and Remove * events) that become available after the initial call is made will generate * callbacks. This flag has no effect on link-local multicast queries. * * interfaceIndex: If non-zero, specifies the interface on which to issue the query * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Passing 0 causes the name to be queried for on all * interfaces. See "Constants for specifying an interface index" for more details. * * fullname: The full domain name of the resource record to be queried for. * * rrtype: The numerical type of the resource record to be queried for * (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * callBack: The function to be called when a result is found, or if the call * asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceQueryRecord ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceQueryRecord) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context /* may be NULL */ ); extern _DNSServiceQueryRecord DNSServiceQueryRecord; #endif /* */ /* DNSServiceReconfirmRecord * * Instruct the daemon to verify the validity of a resource record that appears to * be out of date (e.g. because tcp connection to a service's target failed.) * Causes the record to be flushed from the daemon's cache (as well as all other * daemons' caches on the network) if the record is determined to be invalid. * * Parameters: * * flags: Currently unused, reserved for future use. * * interfaceIndex: If non-zero, specifies the interface of the record in question. * Passing 0 causes all instances of this record to be reconfirmed. * * fullname: The resource record's full domain name. * * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * rdlen: The length, in bytes, of the resource record rdata. * * rdata: The raw rdata of the resource record. * */ #if ORIGINAL_DNSSD_INCLUDE void DNSSD_API DNSServiceReconfirmRecord ( DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata ); #else /* */ typedef void DNSSD_API(*_DNSServiceReconfirmRecord) ( DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata ); extern _DNSServiceReconfirmRecord DNSServiceReconfirmRecord; #endif /* */ /********************************************************************************************* * * General Utility Functions * *********************************************************************************************/ /* DNSServiceConstructFullName() * * Concatenate a three-part domain name (as returned by the above callbacks) into a * properly-escaped full domain name. Note that callbacks in the above functions ALREADY ESCAPE * strings where necessary. * * Parameters: * * fullName: A pointer to a buffer that where the resulting full domain name is to be written. * The buffer must be kDNSServiceMaxDomainName (1005) bytes in length to * accommodate the longest legal domain name without buffer overrun. * * service: The service name - any dots or backslashes must NOT be escaped. * May be NULL (to construct a PTR record name, e.g. * "_ftp._tcp.apple.com."). * * regtype: The service type followed by the protocol, separated by a dot * (e.g. "_ftp._tcp"). * * domain: The domain name, e.g. "apple.com.". Literal dots or backslashes, * if any, must be escaped, e.g. "1st\. Floor.apple.com." * * return value: Returns 0 on success, -1 on error. * */ #if ORIGINAL_DNSSD_INCLUDE int DNSSD_API DNSServiceConstructFullName ( char *fullName, const char *service, /* may be NULL */ const char *regtype, const char *domain ); #else /* */ typedef int DNSSD_API(*_DNSServiceConstructFullName) ( char *fullName, const char *service, /* may be NULL */ const char *regtype, const char *domain ); extern _DNSServiceConstructFullName DNSServiceConstructFullName; #endif /* */ /********************************************************************************************* * * TXT Record Construction Functions * *********************************************************************************************/ /* * A typical calling sequence for TXT record construction is something like: * * Client allocates storage for TXTRecord data (e.g. declare buffer on the stack) * TXTRecordCreate(); * TXTRecordSetValue(); * TXTRecordSetValue(); * TXTRecordSetValue(); * ... * DNSServiceRegister( ... TXTRecordGetLength(), TXTRecordGetBytesPtr() ... ); * TXTRecordDeallocate(); * Explicitly deallocate storage for TXTRecord data (if not allocated on the stack) */ /* TXTRecordRef * * Opaque internal data type. * Note: Represents a DNS-SD TXT record. */ typedef union _TXTRecordRef_t { char PrivateData[16]; char *ForceNaturalAlignment; } TXTRecordRef; /* TXTRecordCreate() * * Creates a new empty TXTRecordRef referencing the specified storage. * * If the buffer parameter is NULL, or the specified storage size is not * large enough to hold a key subsequently added using TXTRecordSetValue(), * then additional memory will be added as needed using malloc(). * * On some platforms, when memory is low, malloc() may fail. In this * case, TXTRecordSetValue() will return kDNSServiceErr_NoMemory, and this * error condition will need to be handled as appropriate by the caller. * * You can avoid the need to handle this error condition if you ensure * that the storage you initially provide is large enough to hold all * the key/value pairs that are to be added to the record. * The caller can precompute the exact length required for all of the * key/value pairs to be added, or simply provide a fixed-sized buffer * known in advance to be large enough. * A no-value (key-only) key requires (1 + key length) bytes. * A key with empty value requires (1 + key length + 1) bytes. * A key with non-empty value requires (1 + key length + 1 + value length). * For most applications, DNS-SD TXT records are generally * less than 100 bytes, so in most cases a simple fixed-sized * 256-byte buffer will be more than sufficient. * Recommended size limits for DNS-SD TXT Records are discussed in * * * Note: When passing parameters to and from these TXT record APIs, * the key name does not include the '=' character. The '=' character * is the separator between the key and value in the on-the-wire * packet format; it is not part of either the key or the value. * * txtRecord: A pointer to an uninitialized TXTRecordRef. * * bufferLen: The size of the storage provided in the "buffer" parameter. * * buffer: Optional caller-supplied storage used to hold the TXTRecord data. * This storage must remain valid for as long as * the TXTRecordRef. */ void DNSSD_API TXTRecordCreate ( TXTRecordRef * txtRecord, uint16_t bufferLen, void *buffer ); /* TXTRecordDeallocate() * * Releases any resources allocated in the course of preparing a TXT Record * using TXTRecordCreate()/TXTRecordSetValue()/TXTRecordRemoveValue(). * Ownership of the buffer provided in TXTRecordCreate() returns to the client. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * */ void DNSSD_API TXTRecordDeallocate ( TXTRecordRef * txtRecord ); /* TXTRecordSetValue() * * Adds a key (optionally with value) to a TXTRecordRef. If the "key" already * exists in the TXTRecordRef, then the current value will be replaced with * the new value. * Keys may exist in four states with respect to a given TXT record: * - Absent (key does not appear at all) * - Present with no value ("key" appears alone) * - Present with empty value ("key=" appears in TXT record) * - Present with non-empty value ("key=value" appears in TXT record) * For more details refer to "Data Syntax for DNS-SD TXT Records" in * * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * key: A null-terminated string which only contains printable ASCII * values (0x20-0x7E), excluding '=' (0x3D). Keys should be * 8 characters or less (not counting the terminating null). * * valueSize: The size of the value. * * value: Any binary value. For values that represent * textual data, UTF-8 is STRONGLY recommended. * For values that represent textual data, valueSize * should NOT include the terminating null (if any) * at the end of the string. * If NULL, then "key" will be added with no value. * If non-NULL but valueSize is zero, then "key=" will be * added with empty value. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_Invalid if the "key" string contains * illegal characters. * Returns kDNSServiceErr_NoMemory if adding this key would * exceed the available storage. */ DNSServiceErrorType DNSSD_API TXTRecordSetValue ( TXTRecordRef * txtRecord, const char *key, uint8_t valueSize, /* may be zero */ const void *value /* may be NULL */ ); /* TXTRecordRemoveValue() * * Removes a key from a TXTRecordRef. The "key" must be an * ASCII string which exists in the TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * key: A key name which exists in the TXTRecordRef. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_NoSuchKey if the "key" does not * exist in the TXTRecordRef. * */ DNSServiceErrorType DNSSD_API TXTRecordRemoveValue ( TXTRecordRef * txtRecord, const char *key ); /* TXTRecordGetLength() * * Allows you to determine the length of the raw bytes within a TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * return value: Returns the size of the raw bytes inside a TXTRecordRef * which you can pass directly to DNSServiceRegister() or * to DNSServiceUpdateRecord(). * Returns 0 if the TXTRecordRef is empty. * */ uint16_t DNSSD_API TXTRecordGetLength ( const TXTRecordRef * txtRecord ); /* TXTRecordGetBytesPtr() * * Allows you to retrieve a pointer to the raw bytes within a TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * return value: Returns a pointer to the raw bytes inside the TXTRecordRef * which you can pass directly to DNSServiceRegister() or * to DNSServiceUpdateRecord(). * */ const void *DNSSD_API TXTRecordGetBytesPtr ( const TXTRecordRef * txtRecord ); /********************************************************************************************* * * TXT Record Parsing Functions * *********************************************************************************************/ /* * A typical calling sequence for TXT record parsing is something like: * * Receive TXT record data in DNSServiceResolve() callback * if (TXTRecordContainsKey(txtLen, txtRecord, "key")) then do something * val1ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key1", &len1); * val2ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key2", &len2); * ... * bcopy(val1ptr, myval1, len1); * bcopy(val2ptr, myval2, len2); * ... * return; * * If you wish to retain the values after return from the DNSServiceResolve() * callback, then you need to copy the data to your own storage using bcopy() * or similar, as shown in the example above. * * If for some reason you need to parse a TXT record you built yourself * using the TXT record construction functions above, then you can do * that using TXTRecordGetLength and TXTRecordGetBytesPtr calls: * TXTRecordGetValue(TXTRecordGetLength(x), TXTRecordGetBytesPtr(x), key, &len); * * Most applications only fetch keys they know about from a TXT record and * ignore the rest. * However, some debugging tools wish to fetch and display all keys. * To do that, use the TXTRecordGetCount() and TXTRecordGetItemAtIndex() calls. */ /* TXTRecordContainsKey() * * Allows you to determine if a given TXT Record contains a specified key. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * key: A null-terminated ASCII string containing the key name. * * return value: Returns 1 if the TXT Record contains the specified key. * Otherwise, it returns 0. * */ int DNSSD_API TXTRecordContainsKey ( uint16_t txtLen, const void *txtRecord, const char *key ); /* TXTRecordGetValuePtr() * * Allows you to retrieve the value for a given key from a TXT Record. * * txtLen: The size of the received TXT Record * * txtRecord: Pointer to the received TXT Record bytes. * * key: A null-terminated ASCII string containing the key name. * * valueLen: On output, will be set to the size of the "value" data. * * return value: Returns NULL if the key does not exist in this TXT record, * or exists with no value (to differentiate between * these two cases use TXTRecordContainsKey()). * Returns pointer to location within TXT Record bytes * if the key exists with empty or non-empty value. * For empty value, valueLen will be zero. * For non-empty value, valueLen will be length of value data. */ const void *DNSSD_API TXTRecordGetValuePtr ( uint16_t txtLen, const void *txtRecord, const char *key, uint8_t * valueLen ); /* TXTRecordGetCount() * * Returns the number of keys stored in the TXT Record. The count * can be used with TXTRecordGetItemAtIndex() to iterate through the keys. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * return value: Returns the total number of keys in the TXT Record. * */ uint16_t DNSSD_API TXTRecordGetCount ( uint16_t txtLen, const void *txtRecord ); /* TXTRecordGetItemAtIndex() * * Allows you to retrieve a key name and value pointer, given an index into * a TXT Record. Legal index values range from zero to TXTRecordGetCount()-1. * It's also possible to iterate through keys in a TXT record by simply * calling TXTRecordGetItemAtIndex() repeatedly, beginning with index zero * and increasing until TXTRecordGetItemAtIndex() returns kDNSServiceErr_Invalid. * * On return: * For keys with no value, *value is set to NULL and *valueLen is zero. * For keys with empty value, *value is non-NULL and *valueLen is zero. * For keys with non-empty value, *value is non-NULL and *valueLen is non-zero. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * index: An index into the TXT Record. * * keyBufLen: The size of the string buffer being supplied. * * key: A string buffer used to store the key name. * On return, the buffer contains a null-terminated C string * giving the key name. DNS-SD TXT keys are usually * 8 characters or less. To hold the maximum possible * key name, the buffer should be 256 bytes long. * * valueLen: On output, will be set to the size of the "value" data. * * value: On output, *value is set to point to location within TXT * Record bytes that holds the value data. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_NoMemory if keyBufLen is too short. * Returns kDNSServiceErr_Invalid if index is greater than * TXTRecordGetCount()-1. */ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex ( uint16_t txtLen, const void *txtRecord, uint16_t index_, uint16_t keyBufLen, char *key, uint8_t * valueLen, const void **value ); #ifdef __APPLE_API_PRIVATE /* * Mac OS X specific functionality * 3rd party clients of this API should not depend on future support or availability of this routine */ /* DNSServiceSetDefaultDomainForUser() * * Set the default domain for the caller's UID. Future browse and registration * calls by this user that do not specify an explicit domain will browse and * register in this wide-area domain in addition to .local. In addition, this * domain will be returned as a Browse domain via domain enumeration calls. * * * Parameters: * * flags: Pass kDNSServiceFlagsAdd to add a domain for a user. Call without * this flag set to clear a previously added domain. * * domain: The domain to be used for the caller's UID. * * return value: Returns kDNSServiceErr_NoError on succeses, otherwise returns * an error code indicating the error that occurred */ DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser ( DNSServiceFlags flags, const char *domain ); #endif //__APPLE_API_PRIVATE // Some C compiler cleverness. We can make the compiler check certain things for us, // and report errors at compile-time if anything is wrong. The usual way to do this would // be to use a run-time "if" statement or the conventional run-time "assert" mechanism, but // then you don't find out what's wrong until you run the software. This way, if the assertion // condition is false, the array size is negative, and the complier complains immediately. struct DNS_SD_CompileTimeAssertionChecks { char assert0[(sizeof(union _TXTRecordRef_t) == 16) ? 1 : -1]; }; #ifdef __cplusplus } #endif /* */ #endif /* _DNS_SD_H */ owfs-2.8p15/module/ownet/c/src/include/compat_getopt.h0000664000175000017500000001354010750074146017714 00000000000000/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include "owfs_config.h" #ifndef _COMP_GETOPT_H #define _COMP_GETOPT_H /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_GETOPT /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #endif /* HAVE_GETOPT */ #ifndef HAVE_GETOPT_LONG /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* HAVE_GETOPT_LONG */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #ifndef HAVE_GETOPT /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt(int __argc, char *const *__argv, const char *__shortopts); #endif #ifndef HAVE_GETOPT_LONG extern int getopt_long(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); #endif #ifdef __cplusplus } #endif #endif /* _COMP_GETOPT_H */ owfs-2.8p15/module/ownet/c/src/include/ow_connection.h0000664000175000017500000001630611535564273017725 00000000000000/* $Id: ow_connection.h,v 1.7 2011/03/09 02:40:59 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_CONNECTION_H /* tedious wrapper */ #define OW_CONNECTION_H /* Jan 21, 2007 from the IANA: owserver 4304/tcp One-Wire Filesystem Server owserver 4304/udp One-Wire Filesystem Server # Paul Alfille January 2007 See: http://www.iana.org/assignments/port-numbers */ #define DEFAULT_PORT "4304" #include "ow.h" #include #include "ownetapi.h" /* large enough for arrays of 2048 elements of ~49 bytes each */ #define MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE 100050 /* com port fifo info */ /* The UART_FIFO_SIZE defines the amount of bytes that are written before * reading the reply. Any positive value should work and 16 is probably low * enough to avoid losing bytes in even most extreme situations on all modern * UARTs, and values bigger than that will probably work on almost any * system... The value affects readout performance asymptotically, value of 1 * should give equivalent performance with the old implementation. * -- Jari Kirma * * Note: Each bit sent to the 1-wire net requeires 1 byte to be sent to * the uart. */ #define UART_FIFO_SIZE 160 /** USB bulk endpoint FIFO size Need one for each for read and write This is for alt setting "3" -- 64 bytes, 1msec polling */ #define USB_FIFO_EACH 64 #define USB_FIFO_READ 0 #define USB_FIFO_WRITE USB_FIFO_EACH #define USB_FIFO_SIZE ( USB_FIFO_EACH + USB_FIFO_EACH ) #define HA7_FIFO_SIZE 32000 #define LINK_FIFO_SIZE UART_FIFO_SIZE #define LINKE_FIFO_SIZE 1500 #define I2C_FIFO_SIZE 1 #if USB_FIFO_SIZE > UART_FIFO_SIZE #define MAX_FIFO_SIZE USB_FIFO_SIZE #else #define MAX_FIFO_SIZE UART_FIFO_SIZE #endif struct connection_in; /* -------------------------------------------- */ /* Interface-specific routines ---------------- */ struct interface_routines { /* Detect if adapter is present, and open -- usually called outside of this routine */ int (*detect) (struct connection_in * in); /* reset the interface -- actually the 1-wire bus */ void (*close) (struct connection_in * in); /* capabilities flags */ UINT flags; }; #define BUS_detect(in) (((in)->iroutines.detect(in))) #define BUS_close(in) (((in)->iroutines.close(in))) #if OW_MT #else /* OW_MT */ #endif /* OW_MT */ struct connin_tcp { char *host; char *service; struct addrinfo *ai; struct addrinfo *ai_ok; char *type; // for zeroconf char *domain; // for zeroconf char *fqdn; // fully qualified domain name int no_dirall; // flag that server doesn't support DIRALL }; //enum server_type { srv_unknown, srv_direct, srv_client, src_ /* Network connection structure */ enum bus_mode { bus_unknown = 0, bus_server, bus_zero, }; enum connection_state { connection_vacant, connection_pending, connection_active, }; enum adapter_type { adapter_tcp = 9, }; enum e_reconnect { reconnect_bad = -1, reconnect_ok = 0, reconnect_error = 5, }; struct device_search { int LastDiscrepancy; // for search int LastDevice; // for search int index; BYTE sn[8]; BYTE search; }; struct connection_in { struct connection_in *next; int index; enum connection_state state; char *name; int file_descriptor; #if OW_MT pthread_mutex_t bus_mutex; #endif /* OW_MT */ enum bus_mode busmode; struct interface_routines iroutines; enum adapter_type Adapter; char *adapter_name; /* Static buffer for conmmunication */ /* Since only used during actual transfer to/from the adapter, should be protected from contention even when multithreading allowed */ size_t bundling_length; union { struct connin_tcp tcp; } connin; }; extern struct connection_in *head_inbound_list; #define FD_PERSISTENT_IN_USE -2 #define FD_PERSISTENT_NONE -1 #define FD_CURRENT_BAD -1 /* This bug-fix/workaround function seem to be fixed now... At least on * the platforms I have tested it on... printf() in owserver/src/c/owserver.c * returned very strange result on c->busmode before... but not anymore */ enum bus_mode get_busmode(struct connection_in *c); int BusIsServer(struct connection_in *in); void FreeIn(struct connection_in *target); void FreeInAll(void); struct connection_in *NewIn(void); struct connection_in *find_connection_in(OWNET_HANDLE handle); /* Bonjour registration */ void OW_Browse(void); /* Low-level functions slowly being abstracted and separated from individual interface type details */ int Server_detect(struct connection_in *in); int Zero_detect(struct connection_in *in); int BadAdapter_detect(struct connection_in *in); #endif /* OW_CONNECTION_H */ owfs-2.8p15/module/ownet/c/src/include/compat_netdb.h0000664000175000017500000001426210750074146017510 00000000000000/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* All data returned by the network data base library are supplied in host order and returned in network order (suitable for use in system calls). */ #ifndef _COMPAT_NETDB_H #define _COMPAT_NETDB_H 1 #include #include "owfs_config.h" #ifdef HAVE_FEATURES_H #include #endif #ifndef __USE_GNU #define __USE_GNU #endif /* Doesn't exist for Solaris, make a test for it later */ /* #undef HAVE_SA_LEN */ #ifndef __HAS_IPV6__ #define __HAS_IPV6__ 0 #endif #ifndef __USE_POSIX #define __USE_POSIX #endif #ifndef __THROW #define __THROW #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifdef __USE_MISC /* This is necessary to make this include file properly replace the Sun version. */ # include #endif #ifdef HAVE_BITS_NETDB_H #include #endif /* Absolute file name for network data base files. */ #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" #ifndef __set_errno #define __set_errno(x) (errno = (x)) #endif #ifndef __set_h_errno #define __set_h_errno(x) (h_errno = (x)) #endif #ifndef HAVE_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif #ifndef HAVE_INET_PTON int inet_pton(int af, const char *src, void *dst); #endif #ifndef HAVE_GETADDRINFO /* Possible values left in `h_errno'. */ #define NETDB_INTERNAL -1 /* See errno. */ #define NETDB_SUCCESS 0 /* No problem. */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL. */ #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */ #define NO_DATA 4 /* Valid name, no data record of requested type. */ #define NO_ADDRESS NO_DATA /* No address, look for MX record. */ #ifdef __USE_XOPEN2K /* Highest reserved Internet port number. */ # define IPPORT_RESERVED 1024 #endif #ifdef __USE_GNU /* Scope delimiter for getaddrinfo(), getnameinfo(). */ # define SCOPE_DELIMITER '%' #endif /* Extension from POSIX.1g. */ #ifdef __USE_POSIX /* Structure to contain information about address of a service provider. */ struct addrinfo { int ai_flags; /* Input flags. */ int ai_family; /* Protocol family for socket. */ int ai_socktype; /* Socket type. */ int ai_protocol; /* Protocol for socket. */ socklen_t ai_addrlen; /* Length of socket address. */ struct sockaddr *ai_addr; /* Socket address for socket. */ char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; # ifdef __USE_GNU /* Lookup mode. */ # define GAI_WAIT 0 # define GAI_NOWAIT 1 # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ # define AI_CANONNAME 0x0002 /* Request for canonical name. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ /* Error values for `getaddrinfo' function. */ # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ # define EAI_NODATA -5 /* No address associated with NAME. */ # define EAI_FAMILY -6 /* `ai_family' not supported. */ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ # define EAI_MEMORY -10 /* Memory allocation failure. */ # define EAI_SYSTEM -11 /* System error returned in `errno'. */ # ifdef __USE_GNU # define EAI_INPROGRESS -100 /* Processing request in progress. */ # define EAI_CANCELED -101 /* Request canceled. */ # define EAI_NOTCANCELED -102 /* Request not canceled. */ # define EAI_ALLDONE -103 /* All requests done. */ # define EAI_INTR -104 /* Interrupted by a signal. */ # endif # define NI_MAXHOST 1025 # define NI_MAXSERV 32 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ # define NI_NOFQDN 4 /* Only return nodename portion. */ # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ /* Translate name of a service location and/or a service name to set of socket addresses. */ extern int getaddrinfo(__const char *__restrict __name, __const char *__restrict __service, __const struct addrinfo *__restrict __req, struct addrinfo **__restrict __pai) __THROW; /* Free `addrinfo' structure AI including associated storage. */ extern void freeaddrinfo(struct addrinfo *__ai) __THROW; /* Convert error return from getaddrinfo() to a string. */ extern const char *gai_strerror(int __ecode) __THROW; #endif /* HAVE_GETADDRINFO */ #endif /* POSIX */ #endif /* COMPAT_NETDB_H */ owfs-2.8p15/module/ownet/c/src/include/ow_mutexes.h0000664000175000017500000001102511130373466017242 00000000000000/* $Id: ow_mutexes.h,v 1.6 2009/01/05 12:04:06 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h and only separated out for clarity */ #ifndef OW_MUTEXES_H /* tedious wrapper */ #define OW_MUTEXES_H #if OW_MT #include #endif /* OW_MT */ extern struct mutexes { #if OW_MT pthread_mutexattr_t *pmattr; my_rwlock_t lib; my_rwlock_t connin; #ifdef __UCLIBC__ pthread_mutexattr_t mattr; pthread_mutex_t uclibc_mutex; #endif /* __UCLIBC__ */ #endif /* OW_MT */ } Mutex; #if OW_MT #define LIB_WLOCK my_rwlock_write_lock( &Mutex.lib ) ; #define LIB_WUNLOCK my_rwlock_write_unlock( &Mutex.lib ) ; #define LIB_RLOCK my_rwlock_read_lock( &Mutex.lib ) ; #define LIB_RUNLOCK my_rwlock_read_unlock( &Mutex.lib ) ; #define CONNIN_WLOCK my_rwlock_write_lock( &Mutex.connin ) ; #define CONNIN_WUNLOCK my_rwlock_write_unlock( &Mutex.connin ) ; #define CONNIN_RLOCK my_rwlock_read_lock( &Mutex.connin ) ; #define CONNIN_RUNLOCK my_rwlock_read_unlock( &Mutex.connin ) ; #define BUSLOCK(pn) BUS_lock(pn) #define BUSUNLOCK(pn) BUS_unlock(pn) #define BUSLOCKIN(in) BUS_lock_in(in) #define BUSUNLOCKIN(in) BUS_unlock_in(in) #ifdef __UCLIBC__ #define UCLIBCLOCK my_pthread_mutex_lock( &Mutex.uclibc_mutex) #define UCLIBCUNLOCK my_pthread_mutex_unlock(&Mutex.uclibc_mutex) #else /* __UCLIBC__ */ #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #endif /* __UCLIBC__ */ #else /* OW_MT */ #define LIB_WLOCK return_ok() #define LIB_WUNLOCK return_ok() #define LIB_RLOCK return_ok() #define LIB_RUNLOCK return_ok() #define CONNIN_WLOCK return_ok() #define CONNIN_WUNLOCK return_ok() #define CONNIN_RLOCK return_ok() #define CONNIN_RUNLOCK return_ok() #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #define BUSLOCK(pn) return_ok() #define BUSUNLOCK(pn) return_ok() #define BUSLOCKIN(in) return_ok() #define BUSUNLOCKIN(in) return_ok() #endif /* OW_MT */ #endif /* OW_MUTEXES_H */ owfs-2.8p15/module/ownet/c/src/include/ow_debug.h0000664000175000017500000001554311133104365016640 00000000000000/* $Id: ow_debug.h,v 1.5 2009/01/13 12:28:37 d1mag Exp $ Debug and error messages Meant to be included in ow.h Separated just for readability */ /* OWFS source code 1-wire filesystem for linux {c} 2006 Paul H Alfille License GPL2.0 */ #ifndef OW_DEBUG_H #define OW_DEBUG_H #include #include "owfs_config.h" #ifdef HAVE_SYS_UIO_H #include #endif #include /* module/ownet/c/src/include/ow_debug.h & module/owlib/src/include/ow_debug.h are identical except this define */ #define OWNETC_OW_DEBUG 1 /* error functions */ enum e_err_level { e_err_default, e_err_connect, e_err_call, e_err_data, e_err_detail, e_err_debug, e_err_beyond, }; enum e_err_type { e_err_type_level, e_err_type_error, }; enum e_err_print { e_err_print_mixed, e_err_print_syslog, e_err_print_console, }; #if OW_MT extern const char mutex_init_failed[]; extern const char mutex_destroy_failed[]; extern const char mutex_lock_failed[]; extern const char mutex_unlock_failed[]; extern const char mutexattr_init_failed[]; extern const char mutexattr_destroy_failed[]; extern const char mutexattr_settype_failed[]; extern const char rwlock_init_failed[]; extern const char rwlock_read_lock_failed[]; extern const char rwlock_read_unlock_failed[]; extern const char cond_timedwait_failed[]; extern const char cond_signal_failed[]; extern const char cond_wait_failed[]; extern const char cond_init_failed[]; extern const char cond_destroy_failed[]; #endif void err_msg(enum e_err_type errnoflag, enum e_err_level level, const char *fmt, ...); void _Debug_Bytes(const char *title, const unsigned char *buf, int length); void _Debug_Writev(struct iovec *io, int iosz); void fatal_error(char *file, int row, const char *fmt, ...); static inline int return_ok(void) { return 0; } extern int log_available; #if OW_DEBUG #define LEVEL_DEFAULT(...) if (Globals.error_level>=e_err_default) \ err_msg(e_err_type_level,e_err_default,__VA_ARGS__) #define LEVEL_CONNECT(...) if (Globals.error_level>=e_err_connect) \ err_msg(e_err_type_level,e_err_connect,__VA_ARGS__) #define LEVEL_CALL(...) if (Globals.error_level>=e_err_call) \ err_msg(e_err_type_level,e_err_call,__VA_ARGS__) #define LEVEL_DATA(...) if (Globals.error_level>=e_err_data) \ err_msg(e_err_type_level,e_err_data,__VA_ARGS__) #define LEVEL_DETAIL(...) if (Globals.error_level>=e_err_detail) \ err_msg(e_err_type_level,e_err_detail,__VA_ARGS__) #define LEVEL_DEBUG(...) if (Globals.error_level>=e_err_debug) \ err_msg(e_err_type_level,e_err_debug,__VA_ARGS__) #define ERROR_DEFAULT(...) if (Globals.error_level>=e_err_default) \ err_msg(e_err_type_error,e_err_default,__VA_ARGS__) #define ERROR_CONNECT(...) if (Globals.error_level>=e_err_connect) \ err_msg(e_err_type_error,e_err_connect,__VA_ARGS__) #define ERROR_CALL(...) if (Globals.error_level>=e_err_call) \ err_msg(e_err_type_error,e_err_call,__VA_ARGS__) #define ERROR_DATA(...) if (Globals.error_level>=e_err_data) \ err_msg(e_err_type_error,e_err_data,__VA_ARGS__) #define ERROR_DETAIL(...) if (Globals.error_level>=e_err_detail) \ err_msg(e_err_type_error,e_err_detail,__VA_ARGS__) #define ERROR_DEBUG(...) if (Globals.error_level>=e_err_debug) \ err_msg(e_err_type_error,e_err_debug,__VA_ARGS__) #define FATAL_ERROR(...) fatal_error(__FILE__, __LINE__, __VA_ARGS__) #define Debug_OWQ(owq) if (Globals.error_level>=e_err_debug) \ _print_owq(owq) #define Debug_Bytes(title,buf,length) if (Globals.error_level>=e_err_beyond) \ _Debug_Bytes(title,buf,length) #define Debug_Writev(io,iosz) if (Globals.error_level>=e_err_beyond) \ _Debug_Writev(io, iosz) #else #define LEVEL_DEFAULT(...) { } while (0); #define LEVEL_CONNECT(...) { } while (0); #define LEVEL_CALL(...) { } while (0); #define LEVEL_DATA(...) { } while (0); #define LEVEL_DETAIL(...) { } while (0); #define LEVEL_DEBUG(...) { } while (0); #define ERROR_DEFAULT(...) { } while (0); #define ERROR_CONNECT(...) { } while (0); #define ERROR_CALL(...) { } while (0); #define ERROR_DATA(...) { } while (0); #define ERROR_DETAIL(...) { } while (0); #define ERROR_DEBUG(...) { } while (0); #define FATAL_ERROR(...) { } while (0); #define Debug_Bytes(title,buf,length) { } while (0); #define Debug_Writev(io, iosz) { } while (0); #define Debug_OWQ(owq) { } while (0); #endif /* Make sure strings are safe for printf */ #define SAFESTRING(x) ((x) ? (x):"") /* Easy way to show 64bit serial numbers */ #define SNformat "%.2X %.2X %.2X %.2X %.2X %.2X %.2X %.2X" #define SNvar(sn) (sn)[0],(sn)[1],(sn)[2],(sn)[3],(sn)[4],(sn)[5],(sn)[6],(sn)[7] #if OW_MT /* Need to define those functions to get FILE and LINE information */ #define my_pthread_mutex_init(mutex, attr) \ { \ int mrc = pthread_mutex_init(mutex, attr); \ if(mrc != 0) { \ FATAL_ERROR(mutex_init_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutex_destroy(mutex) \ { \ int mrc = pthread_mutex_destroy(mutex); \ if(mrc != 0) { \ FATAL_ERROR(mutex_destroy_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutex_lock(mutex) \ { \ int mrc = pthread_mutex_lock(mutex); \ if(mrc != 0) { \ FATAL_ERROR(mutex_lock_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutex_unlock(mutex) \ { \ int mrc = pthread_mutex_unlock(mutex); \ if(mrc != 0) { \ FATAL_ERROR(mutex_unlock_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutexattr_init(attr) \ { \ int mrc = pthread_mutexattr_init(attr); \ if(mrc != 0) { \ FATAL_ERROR(mutexattr_init_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutexattr_destroy(attr) \ { \ int mrc = pthread_mutexattr_destroy(attr); \ if(mrc != 0) { \ FATAL_ERROR(mutexattr_destroy_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_mutexattr_settype(attr, typ) \ { \ int mrc = pthread_mutexattr_settype(attr, typ); \ if(mrc != 0) { \ FATAL_ERROR(mutexattr_settype_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_cond_timedwait(cond, mutex, abstime) \ { \ int mrc = pthread_cond_timedwait(cond, mutex, abstime); \ if(mrc != 0) { \ FATAL_ERROR(cond_timedwait_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_cond_wait(cond, mutex) \ { \ int mrc = pthread_cond_wait(cond, mutex); \ if(mrc != 0) { \ FATAL_ERROR(cond_wait_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_cond_signal(cond) \ { \ int mrc = pthread_cond_signal(cond); \ if(mrc != 0) { \ FATAL_ERROR(cond_signal_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_cond_init(cond, attr) \ { \ int mrc = pthread_cond_init(cond, attr); \ if(mrc != 0) { \ FATAL_ERROR(cond_init_failed, mrc, strerror(mrc)); \ } \ } #define my_pthread_cond_destroy(cond) \ { \ int mrc = pthread_cond_destroy(cond); \ if(mrc != 0) { \ FATAL_ERROR(cond_destroy_failed, mrc, strerror(mrc)); \ } \ } #endif /* OW_MT */ #endif /* OW_DEBUG_H */ owfs-2.8p15/module/ownet/c/src/include/ow.h0000664000175000017500000001307211026222116015461 00000000000000/* $Id: ow.h,v 1.7 2008/06/18 15:05:50 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 libownet: GPL v2 or MIT where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_H /* tedious wrapper */ #define OW_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif // Define this to avoid some VALGRIND warnings... (just for testing) // Warning: This will partially remove the multithreaded support since ow_net.c // will wait for a thread to complete before executing a new one. //#define VALGRIND 1 #define _FILE_OFFSET_BITS 64 #ifdef HAVE_FEATURES_H #include #endif /* HAVE_FEATURES_H */ #ifdef HAVE_FEATURE_TESTS_H #include #endif /* HAVE_FEATURE_TESTS_H */ #ifdef HAVE_SYS_STAT_H #include /* for stat */ #endif /* HAVE_SYS_STAT_H */ #ifdef HAVE_SYS_TYPES_H #include /* for stat */ #endif /* HAVE_SYS_TYPES_H */ #include /* for times */ #include #include #include #include #include #include #ifdef HAVE_STDINT_H #include /* for bit twiddling */ #if OW_CYGWIN #define _MSL_STDINT_H #endif /* OW_CYGWIN */ #endif /* HAVE_STDINT_H */ #include #include #ifndef __USE_XOPEN #define __USE_XOPEN /* for strptime fuction */ #include #undef __USE_XOPEN /* for strptime fuction */ #else /* __USE_XOPEN */ #include #endif /* __USE_XOPEN */ #include #include #include #ifdef HAVE_GETOPT_H #include /* for long options */ #endif /* HAVE_GETOPT_H */ #include #include /* for gettimeofday */ #ifdef HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #include /* addrinfo */ #ifdef HAVE_SYS_MKDEV_H #include /* for major() */ #endif /* HAVE_SYS_MKDEV_H */ /* Can't include search.h when compiling owperl on Fedora Core 1. */ #ifndef SKIP_SEARCH_H #ifndef __USE_GNU #define __USE_GNU #include #undef __USE_GNU #else /* __USE_GNU */ #include #endif /* __USE_GNU */ #endif /* SKIP_SEARCH_H */ /* Parport enabled uses two flags (one a holdover from the embedded work) */ #ifdef USE_NO_PARPORT #undef OW_PARPORT #endif /* USE_NO_PARPORT */ #if OW_ZERO /* Zeroconf / Bonjour */ #include "ow_dl.h" #include "ow_dnssd.h" #endif /* OW_ZERO */ /* Include some compatibility functions */ #include "compat.h" /* Debugging and error messages separated out for readability */ #include "ow_debug.h" #ifndef PATH_MAX #define PATH_MAX 2048 #endif /* Some errnos are not defined for MacOSX and gcc3.3 */ #ifndef EBADMSG #define EBADMSG ENOMSG #endif /* EBADMSG */ #ifndef EPROTO #define EPROTO EIO #endif /* EPROTO */ /* Define our understanding of integers, floats, ... */ #include "ow_localtypes.h" /* Directory blob (strings) separated out for readability */ #include "ow_charblob.h" /* Many mutexes separated out for readability */ #include "rwlock.h" #include "ow_mutexes.h" /* OW -- One Wire Globals variables -- each invokation will have it's own data */ /* Several different structures: device -- one for each type of 1-wire device filetype -- one for each type of file parsedname -- translates a path into usable form */ /* --------------------------------------------------------- */ /* Filetypes -- directory entries for each 1-wire chip found */ /* predeclare connection_in/out */ struct connection_in; /* Exposed connection info */ extern int count_inbound_connections; /* Maximum length of a file or directory name, and extension */ #define OW_NAME_MAX (32) #define OW_EXT_MAX (6) #define OW_FULLNAME_MAX (OW_NAME_MAX+OW_EXT_MAX) #define OW_DEFAULT_LENGTH (128) /* device display format */ enum deviceformat { fdi, fi, fdidc, fdic, fidc, fic }; /* Gobal temperature scale */ enum temp_type { temp_celsius, temp_fahrenheit, temp_kelvin, temp_rankine, }; void SetSignals(void); /* OWSERVER messages */ #include "ow_message.h" /* Globals information (for local control) */ /* Separated out into ow_global.h for readability */ #include "ow_global.h" /* Prototypes */ /* Separated out to ow_functions.h for clarity */ #include "ow_functions.h" #endif /* OW_H */ owfs-2.8p15/module/ownet/c/src/include/ow_message.h0000664000175000017500000000376611333400543017201 00000000000000/* $Id: ow_message.h,v 1.4 2010/02/06 23:55:15 alfille Exp $ Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* definitions and stuctures for the owserver messages */ /* This file doesn't stand alone, it must be included in ow.h */ #ifndef OW_MESSAGE_H /* tedious wrapper */ #define OW_MESSAGE_H /* Unique token for owserver loop checks */ union antiloop { struct { pid_t pid; clock_t clock; } simple; BYTE uuid[16]; }; /* Server (Socket-based) interface */ enum msg_classification { msg_error, msg_nop, msg_read, msg_write, msg_dir, msg_size, // No longer used, leave here to compatibility msg_presence, msg_dirall, msg_get, msg_dirallslash, msg_getslash, }; /* message to owserver */ struct server_msg { int32_t version; int32_t payload; int32_t type; int32_t sg; int32_t size; int32_t offset; }; /* message to client */ struct client_msg { int32_t version; int32_t payload; int32_t ret; int32_t sg; int32_t size; int32_t offset; }; struct serverpackage { const ASCII *path; BYTE *data; size_t datasize; BYTE *tokenstring; size_t tokens; }; #define Servermessage (((int32_t)1)<<16) #define isServermessage( version ) (((version)&Servermessage)!=0) #define Servertokens(version) ((version)&0xFFFF) #endif /* OW_MESSAGE_H */ owfs-2.8p15/module/ownet/c/src/include/Makefile.in0000664000175000017500000004037211756250030016741 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/c/src/include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(headerdir)" DATA = $(header_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ headerdir = ${prefix}/include header_DATA = ownetapi.h EXTRA_DIST = ${header_DATA} \ compat_getopt.h \ compat.h \ compat_netdb.h \ ow_charblob.h \ ow_connection.h \ ow_debug.h \ ow_dl.h \ ow_dnssd.h \ ow_functions.h \ ow_global.h \ ow.h \ ow_localtypes.h \ ow_message.h \ ow_mutexes.h \ ownetapi.h \ ow_server.h \ ow_stub.h \ rwlock.h \ sem.h 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 module/ownet/c/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/c/src/include/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-headerDATA: $(header_DATA) @$(NORMAL_INSTALL) test -z "$(headerdir)" || $(MKDIR_P) "$(DESTDIR)$(headerdir)" @list='$(header_DATA)'; test -n "$(headerdir)" || 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)$(headerdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(headerdir)" || exit $$?; \ done uninstall-headerDATA: @$(NORMAL_UNINSTALL) @list='$(header_DATA)'; test -n "$(headerdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(headerdir)'; $(am__uninstall_files_from_dir) 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 $(DATA) installdirs: for dir in "$(DESTDIR)$(headerdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-headerDATA 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: uninstall-headerDATA .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-headerDATA 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 uninstall-headerDATA clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/c/src/include/ow_localtypes.h0000664000175000017500000000710310750074146017731 00000000000000/* $Id: ow_localtypes.h,v 1.2 2008/01/30 13:15:18 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_LOCALTYPES_H /* tedious wrapper */ #define OW_LOCALTYPES_H #include /* Floating point */ /* I hate to do this, making everything a double */ /* The compiler complains mercilessly, however */ /* 1-wire really is low precision -- float is more than enough */ /* FLOAT and DATE collides with cygwin windows include-files. */ typedef double _FLOAT; typedef time_t _DATE; typedef unsigned char BYTE; typedef char ASCII; typedef unsigned int UINT; typedef int INT; #endif /* OW_LOCALTYPES_H */ owfs-2.8p15/module/ownet/c/src/include/ow_stub.h0000664000175000017500000000110610741440173016521 00000000000000/* $Id: ow_stub.h,v 1.1 2008/01/10 15:57:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_STUB_H #define OW_STUB_H // VT: NOTE: This file serves the only purpose: so it can be checked by the // packages that depend on this package. Other header files can't be used // because they demand presence of config.h, or, rather, defined CONFIG_H. #endif owfs-2.8p15/module/ownet/c/src/include/ow_functions.h0000664000175000017500000000726011371665546017600 00000000000000/* $Id: ow_functions.h,v 1.6 2010/05/10 02:11:50 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_FUNCTION_H /* tedious wrapper */ #define OW_FUNCTION_H void LockSetup(void); ssize_t tcp_read(int file_descriptor, void *vptr, size_t n, const struct timeval *ptv); void tcp_read_flush(int file_descriptor); int ClientAddr(char *sname, struct connection_in *in); int ClientConnect(struct connection_in *in); void FreeClientAddr(struct connection_in *in); int ARG_Net(const char *arg); int ARG_Generic(const char *arg); void BUS_lock_in(struct connection_in *in); void BUS_unlock_in(struct connection_in *in); #endif /* OW_FUNCTION_H */ owfs-2.8p15/module/ownet/c/src/include/ow_dl.h0000664000175000017500000000133210741440173016144 00000000000000/* $Id: ow_dl.h,v 1.1 2008/01/10 15:57:47 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 All the error and statistics counters are declared here, including handling macros */ #ifndef OW_DL_H #define OW_DL_H #include #include "owfs_config.h" #if OW_ZERO #if OW_CYGWIN #include typedef HMODULE DLHANDLE; #elif defined(HAVE_DLOPEN) #include typedef void *DLHANDLE; #endif /* OW_CYGWIN */ DLHANDLE DL_open(const char *pathname, int mode); void *DL_sym(DLHANDLE handle, const char *name); int DL_close(DLHANDLE handle); char *DL_error(void); #else /* OW_ZERO */ typedef void *DLHANDLE; #endif /* OW_ZERO */ extern DLHANDLE libdnssd; #endif owfs-2.8p15/module/ownet/c/src/include/ow_global.h0000664000175000017500000000561311025727337017021 00000000000000/* $Id: ow_global.h,v 1.4 2008/06/17 12:32:31 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* CAnn stand alone -- separated out of ow.h for clarity */ #ifndef OW_GLOBAL_H /* tedious wrapper */ #define OW_GLOBAL_H /* Globals information (for local control) */ struct global { #if OW_ZERO DNSServiceRef browse; #endif ASCII *progname; union antiloop Token; int now_background; int error_level; int error_print; int readonly; }; extern struct global Globals; #endif /* OW_GLOBAL_H */ owfs-2.8p15/module/ownet/c/src/include/ow_server.h0000664000175000017500000000501111170511225017043 00000000000000/* $Id: ow_server.h,v 1.6 2009/04/13 01:17:09 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License. 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. */ #ifndef OW_SERVER_H /* tedious wrapper */ #define OW_SERVER_H #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" struct request_packet { struct connection_in *owserver; const ASCII *path; unsigned char *read_value; const unsigned char *write_value; size_t data_length; off_t data_offset; int error_code; int tokens; /* for anti-loop work */ BYTE *tokenstring; /* List of tokens from owservers passed */ }; extern struct ow_global { uint32_t sg; int timeout_network; int timeout_server; int autoserver; } ow_Global; #define SHOULD_RETURN_BUS_LIST ( (UINT) 0x00000002 ) #define PERSISTENT_MASK ( (UINT) 0x00000004 ) #define PERSISTENT_BIT 2 #define ALIAS_REQUEST ( (UINT) 0x00000008 ) #define TEMPSCALE_MASK ( (UINT) 0x00FF0000 ) #define TEMPSCALE_BIT 16 #define DEVFORMAT_MASK ( (UINT) 0xFF000000 ) #define DEVFORMAT_BIT 24 #define IsPersistent ( ow_Global.sg & PERSISTENT_MASK ) #define SetPersistent(b) UT_Setbit(ow_Global.sg,PERSISTENT_BIT,(b)) #define TemperatureScale ( (enum temp_type) ((ow_Global.sg & TEMPSCALE_MASK) >> TEMPSCALE_BIT) ) #define SGTemperatureScale(sg) ( (enum temp_type)(((sg) & TEMPSCALE_MASK) >> TEMPSCALE_BIT) ) #define DeviceFormat ( (enum deviceformat) ((ow_Global.sg & DEVFORMAT_MASK) >> DEVFORMAT_BIT) ) #define set_semiglobal(s, mask, bit, val) do { *(s) = (*(s) & ~(mask)) | ((val)< #include "owfs_config.h" #ifdef HAVE_FEATURES_H #include #endif #include "compat_netdb.h" #include "compat_getopt.h" #ifndef HAVE_STRSEP char *strsep(char **stringp, const char *delim); #endif #if defined(__UCLIBC__) #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) <= 0x000913) #undef HAVE_TDESTROY #else /* Older than 0.9.19 */ #define HAVE_TDESTROY 1 #endif /* Older than 0.9.19 */ #else #endif /* __UCLIBC__ */ #ifndef HAVE_TDESTROY void tdestroy(void *vroot, void (*freefct) (void *)); #endif #ifndef __COMPAR_FN_T # define __COMPAR_FN_T typedef int (*__compar_fn_t) (__const void *, __const void *); #endif #ifndef HAVE_TSEARCH void *tsearch(__const void *__key, void **__rootp, __compar_fn_t __compar); #endif #ifndef HAVE_TFIND void *tfind(__const void *__key, void *__const * __rootp, __compar_fn_t __compar); #endif #ifndef HAVE_TDELETE void *tdelete(__const void *__restrict __key, void **__restrict __rootp, __compar_fn_t __compar); #endif #if defined(_SEARCH_H) || defined(_SEARCH_H_) /* VISIT is always defined in search.h on MacOSX. */ #else typedef enum { preorder, postorder, endorder, leaf } VISIT; #endif /* SEARCH_H */ #ifndef __ACTION_FN_T # define __ACTION_FN_T typedef void (*__action_fn_t) (__const void *__nodep, VISIT __value, int __level); #endif #ifndef HAVE_TWALK void twalk(__const void *__root, __action_fn_t __action); #endif #ifdef __UCLIBC__ #if defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) && defined(__UCLIBC_SUBLEVEL__) #if ((__UCLIBC_MAJOR__<<16) + (__UCLIBC_MINOR__<<8) + (__UCLIBC_SUBLEVEL__)) <= 0x000913 /* Since syslog will hang forever with uClibc-0.9.19 if syslogd is not * running, then we don't use it unless we really wants it * WRT45G usually have syslogd running. uClinux-dist might not have it. */ #ifndef USE_SYSLOG #define syslog(a,...) { /* ignore_syslog */ } #define openlog(a,...) { /* ignore_openlog */ } #define closelog() { /* ignore_closelog */ } #endif #endif /* __UCLIBC__ */ #endif /* __UCLIBC__ */ #endif /* __UCLIBC__ */ #endif owfs-2.8p15/module/ownet/c/src/c/0000775000175000017500000000000011756315510013552 500000000000000owfs-2.8p15/module/ownet/c/src/c/ow_net_client.c0000664000175000017500000000617410750074146016477 00000000000000/* $Id: ow_net_client.c,v 1.3 2008/01/30 13:15:18 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" int ClientAddr(char *sname, struct connection_in *in) { struct addrinfo hint; char *p; int ret; if (sname == NULL || sname[0] == '\0') { sname = "4304"; } if ((p = strrchr(sname, ':'))) { /* : exists */ p[0] = '\0'; /* Separate tokens in the string */ in->connin.tcp.host = strdup(sname); in->connin.tcp.service = strdup(&p[1]); p[0] = ':'; /* restore name string */ } else { #if OW_CYGWIN in->connin.tcp.host = strdup("127.0.0.1"); #else in->connin.tcp.host = NULL; #endif in->connin.tcp.service = strdup(sname); } memset(&hint, 0, sizeof(struct addrinfo)); hint.ai_socktype = SOCK_STREAM; #if OW_CYGWIN hint.ai_family = AF_INET; #else hint.ai_family = AF_UNSPEC; #endif //printf("ClientAddr: [%s] [%s]\n", in->connin.tcp.host, in->connin.tcp.service); if ((ret = getaddrinfo(in->connin.tcp.host, in->connin.tcp.service, &hint, &in->connin.tcp.ai))) { LEVEL_CONNECT("GetAddrInfo error %s\n", gai_strerror(ret)); return -1; } return 0; } void FreeClientAddr(struct connection_in *in) { if (in->connin.tcp.host) { free(in->connin.tcp.host); in->connin.tcp.host = NULL; } if (in->connin.tcp.service) { free(in->connin.tcp.service); in->connin.tcp.service = NULL; } if (in->connin.tcp.ai) { freeaddrinfo(in->connin.tcp.ai); in->connin.tcp.ai = NULL; } } /* Usually called with BUS locked, to protect ai settings */ int ClientConnect(struct connection_in *in) { int file_descriptor; struct addrinfo *ai; if (in->connin.tcp.ai == NULL) { LEVEL_DEBUG("Client address not yet parsed\n"); return -1; } /* Can't change ai_ok without locking the in-device. * First try the last working address info, if it fails lock * the in-device and loop through the list until it works. * Not a perfect solution, but it should work at least. */ ai = in->connin.tcp.ai_ok; if (ai) { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (file_descriptor >= 0) { if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) return file_descriptor; close(file_descriptor); } } ai = in->connin.tcp.ai; // loop from first address info since it failed. do { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (file_descriptor >= 0) { if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) { in->connin.tcp.ai_ok = ai; return file_descriptor; } close(file_descriptor); } } while ((ai = ai->ai_next)); in->connin.tcp.ai_ok = NULL; ERROR_CONNECT("ClientConnect: Socket problem\n"); return -1; } owfs-2.8p15/module/ownet/c/src/c/ow_connect.c0000664000175000017500000000631511131344774016002 00000000000000/* $Id: ow_connect.c,v 1.9 2009/01/08 09:40:12 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" /* Routines for handling a linked list of connections in and out */ /* typical connection in would be the serial port or USB */ /* Globals */ struct connection_in *head_inbound_list = NULL; int count_inbound_connections = 0; struct connection_in *find_connection_in(OWNET_HANDLE handle) { struct connection_in *c_in; struct connection_in *c_ret = NULL; // step through head_inbound_list linked list for (c_in = head_inbound_list; c_in != NULL; c_in = c_in->next) { if (c_in->index == handle) { if (c_in->state == connection_active) { c_ret = c_in; } break; } } return c_ret; } enum bus_mode get_busmode(struct connection_in *in) { if (in == NULL) return bus_unknown; return in->busmode; } int BusIsServer(struct connection_in *in) { return (in->busmode == bus_server) || (in->busmode == bus_zero); } /* Make a new head_inbound_list, and place it in the chain */ /* Based on a shallow copy of "in" if not NULL */ struct connection_in *NewIn(void) { struct connection_in *now; // step through head_inbound_list linked list for (now = head_inbound_list; now != NULL; now = now->next) { if (now->state == connection_vacant) { #if OW_MT my_pthread_mutex_init(&(now->bus_mutex), Mutex.pmattr); #endif /* OW_MT */ now->state = connection_pending; return now; } } now = malloc(sizeof(struct connection_in)); if (now != NULL) { memset(now, 0, sizeof(struct connection_in)); now->next = head_inbound_list; /* put in linked list at start */ head_inbound_list = now; now->index = count_inbound_connections++; now->state = connection_pending; #if OW_MT my_pthread_mutex_init(&(now->bus_mutex), Mutex.pmattr); #endif /* OW_MT */ } return now; } void FreeIn(struct connection_in *target) { if (target == NULL) { return; } switch (target->state) { case connection_vacant: break; case connection_pending: if (target->name) { free(target->name); target->name = NULL; } break; case connection_active: switch (get_busmode(target)) { case bus_zero: if (target->connin.tcp.type) free(target->connin.tcp.type); if (target->connin.tcp.domain) free(target->connin.tcp.domain); if (target->connin.tcp.fqdn) free(target->connin.tcp.fqdn); // fall through case bus_server: LEVEL_DEBUG("FreeClientAddr\n"); FreeClientAddr(target); break; default: break; } if (target->name) { free(target->name); target->name = NULL; } #if OW_MT my_pthread_mutex_destroy(&(target->bus_mutex)); #endif } target->state = connection_vacant; } void FreeInAll( void ) { struct connection_in *next ; while ( head_inbound_list ) { next = head_inbound_list->next; //LEVEL_DEBUG("FreeInAll: %p next=%p\n", Inbound_Control.head, Inbound_Control.head->next); FreeIn(head_inbound_list); free(head_inbound_list); head_inbound_list = next; } } owfs-2.8p15/module/ownet/c/src/c/getopt.c0000664000175000017500000005543010750074145015146 00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * Modified for uClibc by Manuel Novoa III on 1/5/01. * Modified once again for uClibc by Erik Andersen 8/7/02 */ #include #include "owfs_config.h" #include "compat_getopt.h" #include "ow.h" // only for UINT #ifndef HAVE_GETOPT_LONG #include #include #include #include #undef _ #define _(X) X /* Treat '-W foo' the same as the long option '--foo', * disabled for the moment since it costs about 2k... */ #undef SPECIAL_TREATMENT_FOR_W /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ extern int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only); /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ static int __getopt_initialized; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; # include # define my_index strchr /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char *_getopt_initialize(int argc, char *const *argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize(argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp(argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind] [1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == (UINT) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { if (argv[optind - 1][1] == '-') { /* --option */ fprintf(stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); } else { /* +option or -option */ fprintf(stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } } nextchar += strlen(nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) { if (print_errors) { if (argv[optind][1] == '-') { /* --option */ fprintf(stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); } else { /* +option or -option */ fprintf(stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index(optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: illegal option -- %c\n"), argv[0], c); } optopt = c; return '?'; } #ifdef SPECIAL_TREATMENT_FOR_W /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { fprintf(stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); } nextchar += strlen(nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } #endif if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 1); } #endif /* HAVE_GETOPT_LONG */ #ifndef HAVE_GETOPT int getopt(int argc, char *const *argv, const char *optstring) { return _getopt_internal(argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* HAVE_GETOPT */ owfs-2.8p15/module/ownet/c/src/c/ownet_dir.c0000664000175000017500000000367511331451067015640 00000000000000/* $Id: ownet_dir.c,v 1.10 2010/02/01 04:01:59 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" static void dirlist_callback(void *v, const char *data_element) { struct charblob *cb = v; CharblobAdd(data_element, strlen(data_element), cb); } int OWNET_dirlist(OWNET_HANDLE h, const char *onewire_path, char **return_string) { struct charblob s_charblob; struct charblob *cb = &s_charblob; int return_value; struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; CharblobInit(cb); if (ServerDir(dirlist_callback, cb, rp) < 0) { CharblobClear(cb); return_value = -EINVAL; } else { return_string[0] = CharblobData(cb); return_value = CharblobLength(cb); } CONNIN_RUNLOCK; return return_value; } int OWNET_dirprocess(OWNET_HANDLE h, const char *onewire_path, void (*dirfunc) (void *passed_on_value, const char *directory_element), void *passed_on_value) { struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; int return_value; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; return_value = ServerDir(dirfunc, passed_on_value, rp); CONNIN_RUNLOCK; return return_value; } owfs-2.8p15/module/ownet/c/src/c/ow_browse.c0000664000175000017500000001454511422077656015663 00000000000000/* $Id: ow_browse.c,v 1.9 2010/07/22 17:28:14 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #if OW_ZERO #if OW_MT #include "ow_connection.h" struct RefStruct { DNSServiceRef sref; }; struct BrowseStruct { char *name; char *type; char *domain; }; static struct connection_in *FindIn(struct BrowseStruct *bs); static struct BrowseStruct *BSCreate(const char *name, const char *type, const char *domain); static void BSKill(struct BrowseStruct *bs); static void *Process(void *v); static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const char *t, void *c); static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context); /* Look for new services with Bonjour -- will block so done in a separate thread */ static void *Process(void *v) { struct RefStruct *rs = v; pthread_detach(pthread_self()); while (DNSServiceProcessResult(rs->sref) == kDNSServiceErr_NoError) { //printf("DNSServiceProcessResult ref %ld\n",(long int)rs->sref) ; continue; } DNSServiceRefDeallocate(rs->sref); free(rs); LEVEL_DEBUG("Browse: Normal exit.\n"); return NULL; } static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const char *t, void *c) { ASCII name[121]; struct BrowseStruct *bs = c; struct connection_in *in; (void) tl; (void) t; //printf("ResolveBack ref=%ld flags=%d index=%d, error=%d name=%s host=%s port=%d\n",(long int)s,f,i,e,name,host,ntohs(port)) ; //printf("ResolveBack ref=%ld flags=%d index=%d, error=%d name=%s type=%s domain=%s\n",(long int)s,f,i,e,bs->name,bs->type,bs->domain) ; LEVEL_DETAIL("ResolveBack ref=%d flags=%d index=%d, error=%d name=%s host=%s port=%d\n", (long int) s, f, i, e, n, host, ntohs(port)); /* remove trailing .local. */ if (snprintf(name, 120, "%s:%d", SAFESTRING(host), ntohs(port)) < 0) { ERROR_CONNECT("Trouble with zeroconf resolve return %s\n", n); } else { if ((in = FindIn(bs)) == NULL) { // new or old connection_in slot? if ((in = NewIn())) { BUSLOCKIN(in); in->name = strdup(name); in->busmode = bus_server; } } if (in) { if (Zero_detect(in)) { //BadAdapter_detect(in); printf("Zero_detect failed\n"); exit(1); } else { in->connin.tcp.type = strdup(bs->type); in->connin.tcp.domain = strdup(bs->domain); in->connin.tcp.fqdn = strdup(n); } BUSUNLOCKIN(in); } } BSKill(bs); } static struct BrowseStruct *BSCreate(const char *name, const char *type, const char *domain) { struct BrowseStruct *bs = malloc(sizeof(struct BrowseStruct)); if (bs) { bs->name = name ? strdup(name) : NULL; bs->type = type ? strdup(type) : NULL; bs->domain = domain ? strdup(domain) : NULL; } return bs; } static void BSKill(struct BrowseStruct *bs) { if (bs) { if (bs->name) free(bs->name); if (bs->type) free(bs->type); if (bs->domain) free(bs->domain); free(bs); } } static struct connection_in *FindIn(struct BrowseStruct *bs) { struct connection_in *now; for (now = head_inbound_list; now; now = now->next) { if (now->busmode != bus_zero || strcasecmp(now->name, bs->name) || strcasecmp(now->connin.tcp.type, bs->type) || strcasecmp(now->connin.tcp.domain, bs->domain) ) continue; BUSLOCKIN(now); break; } return now; } /* Sent back from Bounjour -- arbitrarily use it to set the Ref for Deallocation */ static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context) { (void) context; //printf("BrowseBack ref=%ld flags=%d index=%d, error=%d name=%s type=%s domain=%s\n",(long int)s,f,i,e,name,type,domain) ; LEVEL_DETAIL("BrowseBack ref=%ld flags=%d index=%d, error=%d name=%s type=%s domain=%s\n", (long int) s, f, i, e, name, type, domain); if (e == kDNSServiceErr_NoError) { struct BrowseStruct *bs = BSCreate(name, type, domain); CONNIN_WLOCK; if (bs) { struct connection_in *in = FindIn(bs); if (in) { FreeClientAddr(in); BUSUNLOCKIN(in); } if (f & kDNSServiceFlagsAdd) { // Add DNSServiceRef sr; if (DNSServiceResolve(&sr, 0, 0, name, type, domain, ResolveBack, bs) == kDNSServiceErr_NoError) { int file_descriptor = DNSServiceRefSockFD(sr); DNSServiceErrorType err = kDNSServiceErr_Unknown; if (file_descriptor >= 0) { while (1) { fd_set readfd; struct timeval tv = { 120, 0 }; FD_ZERO(&readfd); FD_SET(file_descriptor, &readfd); if (select(file_descriptor + 1, &readfd, NULL, NULL, &tv) > 0) { if (FD_ISSET(file_descriptor, &readfd)) { err = DNSServiceProcessResult(sr); } } else if (errno == EINTR) { continue; } else { ERROR_CONNECT("Resolve timeout error for %s\n", name); } break; } } DNSServiceRefDeallocate(sr); if (err == kDNSServiceErr_NoError) return; } } BSKill(bs); } CONNIN_WUNLOCK; } return; } void OW_Browse(void) { struct RefStruct *rs; DNSServiceErrorType dnserr; if ((rs = malloc(sizeof(struct RefStruct))) == NULL) return; dnserr = DNSServiceBrowse(&Globals.browse, 0, 0, "_owserver._tcp", NULL, BrowseBack, NULL); rs->sref = Globals.browse; if (dnserr == kDNSServiceErr_NoError) { pthread_t thread; int err; //printf("Browse %ld %s|%s|%s\n",(long int)Globals.browse,"","_owserver._tcp","") ; err = pthread_create(&thread, 0, Process, (void *) rs); if (err) { ERROR_CONNECT("Zeroconf/Bounjour browsing thread error %d).\n", err); } } else { LEVEL_CONNECT("DNSServiceBrowse error = %d\n", dnserr); } } #else /* OW_MT */ void OW_Browse(void) { LEVEL_CONNECT("Zeroconf/Bonjour requires multithreading support (a compile-time configuration setting).\n"); } #endif /* OW_MT */ #else /* OW_ZERO */ void OW_Browse(void) { LEVEL_CONNECT("OWFS is compiled without Zeroconf/Bonjour support.\n"); } #endif /* OW_ZERO */ owfs-2.8p15/module/ownet/c/src/c/ownet_init.c0000664000175000017500000000256011026222116016005 00000000000000/* $Id: ownet_init.c,v 1.7 2008/06/18 15:05:50 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" OWNET_HANDLE OWNET_init(const char *owserver_tcp_address_and_port) { OWNET_HANDLE handle; struct connection_in *slot_found; static int deja_vue = 0; // poor mans lock for the Lib Setup and Lock Setup if (++deja_vue == 1) { /* Setup the multithreading synchronizing locks */ LockSetup(); } CONNIN_WLOCK; slot_found = NewIn(); // Could we create or reclaim a slot? if (slot_found == NULL) { handle = -ENOMEM; } else { if (owserver_tcp_address_and_port == NULL || owserver_tcp_address_and_port[0] == '\0') { slot_found->name = strdup("4304"); } else { slot_found->name = strdup(owserver_tcp_address_and_port); } slot_found->busmode = bus_server; if (Server_detect(slot_found) == 0) { slot_found->state = connection_active; handle = slot_found->index; } else { FreeIn(slot_found); handle = -EADDRNOTAVAIL; } } CONNIN_WUNLOCK; return handle; } owfs-2.8p15/module/ownet/c/src/c/Makefile.in0000664000175000017500000005751111756250030015543 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.12 2010/02/09 21:19:14 alfille Exp $ 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@ target_triplet = @target@ subdir = module/ownet/c/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libownet_la_LIBADD = am__objects_1 = compat.lo error.lo getaddrinfo.lo getopt.lo globals.lo \ ow_browse.lo ow_charblob.lo ow_connect.lo ow_dl.lo ow_dnssd.lo \ ow_locks.lo ow_net_client.lo ownet_close.lo ownet_dir.lo \ ownet_init.lo ownet_read.lo ownet_present.lo ownet_setget.lo \ ownet_write.lo ow_rwlock.lo ow_server.lo ow_tcp_read.lo am_libownet_la_OBJECTS = $(am__objects_1) libownet_la_OBJECTS = $(am_libownet_la_OBJECTS) libownet_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libownet_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libownet_la_SOURCES) DIST_SOURCES = $(libownet_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBOWNET_SOURCE = \ compat.c \ error.c \ getaddrinfo.c \ getopt.c \ globals.c \ ow_browse.c \ ow_charblob.c \ ow_connect.c \ ow_dl.c \ ow_dnssd.c \ ow_locks.c \ ow_net_client.c \ ownet_close.c \ ownet_dir.c \ ownet_init.c \ ownet_read.c \ ownet_present.c \ ownet_setget.c \ ownet_write.c \ ow_rwlock.c \ ow_server.c \ ow_tcp_read.c lib_LTLIBRARIES = libownet.la libownet_la_SOURCES = ${LIBOWNET_SOURCE} @HAVE_CYGWIN_FALSE@libownet_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so @HAVE_CYGWIN_TRUE@libownet_la_LDFLAGS = ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -no-undefined # Maybe need this for MacOS X #if HAVE_DARWIN #LDADDS = -framework IOKit -framework CoreFoundation #endif #libow_la_LDFLAGS = -shared -shrext .so \ # -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ # -release $(LT_RELEASE) \ # -export-dynamic \ # $(LDADDS) AM_CFLAGS = -I../include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${PIC_FLAGS} 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 module/ownet/c/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/c/src/c/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 libownet.la: $(libownet_la_OBJECTS) $(libownet_la_DEPENDENCIES) $(EXTRA_libownet_la_DEPENDENCIES) $(libownet_la_LINK) -rpath $(libdir) $(libownet_la_OBJECTS) $(libownet_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_browse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_charblob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_connect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dnssd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_locks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_net_client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_rwlock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tcp_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_close.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_dir.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_present.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_setget.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ownet_write.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-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-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-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-libLTLIBRARIES clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/c/src/c/ownet_close.c0000664000175000017500000000222711131152075016152 00000000000000/* $Id: ownet_close.c,v 1.6 2009/01/07 16:11:41 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" /* void OWNET_close( OWNET_HANDLE h) close a particular owserver connection */ void OWNET_close(OWNET_HANDLE h) { CONNIN_WLOCK; FreeIn(find_connection_in(h)); CONNIN_WUNLOCK; } /* void OWNET_closeall( void ) close all owserver connections */ void OWNET_closeall(void) { struct connection_in *target; CONNIN_WLOCK; // step through head_inbound_list linked list for (target = head_inbound_list; target != NULL; target = target->next) { FreeIn(target); } CONNIN_WUNLOCK; } /* void OWNET_finish( void ) close all owserver connections and free all memory */ void OWNET_finish(void) { CONNIN_WLOCK; FreeInAll(); head_inbound_list = NULL; CONNIN_WUNLOCK; } owfs-2.8p15/module/ownet/c/src/c/ow_locks.c0000664000175000017500000000515611130410176015453 00000000000000/* $Id: ow_locks.c,v 1.7 2009/01/05 13:51:58 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* locks are to handle multithreading */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" /* ------- Globalss ----------- */ #ifdef __UCLIBC__ #if OW_MT #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) < 0x00091D) /* If uClibc < 0.9.29, then re-initialize internal pthread-structs */ extern char *__pthread_initial_thread_bos; void __pthread_initialize(void); #endif /* UCLIBC_VERSION */ #endif /* OW_MT */ #endif /* __UCLIBC */ struct mutexes Mutex = { #if OW_MT #ifdef __UCLIBC__ /* vsnprintf() doesn't seem to be thread-safe in uClibc even if thread-support is enabled. */ .uclibc_mutex = PTHREAD_MUTEX_INITIALIZER, #endif /* __UCLIBC__ */ /* mutex attribute -- needed for uClibc programming */ /* we create at start, and destroy at end */ .pmattr = NULL, #endif /* OW_MT */ }; /* Essentially sets up mutexes to protect global data/devices */ void LockSetup(void) { #ifdef __UCLIBC__ #if OW_MT #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) < 0x00091D) /* If uClibc < 0.9.29, then re-initialize internal pthread-structs * pthread and mutexes doesn't work after daemon() is called and * the main-process is gone. * * This workaround will probably be fixed in uClibc-0.9.28 * Other uClibc developers have noticed similar problems which are * trigged when pthread functions are used in shared libraries. */ __pthread_initial_thread_bos = NULL; __pthread_initialize(); #endif /* UCLIBC_VERSION */ /* global mutex attribute */ my_pthread_mutexattr_init(&Mutex.mattr); my_pthread_mutexattr_settype(&Mutex.mattr, PTHREAD_MUTEX_ADAPTIVE_NP); Mutex.pmattr = &Mutex.mattr; #endif /* OW_MT */ #endif /* __UCLIBC */ #if OW_MT my_rwlock_init(&Mutex.lib); my_rwlock_init(&Mutex.connin); #ifdef __UCLIBC__ my_pthread_mutex_init(&Mutex.uclibc_mutex, Mutex.pmattr); #endif /* UCLIBC */ #endif /* OW_MT */ } void BUS_lock_in(struct connection_in *in) { //printf("BUS_lock_in: in=%p\n", in); if (!in) return; #if OW_MT my_pthread_mutex_lock(&(in->bus_mutex)); #endif /* OW_MT */ } void BUS_unlock_in(struct connection_in *in) { //printf("BUS_unlock_in: in=%p\n", in); if (!in) return; #if OW_MT my_pthread_mutex_unlock(&(in->bus_mutex)); #endif /* OW_MT */ } owfs-2.8p15/module/ownet/c/src/c/ow_server.c0000664000175000017500000004574411535564273015676 00000000000000/* $Id: ow_server.c,v 1.8 2011/03/09 02:40:59 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include #include "owfs_config.h" #include "ow.h" #include "ow_server.h" static int FromServer(int file_descriptor, struct client_msg *cm, char *msg, size_t size); static void *FromServerAlloc(int file_descriptor, struct client_msg *cm); static int ToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp); static void Server_setroutines(struct interface_routines *f); static void Zero_setroutines(struct interface_routines *f); static void Server_close(struct connection_in *in); static uint32_t SetupSemi(int persistent); static int ConnectToServer(struct connection_in *in); static int ToServerTwice(int file_descriptor, int persistent, struct server_msg *sm, struct serverpackage *sp, struct connection_in *in); static int PersistentStart(int *persistent, struct connection_in *in); static void PersistentEnd(int file_descriptor, int persistent, int granted, struct connection_in *in); static void PersistentFree(int file_descriptor, struct connection_in *in); static void PersistentClear(int file_descriptor, struct connection_in *in); static int PersistentRequest(struct connection_in *in); static int PersistentReRequest(int file_descriptor, struct connection_in *in); static int ServerDIR(void (*dirfunc) (void *, const char *), void *v, struct request_packet *rp); static int ServerDIRALL(void (*dirfunc) (void *, const char *), void *v, struct request_packet *rp); static void Server_setroutines(struct interface_routines *f) { f->detect = Server_detect; f->close = Server_close; } static void Zero_setroutines(struct interface_routines *f) { f->detect = Server_detect; f->close = Server_close; } // bus_zero is a server found by zeroconf/Bonjour // It differs in that the server must respond int Zero_detect(struct connection_in *in) { // if ( Server_detect(in) || ServerNOP(in) ) // if ( ServerNOP(in) ) return -1 ; if (in->name == NULL) return -1; if (ClientAddr(in->name, in)) return -1; in->file_descriptor = FD_PERSISTENT_NONE; // No persistent connection yet in->Adapter = adapter_tcp; in->adapter_name = "tcp"; in->busmode = bus_zero; Zero_setroutines(&(in->iroutines)); return 0; } // Set up inbound connection to an owserver // Actual tcp connection created as needed int Server_detect(struct connection_in *in) { if (in->name == NULL) return -1; if (ClientAddr(in->name, in)) return -1; in->file_descriptor = FD_PERSISTENT_NONE; // No persistent connection yet in->Adapter = adapter_tcp; in->adapter_name = "tcp"; in->busmode = bus_server; Server_setroutines(&(in->iroutines)); return 0; } // Free up the owserver inbound connection // actual connections opened and closed independently static void Server_close(struct connection_in *in) { if (in->file_descriptor > FD_PERSISTENT_NONE) { // persistent connection close(in->file_descriptor); in->file_descriptor = FD_PERSISTENT_NONE; } FreeClientAddr(in); } // Send to an owserver using the READ message int ServerRead(struct request_packet *rp) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { rp->path, NULL, 0, rp->tokenstring, rp->tokens, }; int persistent = 1; int connectfd; int ret = 0; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_read; sm.size = rp->data_length; sm.offset = rp->data_offset; LEVEL_CALL("SERVER READ path=%s\n", SAFESTRING(rp->path)); connectfd = PersistentStart(&persistent, rp->owserver); if (connectfd > FD_CURRENT_BAD) { sm.sg = SetupSemi(persistent); if ((connectfd = ToServerTwice(connectfd, persistent, &sm, &sp, rp->owserver)) < 0) { ret = -EIO; } else if (FromServer(connectfd, &cm, (ASCII *) rp->read_value, rp->data_length) < 0) { ret = -EIO; } else { ret = cm.ret; } } else { ret = -EIO; } PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return ret; } // Send to an owserver using the PRESENT message int ServerPresence(struct request_packet *rp) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { rp->path, NULL, 0, rp->tokenstring, rp->tokens, }; int persistent = 1; int connectfd; int ret = 0; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_presence; LEVEL_CALL("SERVER PRESENCE path=%s\n", SAFESTRING(rp->path)); connectfd = PersistentStart(&persistent, rp->owserver); if (connectfd > FD_CURRENT_BAD) { sm.sg = SetupSemi(persistent); if ((connectfd = ToServerTwice(connectfd, persistent, &sm, &sp, rp->owserver)) < 0) { ret = -EIO; } else if (FromServer(connectfd, &cm, NULL, 0) < 0) { ret = -EIO; } else { ret = cm.ret; } } else { ret = -EIO; } PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return ret; } // Send to an owserver using the WRITE message int ServerWrite(struct request_packet *rp) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { rp->path, (BYTE *) rp->write_value, rp->data_length, rp->tokenstring, rp->tokens, }; int persistent = 1; int connectfd; int ret = 0; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_write; sm.size = rp->data_length; sm.offset = rp->data_offset; LEVEL_CALL("SERVER WRITE path=%s\n", SAFESTRING(rp->path)); connectfd = PersistentStart(&persistent, rp->owserver); if (connectfd > FD_CURRENT_BAD) { sm.sg = SetupSemi(persistent); if ((connectfd = ToServerTwice(connectfd, persistent, &sm, &sp, rp->owserver)) < 0) { ret = -EIO; } else if (FromServer(connectfd, &cm, NULL, 0) < 0) { ret = -EIO; } else { uint32_t sg = cm.sg & ~(SHOULD_RETURN_BUS_LIST | PERSISTENT_MASK); ret = cm.ret; if (ow_Global.sg != sg) { //printf("ServerRead: cm.sg changed! SemiGlobal=%X cm.sg=%X\n", SemiGlobal, cm.sg); ow_Global.sg = sg; } } } else { ret = -EIO; } PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return ret; } // Send to an owserver using either the DIR or DIRALL message int ServerDir(void (*dirfunc) (void *, const char *), void *v, struct request_packet *rp) { int ret; // Do we know this server doesn't support DIRALL? if (rp->owserver->connin.tcp.no_dirall) { return ServerDIR(dirfunc, v, rp); } // try DIRALL and see if supported if ((ret = ServerDIRALL(dirfunc, v, rp)) == -ENOMSG) { rp->owserver->connin.tcp.no_dirall = 1; return ServerDIR(dirfunc, v, rp); } return ret; } // Send to an owserver using the DIR message static int ServerDIR(void (*dirfunc) (void *, const char *), void *v, struct request_packet *rp) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { rp->path, NULL, 0, rp->tokenstring, rp->tokens, }; int persistent = 1; int connectfd; int ret; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_dir; LEVEL_CALL("SERVER DIR path=%s\n", SAFESTRING(rp->path)); connectfd = PersistentStart(&persistent, rp->owserver); if (connectfd > FD_CURRENT_BAD) { sm.sg = SetupSemi(persistent); if ((connectfd = ToServerTwice(connectfd, persistent, &sm, &sp, rp->owserver)) < 0) { ret = -EIO; } else { char *return_path; while ((return_path = FromServerAlloc(connectfd, &cm))) { return_path[cm.payload - 1] = '\0'; /* Ensure trailing null */ LEVEL_DEBUG("ServerDir: got=[%s]\n", return_path); dirfunc(v, return_path); free(return_path); } ret = cm.ret; } } else { ret = -EIO; } PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return ret; } // Send to an owserver using the DIRALL message static int ServerDIRALL(void (*dirfunc) (void *, const char *), void *v, struct request_packet *rp) { ASCII *comma_separated_list; struct server_msg sm; struct client_msg cm; struct serverpackage sp = { rp->path, NULL, 0, rp->tokenstring, rp->tokens, }; int persistent = 1; int connectfd; int ret; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_dirall; LEVEL_CALL("SERVER DIRALL path=%s\n", SAFESTRING(rp->path)); // Get a file descriptor, possibly a persistent one connectfd = PersistentStart(&persistent, rp->owserver); if (connectfd < 0) { PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return -EIO; } // Now try to get header. If fails, may need a new non-persistent file_descriptor sm.sg = SetupSemi(persistent); connectfd = ToServerTwice(connectfd, persistent, &sm, &sp, rp->owserver); if (connectfd < 0) { PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return -EIO; } // Success, get data comma_separated_list = FromServerAlloc(connectfd, &cm); LEVEL_DEBUG("DIRALL got %s\n", SAFESTRING(comma_separated_list)); if (cm.ret == 0) { ASCII *current_file; ASCII *rest_of_comma_list = comma_separated_list; LEVEL_DEBUG("DIRALL start parsing\n"); while ((current_file = strsep(&rest_of_comma_list, ",")) != NULL) { LEVEL_DEBUG("ServerDirall: got=[%s]\n", current_file); dirfunc(v, current_file); } } // free the allocated memory if (comma_separated_list != NULL) { free(comma_separated_list); } ret = cm.ret; PersistentEnd(connectfd, persistent, cm.sg & PERSISTENT_MASK, rp->owserver); return ret; } /* read from server, free return pointer if not Null */ /* Adds an extra null byte at end */ static void *FromServerAlloc(int file_descriptor, struct client_msg *cm) { char *msg; int ret; struct timeval tv = { ow_Global.timeout_network + 1, 0, }; do { /* loop until non delay message (payload>=0) */ //printf("OW_SERVER loop1\n"); ret = tcp_read(file_descriptor, cm, sizeof(struct client_msg), &tv); if (ret != sizeof(struct client_msg)) { memset(cm, 0, sizeof(struct client_msg)); cm->ret = -EIO; return NULL; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->sg = ntohl(cm->sg); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); //printf("OW_SERVER loop1 done\n"); //printf("FromServerAlloc payload=%d size=%d ret=%d sg=%X offset=%d\n",cm->payload,cm->size,cm->ret,cm->sg,cm->offset); //printf(">%.4d|%.4d\n",cm->ret,cm->payload); if (cm->payload == 0) return NULL; if (cm->ret < 0) return NULL; if (cm->payload > MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE) { //printf("FromServerAlloc payload too large\n"); return NULL; } if ((msg = (char *) malloc((size_t) cm->payload + 1))) { ret = tcp_read(file_descriptor, msg, (size_t) (cm->payload), &tv); if (ret != cm->payload) { //printf("FromServer couldn't read payload\n"); cm->payload = 0; cm->offset = 0; cm->ret = -EIO; free(msg); msg = NULL; } //printf("FromServer payload read ok\n"); } msg[cm->payload] = '\0'; // safety NULL return msg; } /* Read from server -- return negative on error, return 0 or positive giving size of data element */ static int FromServer(int file_descriptor, struct client_msg *cm, char *msg, size_t size) { size_t rtry; size_t ret; struct timeval tv = { ow_Global.timeout_network + 1, 0, }; do { // read regular header, or delay (delay when payload<0) //printf("OW_SERVER loop2\n"); ret = tcp_read(file_descriptor, cm, sizeof(struct client_msg), &tv); if (ret != sizeof(struct client_msg)) { //printf("OW_SERVER loop2 bad\n"); cm->size = 0; cm->ret = -EIO; return -EIO; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->sg = ntohl(cm->sg); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); // flag to show a delay message //printf("OW_SERVER loop2 done\n"); //printf("FromServer payload=%d size=%d ret=%d sg=%d offset=%d\n",cm->payload,cm->size,cm->ret,cm->sg,cm->offset); //printf(">%.4d|%.4d\n",cm->ret,cm->payload); if (cm->payload == 0) return 0; // No payload, done. rtry = cm->payload < (ssize_t) size ? (size_t) cm->payload : size; ret = tcp_read(file_descriptor, msg, rtry, &tv); // read expected payload now. if (ret != rtry) { cm->ret = -EIO; return -EIO; } if (cm->payload > (ssize_t) size) { // Uh oh. payload bigger than expected. read it in and discard size_t d = cm->payload - size; char extra[d]; ret = tcp_read(file_descriptor, extra, d, &tv); if (ret != d) { cm->ret = -EIO; return -EIO; } return size; } return cm->payload; } /* Send a message to server, or try a new connection and send again */ /* return file descriptor */ static int ToServerTwice(int file_descriptor, int persistent, struct server_msg *sm, struct serverpackage *sp, struct connection_in *in) { int newfd; if (ToServer(file_descriptor, sm, sp) == 0) return file_descriptor; if (persistent == 0) { close(file_descriptor); return FD_CURRENT_BAD; } newfd = PersistentReRequest(file_descriptor, in); if (newfd < 0) return FD_CURRENT_BAD; if (ToServer(newfd, sm, sp) == 0) return newfd; close(newfd); return FD_CURRENT_BAD; } // should be const char * data but iovec has problems with const arguments static int ToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp) { int payload = 0; int nio = 0; struct iovec io[5] = { {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, }; // First block to send, the header io[nio].iov_base = sm; io[nio].iov_len = sizeof(struct server_msg); nio++; // Next block, the path if ((io[nio].iov_base = sp->path)) { // send path (if not null) io[nio].iov_len = payload = strlen(sp->path) + 1; nio++; LEVEL_DEBUG("ToServer path=%s\n", sp->path); } // next block, data (only for writes) if ((sp->datasize>0) && (io[nio].iov_base = sp->data)) { // send data only for writes (if datasize not zero) payload += (io[nio].iov_len = sp->datasize); nio++; LEVEL_DEBUG("ToServer data=%s\n", sp->data); } if (1) { // if not being called from owserver, that's it sp->tokens = 0; sm->version = 0; // shouldn't this be MakeServerprotocol(OWSERVER_PROTOCOL_VERSION); } else { /* I guess this can't happen since it's ownet */ if (sp->tokens > 0) { // owserver: send prior tags io[nio].iov_base = sp->tokenstring; io[nio].iov_len = sp->tokens * sizeof(union antiloop); nio++; } ++sp->tokens; sm->version = Servermessage + (sp->tokens); io[nio].iov_base = &(Globals.Token); // owserver: add our tag io[nio].iov_len = sizeof(union antiloop); nio++; } //printf("ToServer payload=%d size=%d type=%d tempscale=%X offset=%d\n",payload,sm->size,sm->type,sm->sg,sm->offset); //printf("<%.4d|%.4d\n",sm->type,payload); //printf("Scale=%s\n", TemperatureScaleName(SGTemperatureScale(sm->sg))); // encode in network order (just the header) sm->version = htonl(sm->version); sm->payload = htonl(payload); sm->size = htonl(sm->size); sm->type = htonl(sm->type); sm->sg = htonl(sm->sg); sm->offset = htonl(sm->offset); Debug_Writev(io, nio); return writev(file_descriptor, io, nio) != (ssize_t) (payload + sizeof(struct server_msg) + sp->tokens * sizeof(union antiloop)); } /* flag the sg for "virtual root" -- the remote bus was specifically requested */ static uint32_t SetupSemi(int persistent) { uint32_t sg = ow_Global.sg; sg &= ~PERSISTENT_MASK; if (persistent) { sg |= PERSISTENT_MASK; } /* End user -- add full bus list and apply aliases */ sg |= SHOULD_RETURN_BUS_LIST | ALIAS_REQUEST ; return sg; } /* Wrapper for ClientConnect */ static int ConnectToServer(struct connection_in *in) { int file_descriptor; file_descriptor = ClientConnect(in); return file_descriptor; } /* Request a persistent connection Three possibilities: 1. no persistent connection currently (in->file_descriptor = -1) create one, flag in->file_descriptor as -2, and return file_descriptor or return -1 if a new one can't be created 2. persistent available (in->file_descriptor > -1 ) use it, flag in->file_descriptor as -2, and return in->file_descriptor 3. in use, (in->file_descriptor = -2) return -1 */ static int PersistentRequest(struct connection_in *in) { int file_descriptor; BUSLOCKIN(in); if (in->file_descriptor == FD_PERSISTENT_IN_USE) { // in use file_descriptor = FD_CURRENT_BAD; } else if (in->file_descriptor > FD_PERSISTENT_NONE) { // available file_descriptor = in->file_descriptor; in->file_descriptor = FD_PERSISTENT_IN_USE; } else if ((file_descriptor = ConnectToServer(in)) == FD_CURRENT_BAD) { // can't get a connection file_descriptor = FD_CURRENT_BAD; } else { // new connection -- make it persistent in->file_descriptor = FD_PERSISTENT_IN_USE; } BUSUNLOCKIN(in); return file_descriptor; } /* A persistent connection didn't work (probably expired on the other end recreate it, or clear and return -1 */ static int PersistentReRequest(int file_descriptor, struct connection_in *in) { close(file_descriptor); BUSLOCKIN(in); file_descriptor = ConnectToServer(in); if (file_descriptor == FD_CURRENT_BAD) { // bad connection in->file_descriptor = FD_PERSISTENT_NONE; } // else leave as in->file_descriptor = -2 BUSUNLOCKIN(in); return file_descriptor; } /* Clear a persistent connection */ static void PersistentClear(int file_descriptor, struct connection_in *in) { if (file_descriptor > FD_CURRENT_BAD) { close(file_descriptor); } BUSLOCKIN(in); in->file_descriptor = FD_PERSISTENT_NONE; BUSUNLOCKIN(in); } /* Free a persistent connection */ static void PersistentFree(int file_descriptor, struct connection_in *in) { if (file_descriptor == FD_CURRENT_BAD) { PersistentClear(file_descriptor, in); } else { BUSLOCKIN(in); in->file_descriptor = file_descriptor; BUSUNLOCKIN(in); } } /* All the startup code file_descriptor will get the file descriptor persistent starts 0 or 1 for whether persistence is wanted persistent returns 0 or 1 for whether persistence is granted */ static int PersistentStart(int *persistent, struct connection_in *in) { int file_descriptor; if (*persistent == 0) { // no persistence wanted file_descriptor = ConnectToServer(in); *persistent = 0; // still not persistent } else if ((file_descriptor = PersistentRequest(in)) == FD_CURRENT_BAD) { // tried but failed file_descriptor = ConnectToServer(in); // non-persistent backup request *persistent = 0; // not persistent } else { // successfully *persistent = 1; // flag as persistent } return file_descriptor; } /* Clean up at end of routine, either leave connection open and persistent flag available, or close and leave available */ static void PersistentEnd(int file_descriptor, int persistent, int granted, struct connection_in *in) { if (persistent == 0) { // non-persistence from the start close(file_descriptor); } else if (granted == 0) { // not granted PersistentClear(file_descriptor, in); } else { // Let the persistent connection be used PersistentFree(file_descriptor, in); } } owfs-2.8p15/module/ownet/c/src/c/ow_dnssd.c0000664000175000017500000000746010750074146015465 00000000000000/* $Id: ow_dnssd.c,v 1.2 2008/01/30 13:15:18 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2006 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #if OW_ZERO #include "ow.h" #include "ow_dl.h" #include "ow_dnssd.h" DLHANDLE libdnssd = NULL; #if OW_CYGWIN #ifdef HAVE_DLFCN_H #include #endif #endif _DNSServiceRefSockFD DNSServiceRefSockFD; _DNSServiceProcessResult DNSServiceProcessResult; _DNSServiceRefDeallocate DNSServiceRefDeallocate; _DNSServiceResolve DNSServiceResolve; _DNSServiceBrowse DNSServiceBrowse; _DNSServiceRegister DNSServiceRegister; _DNSServiceReconfirmRecord DNSServiceReconfirmRecord; _DNSServiceCreateConnection DNSServiceCreateConnection; _DNSServiceEnumerateDomains DNSServiceEnumerateDomains; int OW_Load_dnssd_library(void) { int i = 0; #if OW_CYGWIN char libdirs[3][80] = { //{ "/opt/owfs/lib/libdns_sd.dll" }, {"libdns_sd.dll"}, {""} }; while (*libdirs[i]) { /* Cygwin has dlopen and it seems to be ok to use it actually. */ if (!(libdnssd = DL_open(libdirs[i], 0))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); fprintf(stderr, "dlopen [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //fprintf(stderr, "DL_open [%s] success\n", libdirs[i]); break; } } #if 0 /* This file compiled with Microsoft Visual C doesn't work actually... */ if (!libdnssd) { char file[255]; strcpy(file, "dnssd.dll"); if (!(libdnssd = DL_open(file, 0))) { /* Couldn't open that lib, but continue anyway */ } } #endif #elif OW_DARWIN // MacOSX have dnssd functions in libSystem char libdirs[2][80] = { {"libSystem.dylib"}, {""} }; while (*libdirs[i]) { if (!(libdnssd = DL_open(libdirs[i], RTLD_LAZY))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); fprintf(stderr, "DL_open [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //fprintf(stderr, "DL_open [%s] success\n", libdirs[i]); break; } } #elif defined(HAVE_DLOPEN) char libdirs[3][80] = { {"/opt/owfs/lib/libdns_sd.so"}, {"libdns_sd.so"}, {""} }; while (*libdirs[i]) { if (!(libdnssd = DL_open(libdirs[i], RTLD_LAZY))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); fprintf(stderr, "DL_open [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //fprintf(stderr, "DL_open [%s] success\n", libdirs[i]); break; } } #endif if (libdnssd == NULL) { //fprintf(stderr, "Zeroconf/Bonjour is disabled since dnssd library isn't found\n"); return -1; } DNSServiceRefSockFD = (_DNSServiceRefSockFD) DL_sym(libdnssd, "DNSServiceRefSockFD"); DNSServiceProcessResult = (_DNSServiceProcessResult) DL_sym(libdnssd, "DNSServiceProcessResult"); DNSServiceRefDeallocate = (_DNSServiceRefDeallocate) DL_sym(libdnssd, "DNSServiceRefDeallocate"); DNSServiceResolve = (_DNSServiceResolve) DL_sym(libdnssd, "DNSServiceResolve"); DNSServiceBrowse = (_DNSServiceBrowse) DL_sym(libdnssd, "DNSServiceBrowse"); DNSServiceRegister = (_DNSServiceRegister) DL_sym(libdnssd, "DNSServiceRegister"); DNSServiceReconfirmRecord = (_DNSServiceReconfirmRecord) DL_sym(libdnssd, "DNSServiceReconfirmRecord"); DNSServiceCreateConnection = (_DNSServiceCreateConnection) DL_sym(libdnssd, "DNSServiceCreateConnection"); DNSServiceEnumerateDomains = (_DNSServiceEnumerateDomains) DL_sym(libdnssd, "DNSServiceEnumerateDomains"); return 0; } int OW_Free_dnssd_library(void) { int rc = -1; if (libdnssd) { rc = DL_close(libdnssd); libdnssd = NULL; } return rc; } #endif /* OW_ZERO */ owfs-2.8p15/module/ownet/c/src/c/ownet_write.c0000664000175000017500000000332311105706560016202 00000000000000/* $Id: ownet_write.c,v 1.9 2008/11/10 01:25:04 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" int OWNET_put(OWNET_HANDLE h, const char *onewire_path, const char *value_string, size_t size) { struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; int return_value; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; rp->write_value = (const unsigned char *) value_string; rp->data_length = size; rp->data_offset = 0; return_value = ServerWrite(rp); CONNIN_RUNLOCK; return return_value; } int OWNET_lwrite(OWNET_HANDLE h, const char *onewire_path, const char *value_string, size_t size, off_t offset) { struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; int return_value; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; rp->write_value = (const unsigned char *) value_string; rp->data_length = size; rp->data_offset = offset; return_value = ServerWrite(rp); CONNIN_RUNLOCK; return return_value; } owfs-2.8p15/module/ownet/c/src/c/ownet_setget.c0000664000175000017500000000470210750074146016350 00000000000000/* $Id: ownet_setget.c,v 1.3 2008/01/30 13:15:18 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" void OWNET_set_temperature_scale(char temperature_scale) { switch (temperature_scale) { case 'R': case 'r': set_semiglobal(&ow_Global.sg, TEMPSCALE_MASK, TEMPSCALE_BIT, temp_rankine); break; case 'K': case 'k': set_semiglobal(&ow_Global.sg, TEMPSCALE_MASK, TEMPSCALE_BIT, temp_kelvin); break; case 'F': case 'f': set_semiglobal(&ow_Global.sg, TEMPSCALE_MASK, TEMPSCALE_BIT, temp_fahrenheit); break; case 'C': case 'c': default: set_semiglobal(&ow_Global.sg, TEMPSCALE_MASK, TEMPSCALE_BIT, temp_celsius); break; } } char OWNET_get_temperature_scale(void) { switch (TemperatureScale) { case temp_rankine: return 'R'; case temp_kelvin: return 'K'; case temp_fahrenheit: return 'F'; case temp_celsius: default: return 'C'; } } void OWNET_set_device_format(const char *device_format) { if (device_format == NULL) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fdi); } else if (0 == strcasecmp(device_format, "f.i")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fdi); } else if (0 == strcasecmp(device_format, "fi")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fi); } else if (0 == strcasecmp(device_format, "f.i.c")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fdidc); } else if (0 == strcasecmp(device_format, "f.ic")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fdic); } else if (0 == strcasecmp(device_format, "fi.c")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fidc); } else if (0 == strcasecmp(device_format, "fic")) { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fic); } else { set_semiglobal(&ow_Global.sg, DEVFORMAT_MASK, DEVFORMAT_BIT, fdi); } } const char *OWNET_get_device_format(void) { switch (DeviceFormat) { case fi: return "fi"; case fic: return "fic"; case fdidc: return "f.i.c"; case fdic: return "f.ic"; case fidc: return "fi.c"; case fdi: default: return "f.i"; } } owfs-2.8p15/module/ownet/c/src/c/ow_dl.c0000664000175000017500000000201010741437746014744 00000000000000/* $Id: ow_dl.c,v 1.1 2008/01/10 15:55:18 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_dl.h" #if OW_ZERO DLHANDLE DL_open(const char *pathname, int mode) { #if OW_CYGWIN return LoadLibrary(pathname); #elif defined(HAVE_DLOPEN) return dlopen(pathname, mode); #endif } void *DL_sym(DLHANDLE handle, const char *name) { #if OW_CYGWIN return (void *) GetProcAddress(handle, name); #elif defined(HAVE_DLOPEN) return dlsym(handle, name); #endif } int DL_close(DLHANDLE handle) { #if OW_CYGWIN if (FreeLibrary(handle)) return 0; return -1; #elif defined(HAVE_DLOPEN) return dlclose(handle); #endif } char *DL_error(void) { #if OW_CYGWIN return "Error in WIN32 DL"; #elif defined(HAVE_DLOPEN) return dlerror(); #endif } #endif owfs-2.8p15/module/ownet/c/src/c/ownet_read.c0000664000175000017500000000376611424010351015764 00000000000000/* $Id: ownet_read.c,v 1.10 2010/07/28 11:13:45 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" int OWNET_read(OWNET_HANDLE h, const char *onewire_path, char **return_string) { unsigned char buffer[MAX_READ_BUFFER_SIZE]; int return_value; struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; rp->read_value = buffer; rp->data_length = MAX_READ_BUFFER_SIZE; rp->data_offset = 0; /* Fix from nleonard671 to add a terminating NULL */ return_value = ServerRead(rp); if (return_value > 0) { *return_string = malloc(return_value+1); if (*return_string == NULL) { return_value = -ENOMEM; } else { memcpy(*return_string, buffer, return_value); (*return_string)[return_value] = '\0' ; } } CONNIN_RUNLOCK; return return_value; } int OWNET_lread(OWNET_HANDLE h, const char *onewire_path, char *return_string, size_t size, off_t offset) { struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; int return_value; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; rp->read_value = (unsigned char *)return_string; rp->data_length = size; rp->data_offset = offset; return_value = ServerRead(rp); CONNIN_RUNLOCK; return return_value; } owfs-2.8p15/module/ownet/c/src/c/getaddrinfo.c0000664000175000017500000007164211267053570016140 00000000000000/* $USAGI: getaddrinfo.c,v 1.16 2001/10/04 09:52:03 sekiya Exp $ */ /* The Inner Net License, Version 2.00 The author(s) grant permission for redistribution and use in source and binary forms, with or without modification, of the software and documentation provided that the following conditions are met: 0. If you receive a version of the software that is specifically labelled as not being for redistribution (check the version message and/or README), you are not permitted to redistribute that version of the software in any way or form. 1. All terms of the all other applicable copyrights and licenses must be followed. 2. Redistributions of source code must retain the authors' copyright notice(s), this list of conditions, and the following disclaimer. 3. Redistributions in binary form must reproduce the authors' copyright notice(s), this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 4. All advertising materials mentioning features or use of this software must display the following acknowledgement with the name(s) of the authors as specified in the copyright notice(s) substituted where indicated: This product includes software developed by , The Inner Net, and other contributors. 5. Neither the name(s) of the author(s) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If these license terms cause you a real problem, contact the author. */ /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ #include #include "owfs_config.h" #ifdef HAVE_PTHREAD #include #endif #ifndef HAVE_GETADDRINFO #define _GNU_SOURCE #define __FORCE_GLIBC #ifdef HAVE_FEATURES_H #include #endif #include #include #include #include "compat_netdb.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_RESOLV_H #include #endif #include "ow_debug.h" /* The following declarations and definitions have been removed from * the public header since we don't want people to use them. */ #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */ #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type. */ #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) #define GAIH_OKIFUNSPEC 0x0100 #define GAIH_EAI ~(GAIH_OKIFUNSPEC) struct gaih_service { const char *name; int num; }; struct gaih_servtuple { struct gaih_servtuple *next; int socktype; int protocol; int port; }; static const struct gaih_servtuple nullserv; struct gaih_addrtuple { struct gaih_addrtuple *next; int family; char addr[16]; uint32_t scopeid; }; struct gaih_typeproto { int socktype; int protocol; char name[4]; int protoflag; }; /* Values for `protoflag'. */ #define GAI_PROTO_NOSERVICE 1 #define GAI_PROTO_PROTOANY 2 static const struct gaih_typeproto gaih_inet_typeproto[] = { {0, 0, "", 0}, {SOCK_STREAM, IPPROTO_TCP, "tcp", 0}, {SOCK_DGRAM, IPPROTO_UDP, "udp", 0}, {SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY | GAI_PROTO_NOSERVICE}, {0, 0, "", 0} }; struct gaih { int family; int (*gaih) (const char *name, const struct gaih_service * service, const struct addrinfo * req, struct addrinfo ** pai); }; #if PF_UNSPEC == 0 static const struct addrinfo default_hints; #else static const struct addrinfo default_hints = { 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL }; #endif static int addrconfig(sa_family_t af) { int s; int ret; int saved_errno = errno; s = socket(af, SOCK_DGRAM, 0); if (s < 0) ret = (errno == EMFILE) ? 1 : 0; else { close(s); ret = 1; } __set_errno(saved_errno); return ret; } #if 0 #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 #endif /* Using Unix sockets this way is a security risk. */ static int gaih_local(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { struct utsname utsname; if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST)) return GAIH_OKIFUNSPEC | -EAI_NONAME; if ((name != NULL) || (req->ai_flags & AI_CANONNAME)) if (uname(&utsname) < 0) return -EAI_SYSTEM; if (name != NULL) { if (strcmp(name, "localhost") && strcmp(name, "local") && strcmp(name, "unix") && strcmp(name, utsname.nodename)) return GAIH_OKIFUNSPEC | -EAI_NONAME; } if (req->ai_protocol || req->ai_socktype) { const struct gaih_typeproto *tp = gaih_inet_typeproto + 1; while (tp->name[0] && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0 || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } *pai = malloc(sizeof(struct addrinfo) + sizeof(struct sockaddr_un) + ((req->ai_flags & AI_CANONNAME) ? (strlen(utsname.nodename) + 1) : 0)); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_next = NULL; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = AF_LOCAL; (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM; (*pai)->ai_protocol = req->ai_protocol; (*pai)->ai_addrlen = sizeof(struct sockaddr_un); (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len = sizeof(struct sockaddr_un); #endif /* HAVE_SA_LEN */ ((struct sockaddr_un *) (*pai)->ai_addr)->sun_family = AF_LOCAL; memset(((struct sockaddr_un *) (*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); if (service) { struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; if (strchr(service->name, '/') != NULL) { if (strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; strcpy(sunp->sun_path, service->name); } else { if (strlen(P_tmpdir "/") + 1 + strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; __stpcpy(__stpcpy(sunp->sun_path, P_tmpdir "/"), service->name); } } else { /* This is a dangerous use of the interface since there is a time window between the test for the file and the actual creation (done by the caller) in which a file with the same name could be created. */ char *buf = ((struct sockaddr_un *) (*pai)->ai_addr)->sun_path; if (__builtin_expect(__path_search(buf, L_tmpnam, NULL, NULL, 0), 0) != 0 || __builtin_expect(__gen_tempname(buf, __GT_NOCREATE), 0) != 0) return -EAI_SYSTEM; } if (req->ai_flags & AI_CANONNAME) (*pai)->ai_canonname = strcpy((char *) *pai + sizeof(struct addrinfo) + sizeof(struct sockaddr_un), utsname.nodename); else (*pai)->ai_canonname = NULL; return 0; } #endif /* 0 */ #ifndef HAVE_GETHOSTBYNAME_R struct hostent *gethostbyname_r(const char *name, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD my_pthread_mutex_lock(&gethostbyname_lock); #endif res = gethostbyname(name); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD my_pthread_mutex_unlock(&gethostbyname_lock); #endif return res; } #endif #ifndef HAVE_GETSERVBYNAME_R struct servent *getservbyname_r(const char *name, const char *proto, struct servent *result, char *buf, size_t buflen) { #ifdef HAVE_PTHREAD static pthread_mutex_t getservbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct servent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD my_pthread_mutex_lock(&getservbyname_lock); #endif res = getservbyname(name, proto); if (res) memcpy(result, res, sizeof(struct servent)); #ifdef HAVE_PTHREAD my_pthread_mutex_unlock(&getservbyname_lock); #endif return res; } #endif static int gaih_inet_serv(const char *servicename, const struct gaih_typeproto *tp, const struct addrinfo *req, struct gaih_servtuple *st) { struct servent *s; size_t tmpbuflen = 1024; struct servent ts; char *tmpbuf; int r; do { tmpbuf = alloca(tmpbuflen); #if 0 r = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen, &s); if (!s) r = errno; if (r != 0 || s == NULL) { if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } #else s = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen); if (s == NULL) { r = errno; if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } else { r = 0; } #endif } while (r); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = s->s_port; return 0; } #define gethosts(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = 0; \ h = gethostbyname_r (name, &th, tmpbuf, \ tmpbuflen, &herrno); \ if(!h) rc = errno; \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #ifndef HAVE_GETHOSTBYNAME2_R struct hostenv *gethostbyname2_r(const char *name, int af, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) { /* Don't support this if it doesn't exists... (eg. IPV6 will fail on cygwin for example) */ (void) name; (void) af; (void) ret; (void) buf; (void) buflen; (void) result; (void) h_errnop; return NULL; } #endif #if __HAS_IPV6__ #define gethosts2(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = gethostbyname2_r (name, _family, &th, tmpbuf, \ tmpbuflen, &h, &herrno); \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #endif #ifndef HAVE_GETHOSTBYADDR_R struct hostent *gethostbyaddr_r(const char *name, int len, int type, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyaddr_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD my_pthread_mutex_lock(&gethostbyaddr_lock); #endif res = gethostbyaddr(name, len, type); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD my_pthread_mutex_unlock(&gethostbyaddr_lock); #endif return res; } #endif static int gaih_inet(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { const struct gaih_typeproto *tp = gaih_inet_typeproto; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; struct gaih_addrtuple *at = NULL; int rc; int v4mapped = (req->ai_family == PF_UNSPEC #if __HAS_IPV6__ || req->ai_family == PF_INET6 #endif ) && (req->ai_flags & AI_V4MAPPED); if (req->ai_protocol || req->ai_socktype) { ++tp; while (tp->name[0] && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } if (service != NULL) { if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); if (service->num < 0) { if (tp->name[0]) { st = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, st))) return rc; } else { struct gaih_servtuple **pst = &st; for (tp++; tp->name[0]; tp++) { struct gaih_servtuple *newp; if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) continue; if (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) continue; if (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol) continue; newp = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, newp))) { if (rc & GAIH_OKIFUNSPEC) continue; return rc; } *pst = newp; pst = &(newp->next); } if (st == (struct gaih_servtuple *) &nullserv) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } else { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = htons(service->num); } } else if (req->ai_socktype || req->ai_protocol) { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = 0; } else { /* * Neither socket type nor protocol is set. Return all socket types * we know about. */ struct gaih_servtuple **lastp = &st; for (++tp; tp->name[0]; ++tp) { struct gaih_servtuple *newp; newp = alloca(sizeof(struct gaih_servtuple)); newp->next = NULL; newp->socktype = tp->socktype; newp->protocol = tp->protocol; newp->port = 0; *lastp = newp; lastp = &newp->next; } } if (name != NULL) { at = alloca(sizeof(struct gaih_addrtuple)); at->family = AF_UNSPEC; at->scopeid = 0; at->next = NULL; if (inet_pton(AF_INET, name, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET || v4mapped) at->family = AF_INET; else return -EAI_FAMILY; } #if __HAS_IPV6__ if (at->family == AF_UNSPEC) { char *namebuf = strdupa(name); char *scope_delim; scope_delim = strchr(namebuf, SCOPE_DELIMITER); if (scope_delim != NULL) *scope_delim = '\0'; if (inet_pton(AF_INET6, namebuf, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) at->family = AF_INET6; else return -EAI_FAMILY; if (scope_delim != NULL) { int try_numericscope = 0; if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) { at->scopeid = if_nametoindex(scope_delim + 1); if (at->scopeid == 0) try_numericscope = 1; } else try_numericscope = 1; if (try_numericscope != 0) { char *end; assert(sizeof(uint32_t) <= sizeof(unsigned long)); at->scopeid = (uint32_t) strtoul(scope_delim + 1, &end, 10); if (*end != '\0') return GAIH_OKIFUNSPEC | -EAI_NONAME; } } } } #endif if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0) { struct hostent *h; struct gaih_addrtuple **pat = &at; int no_data = 0; int no_inet6_data; /* * If we are looking for both IPv4 and IPv6 address we don't want * the lookup functions to automatically promote IPv4 addresses to * IPv6 addresses. */ #if __HAS_IPV6__ if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) gethosts(AF_INET6, struct in6_addr); #endif no_inet6_data = no_data; if (req->ai_family == AF_INET || (!v4mapped && req->ai_family == AF_UNSPEC) || (v4mapped && (no_inet6_data != 0 || (req->ai_flags & AI_ALL)))) #if __HAS_IPV6__ gethosts2(AF_INET, struct in_addr); #else gethosts(AF_INET, struct in_addr); #endif if (no_data != 0 && no_inet6_data != 0) { /* If both requests timed out report this. */ if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN) return -EAI_AGAIN; /* * We made requests but they turned out no data. * The name is known, though. */ return (GAIH_OKIFUNSPEC | -EAI_AGAIN); } } if (at->family == AF_UNSPEC) return (GAIH_OKIFUNSPEC | -EAI_NONAME); } else { struct gaih_addrtuple *atr; atr = at = alloca(sizeof(struct gaih_addrtuple)); memset(at, '\0', sizeof(struct gaih_addrtuple)); if (req->ai_family == 0) { at->next = alloca(sizeof(struct gaih_addrtuple)); memset(at->next, '\0', sizeof(struct gaih_addrtuple)); } #if __HAS_IPV6__ if (req->ai_family == 0 || req->ai_family == AF_INET6) { extern const struct in6_addr __in6addr_loopback; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) memcpy(at->addr, &__in6addr_loopback, sizeof(struct in6_addr)); atr = at->next; } #endif if (req->ai_family == 0 || req->ai_family == AF_INET) { atr->family = AF_INET; if ((req->ai_flags & AI_PASSIVE) == 0) *(uint32_t *) atr->addr = htonl(INADDR_LOOPBACK); } } if (pai == NULL) return 0; { const char *c = NULL; struct gaih_servtuple *st2; struct gaih_addrtuple *at2 = at; size_t socklen, namelen; sa_family_t family; /* * buffer is the size of an unformatted IPv6 address in * printable format. */ char buffer[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; while (at2 != NULL) { if (req->ai_flags & AI_CANONNAME) { struct hostent *h = NULL; int herrno; struct hostent th; size_t tmpbuflen = 512; char *tmpbuf; do { tmpbuflen *= 2; tmpbuf = alloca(tmpbuflen); if (tmpbuf == NULL) return -EAI_MEMORY; rc = 0; h = gethostbyaddr_r(at2->addr, #if __HAS_IPV6__ ((at2->family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr)), #else sizeof(struct in_addr), #endif at2->family, &th, tmpbuf, tmpbuflen, &herrno); if (!h) rc = errno; } while (rc == errno && herrno == NETDB_INTERNAL); if (rc != 0 && herrno == NETDB_INTERNAL) { __set_h_errno(herrno); return -EAI_SYSTEM; } if (h == NULL) c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer)); else c = h->h_name; if (c == NULL) return GAIH_OKIFUNSPEC | -EAI_NONAME; namelen = strlen(c) + 1; } else namelen = 0; #if __HAS_IPV6__ if (at2->family == AF_INET6 || v4mapped) { family = AF_INET6; socklen = sizeof(struct sockaddr_in6); } else #endif { family = AF_INET; socklen = sizeof(struct sockaddr_in); } for (st2 = st; st2 != NULL; st2 = st2->next) { *pai = malloc(sizeof(struct addrinfo) + socklen + namelen); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = family; (*pai)->ai_socktype = st2->socktype; (*pai)->ai_protocol = st2->protocol; (*pai)->ai_addrlen = socklen; (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN (*pai)->ai_addr->sa_len = socklen; #endif /* HAVE_SA_LEN */ (*pai)->ai_addr->sa_family = family; #if __HAS_IPV6__ if (family == AF_INET6) { struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *) (*pai)->ai_addr; sin6p->sin6_flowinfo = 0; if (at2->family == AF_INET6) { memcpy(&sin6p->sin6_addr, at2->addr, sizeof(struct in6_addr)); } else { sin6p->sin6_addr.s6_addr32[0] = 0; sin6p->sin6_addr.s6_addr32[1] = 0; sin6p->sin6_addr.s6_addr32[2] = htonl(0x0000ffff); memcpy(&sin6p->sin6_addr.s6_addr32[3], at2->addr, sizeof(sin6p->sin6_addr.s6_addr32[3])); } sin6p->sin6_port = st2->port; sin6p->sin6_scope_id = at2->scopeid; } else #endif { struct sockaddr_in *sinp = (struct sockaddr_in *) (*pai)->ai_addr; memcpy(&sinp->sin_addr, at2->addr, sizeof(struct in_addr)); sinp->sin_port = st2->port; memset(sinp->sin_zero, '\0', sizeof(sinp->sin_zero)); } if (c) { (*pai)->ai_canonname = ((void *) (*pai) + sizeof(struct addrinfo) + socklen); strcpy((*pai)->ai_canonname, c); } else (*pai)->ai_canonname = NULL; (*pai)->ai_next = NULL; pai = &((*pai)->ai_next); } at2 = at2->next; } } return 0; } static struct gaih gaih[] = { #if __HAS_IPV6__ {PF_INET6, gaih_inet}, #endif {PF_INET, gaih_inet}, #if 0 {PF_LOCAL, gaih_local}, #endif {PF_UNSPEC, NULL} }; int getaddrinfo(const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) { int i = 0, j = 0, last_i = 0; struct addrinfo *p = NULL, **end; struct gaih *g = gaih, *pg = NULL; struct gaih_service gaih_service, *pservice; if (name != NULL && name[0] == '*' && name[1] == 0) name = NULL; if (service != NULL && service[0] == '*' && service[1] == 0) service = NULL; if (name == NULL && service == NULL) return EAI_NONAME; if (hints == NULL) hints = &default_hints; if (hints->ai_flags & ~(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG | AI_V4MAPPED | AI_ALL)) return EAI_BADFLAGS; if ((hints->ai_flags & AI_CANONNAME) && name == NULL) return EAI_BADFLAGS; if (service && service[0]) { char *c; gaih_service.name = service; gaih_service.num = strtoul(gaih_service.name, &c, 10); if (*c) gaih_service.num = -1; else /* * Can't specify a numerical socket unless a protocol * family was given. */ if (hints->ai_socktype == 0 && hints->ai_protocol == 0) return EAI_SERVICE; pservice = &gaih_service; } else pservice = NULL; if (pai) end = &p; else end = NULL; while (g->gaih) { if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC) { if ((hints->ai_flags & AI_ADDRCONFIG) && !addrconfig(g->family)) continue; j++; if (pg == NULL || pg->gaih != g->gaih) { pg = g; i = g->gaih(name, pservice, hints, end); if (i != 0) { last_i = i; if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC)) continue; if (p) freeaddrinfo(p); return -(i & GAIH_EAI); } if (end) while (*end) end = &((*end)->ai_next); } } ++g; } if (j == 0) return EAI_FAMILY; if (p) { *pai = p; return 0; } if (pai == NULL && last_i == 0) return 0; if (p) freeaddrinfo(p); return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *p; while (ai != NULL) { p = ai; ai = ai->ai_next; free(p); } } #define N_(x) x static struct { int code; const char *msg; } values[] = { { EAI_ADDRFAMILY, N_("Address family for hostname not supported")}, { EAI_AGAIN, N_("Temporary failure in name resolution")}, { EAI_BADFLAGS, N_("Bad value for ai_flags")}, { EAI_FAIL, N_("Non-recoverable failure in name resolution")}, { EAI_FAMILY, N_("ai_family not supported")}, { EAI_MEMORY, N_("Memory allocation failure")}, { EAI_NODATA, N_("No address associated with hostname")}, { EAI_NONAME, N_("Name or service not known")}, { EAI_SERVICE, N_("Servname not supported for ai_socktype")}, { EAI_SOCKTYPE, N_("ai_socktype not supported")}, { EAI_SYSTEM, N_("System error")}, { EAI_INPROGRESS, N_("Processing request in progress")}, { EAI_CANCELED, N_("Request canceled")}, { EAI_NOTCANCELED, N_("Request not canceled")}, { EAI_ALLDONE, N_("All requests done")}, { EAI_INTR, N_("Interrupted by a signal")} }; const char *gai_strerror(int code) { size_t i; for (i = 0; i < sizeof(values) / sizeof(values[0]); ++i) if (values[i].code == code) return (values[i].msg); return ("Unknown error"); } #endif /* HAVE_GETADDRINFO */ #ifndef HAVE_INET_NTOP /* char * * inet_ntop4(src, dst, size) * format an IPv4 address * return: * `dst' (as a const) * notes: * (1) uses no statics * (2) takes a u_char* not an in_addr as input * author: * Paul Vixie, 1996. */ static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size) { char tmp[sizeof("255.255.255.255") + 1] = "\0"; int octet; int i; i = 0; for (octet = 0; octet <= 3; octet++) { if (src[octet] > 255) { __set_errno(ENOSPC); return (NULL); } tmp[i++] = '0' + src[octet] / 100; if (tmp[i - 1] == '0') { tmp[i - 1] = '0' + (src[octet] / 10 % 10); if (tmp[i - 1] == '0') i--; } else { tmp[i++] = '0' + (src[octet] / 10 % 10); } tmp[i++] = '0' + src[octet] % 10; tmp[i++] = '.'; } tmp[i - 1] = '\0'; if (strlen(tmp) > size) { __set_errno(ENOSPC); return (NULL); } return strcpy(dst, tmp); } /* char * * inet_ntop(af, src, dst, size) * convert a network format address to presentation format. * return: * pointer to presentation format address (`dst'), or NULL (see errno). * author: * Paul Vixie, 1996. */ const char *inet_ntop(af, src, dst, size) int af; const void *src; char *dst; socklen_t size; { switch (af) { case AF_INET: return (inet_ntop4(src, dst, size)); #if __HAS_IPV6__ case AF_INET6: return (inet_ntop6(src, dst, size)); #endif default: __set_errno(EAFNOSUPPORT); return (NULL); } /* NOTREACHED */ } #endif /* HAVE_INET_NTOP */ #ifndef HAVE_INET_PTON /* int * inet_pton4(src, dst) * like inet_aton() but without all the hexadecimal and shorthand. * return: * 1 if `src' is a valid dotted quad, else 0. * notice: * does not touch `dst' unless it's returning 1. * author: * Paul Vixie, 1996. */ static int inet_pton4(const char *src, unsigned char *dst) { int saw_digit, octets, ch; unsigned char tmp[4], *tp; saw_digit = 0; octets = 0; *(tp = tmp) = 0; while ((ch = *src++) != '\0') { if (ch >= '0' && ch <= '9') { unsigned int new = *tp * 10 + (ch - '0'); if (new > 255) return (0); *tp = new; if (!saw_digit) { if (++octets > 4) return (0); saw_digit = 1; } } else if (ch == '.' && saw_digit) { if (octets == 4) return (0); *++tp = 0; saw_digit = 0; } else return (0); } if (octets < 4) return (0); memcpy(dst, tmp, 4); return (1); } /* int * inet_pton(af, src, dst) * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * return: * 1 if the address was valid for the specified address family * 0 if the address wasn't valid (`dst' is untouched in this case) * -1 if some other error occurred (`dst' is untouched in this case, too) * author: * Paul Vixie, 1996. */ int inet_pton(af, src, dst) int af; const char *src; void *dst; { switch (af) { case AF_INET: return (inet_pton4(src, dst)); #if __HAS_IPV6__ case AF_INET6: return (inet_pton6(src, dst)); #endif default: __set_errno(EAFNOSUPPORT); return (-1); } /* NOTREACHED */ } #endif /* HAVE_INET_PTON */ owfs-2.8p15/module/ownet/c/src/c/ow_charblob.c0000664000175000017500000001050611331474552016122 00000000000000/* $Id: ow_charblob.c,v 1.3 2010/02/01 06:49:14 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #include #include "owfs_config.h" #include "ow.h" /* A "charblob" is a structure holding a list of files Most interesting, it allocates memory dynamically. */ void CharblobClear(struct charblob *cb) { if (cb->blob) { free(cb->blob); } CharblobInit(cb); } void CharblobInit(struct charblob *cb) { cb->used = 0; cb->allocated = 0; cb->blob = 0; cb->troubled = 0; } int CharblobPure(struct charblob *cb) { return !cb->troubled; } int CharblobAdd(const ASCII * a, size_t s, struct charblob *cb) { size_t incr = 1024; if (incr < s) incr = s; // make more room? -- blocks of 1k if (cb->used) CharblobAddChar(',', cb); // add a comma if (cb->used + s > cb->allocated) { int newalloc = cb->allocated + incr; ASCII *temp = realloc(cb->blob, newalloc); if (temp) { memset(&temp[cb->allocated], 0, incr); // set the new memory to blank cb->allocated = newalloc; cb->blob = temp; } else { // allocation failed -- keep old cb->troubled = 1; return -ENOMEM; } } memcpy(&cb->blob[cb->used], a, s); cb->used += s; return 0; } int CharblobAddChar(ASCII a, struct charblob *cb) { // make more room? -- blocks of 1k if (cb->used + 1 > cb->allocated) { int newalloc = cb->allocated + 1024; ASCII *temp = realloc(cb->blob, newalloc); if (temp) { memset(&temp[cb->allocated], 0, 1024); // set the new memory to blank cb->allocated = newalloc; cb->blob = temp; } else { // allocation failed -- keep old cb->troubled = 1; return -ENOMEM; } } cb->blob[cb->used] = a; ++cb->used; return 0; } size_t CharblobLength( struct charblob * cb ) { return cb->used ; } ASCII * CharblobData(struct charblob * cb) { return cb->blob ; } owfs-2.8p15/module/ownet/c/src/c/ownet_present.c0000664000175000017500000000216611131152075016527 00000000000000/* $Id: ownet_present.c,v 1.1 2009/01/07 16:11:41 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" int OWNET_present(OWNET_HANDLE h, const char *onewire_path) { unsigned char buffer[MAX_READ_BUFFER_SIZE]; int return_value; struct request_packet s_request_packet; struct request_packet *rp = &s_request_packet; memset(rp, 0, sizeof(struct request_packet)); CONNIN_RLOCK; rp->owserver = find_connection_in(h); if (rp->owserver == NULL) { CONNIN_RUNLOCK; return -EBADF; } rp->path = (onewire_path == NULL) ? "/" : onewire_path; rp->read_value = buffer; rp->data_length = MAX_READ_BUFFER_SIZE; rp->data_offset = 0; return_value = ServerPresence(rp); /* 0 is ok, <0 not found */ CONNIN_RUNLOCK; return return_value; } owfs-2.8p15/module/ownet/c/src/c/error.c0000664000175000017500000001513511334350522014766 00000000000000/* $Id: error.c,v 1.6 2010/02/09 21:19:14 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* error.c stolen nearly verbatim from "Unix Network Programming Volume 1 The Sockets Networking API (3rd Ed)" by W. Richard Stevens, Bill Fenner, Andrew M Rudoff Addison-Wesley Professional Computing Series Addison-Wesley, Boston 2003 http://www.unpbook.com */ #include #include "owfs_config.h" #include "ow.h" #include #ifdef HAVE_SYS_UIO_H #include #endif /* module/ownet/c/src/c/error.c & module/owlib/src/c/error.c are identical */ #if OW_MT const char mutex_init_failed[] = "mutex_init failed rc=%d [%s]"; const char mutex_destroy_failed[] = "mutex_destroy failed rc=%d [%s]"; const char mutex_lock_failed[] = "mutex_lock failed rc=%d [%s]"; const char mutex_unlock_failed[] = "mutex_unlock failed rc=%d [%s]"; const char mutexattr_init_failed[] = "mutexattr_init failed rc=%d [%s]"; const char mutexattr_destroy_failed[] = "mutexattr_destroy failed rc=%d [%s]"; const char mutexattr_settype_failed[] = "mutexattr_settype failed rc=%d [%s]"; const char rwlock_init_failed[] = "rwlock_init failed rc=%d [%s]"; const char rwlock_read_lock_failed[] = "rwlock_read_lock failed rc=%d [%s]"; const char rwlock_read_unlock_failed[] = "rwlock_read_unlock failed rc=%d [%s]"; const char cond_timedwait_failed[] = "cond_timedwait failed rc=%d [%s]"; const char cond_signal_failed[] = "cond_signal failed rc=%d [%s]"; const char cond_wait_failed[] = "cond_wait failed rc=%d [%s]"; const char cond_init_failed[] = "cond_init failed rc=%d [%s]"; const char cond_destroy_failed[] = "cond_destroy failed rc=%d [%s]"; #endif /* See man page for explanation */ int log_available = 0; /* Print message and return to caller * Caller specifies "errnoflag" and "level" */ #define MAXLINE 1023 void err_msg(enum e_err_type errnoflag, enum e_err_level level, const char *fmt, ...) { int errno_save = errno; /* value caller might want printed */ int n; char buf[MAXLINE + 1]; enum e_err_print sl; // 2=console 1=syslog va_list ap; /* Print where? */ switch (Globals.error_print) { case e_err_print_mixed: sl = Globals.now_background ? e_err_print_syslog : e_err_print_console; break; case e_err_print_syslog: sl = e_err_print_syslog; break; case e_err_print_console: sl = e_err_print_console; break; default: return; } va_start(ap, fmt); UCLIBCLOCK; /* Create output string */ #ifdef HAVE_VSNPRINTF vsnprintf(buf, MAXLINE, fmt, ap); /* safe */ #else vsprintf(buf, fmt, ap); /* not safe */ #endif n = strlen(buf); if (errnoflag == e_err_type_error) { snprintf(buf + n, MAXLINE - n, " -> %s\n", strerror(errno_save)); } UCLIBCUNLOCK; va_end(ap); if (sl == e_err_print_syslog) { /* All output to syslog */ strcat(buf, "\n"); if (!log_available) { openlog("OWFS", LOG_PID, LOG_DAEMON); log_available = 1; } syslog(level <= e_err_default ? LOG_INFO : LOG_NOTICE, "%s\n", buf); } else { fflush(stdout); /* in case stdout and stderr are the same */ switch (level) { case e_err_default: fputs("DEFAULT: ", stderr); break; case e_err_connect: fputs("CONNECT: ", stderr); break; case e_err_call: fputs(" CALL: ", stderr); break; case e_err_data: fputs(" DATA: ", stderr); break; case e_err_detail: fputs(" DETAIL: ", stderr); break; case e_err_debug: case e_err_beyond: default: fputs(" DEBUG: ", stderr); break; } fputs(buf, stderr); fflush(stderr); } return; } /* Purely a debugging routine -- print an arbitrary buffer of bytes */ void _Debug_Bytes(const char *title, const unsigned char *buf, int length) { int i; /* title line */ fprintf(stderr,"Byte buffer %s, length=%d", title ? title : "anonymous", (int) length); if (length < 0) { fprintf(stderr,"\n-- Attempt to write with bad length\n"); return; } if (buf == NULL) { fprintf(stderr,"\n-- NULL buffer\n"); return; } #if 1 /* hex lines -- 16 bytes each */ for (i = 0; i < length; ++i) { if ((i & 0x0F) == 0) { // devisible by 16 fprintf(stderr,"\n--%3.3d:",i); } fprintf(stderr," %.2X", (unsigned char)buf[i]); if(i >= 63) break; /* Sorry for this, but I think it's better to strip off all huge 8192 packages in the debug-output. */ } #endif /* char line -- printable or . */ fprintf(stderr,"\n <"); for (i = 0; i < length; ++i) { char c = buf[i]; fprintf(stderr,"%c", isprint(c) ? c : '.'); if(i >= 63) break; /* Sorry for this, but I think it's better to strip off all huge 8192 packages in the debug-output. */ } fprintf(stderr,">\n"); } /* Purely a debugging routine -- print an arbitrary buffer of bytes */ void _Debug_Writev(struct iovec *io, int iosz) { /* title line */ int i, ionr = 0; char *buf; int length; while(ionr < iosz) { buf = io[ionr].iov_base; length = io[ionr].iov_len; fprintf(stderr,"Writev byte buffer ionr=%d/%d length=%d", ionr+1, iosz, (int) length); if (length <= 0) { fprintf(stderr,"\n-- Attempt to write with bad length\n"); } if (buf == NULL) { fprintf(stderr,"\n-- NULL buffer\n"); } #if 1 /* hex lines -- 16 bytes each */ for (i = 0; i < length; ++i) { if ((i & 0x0F) == 0) { // devisible by 16 fprintf(stderr,"\n--%3.3d:",i); } fprintf(stderr," %.2X", (unsigned char)buf[i]); } #endif /* char line -- printable or . */ fprintf(stderr,"\n <"); for (i = 0; i < length; ++i) { char c = buf[i]; fprintf(stderr,"%c", isprint(c) ? c : '.'); } fprintf(stderr,">\n"); ionr++; } } void fatal_error(char *file, int row, const char *fmt, ...) { va_list ap; char tmp[256]; va_start(ap, fmt); #ifdef OWNETC_OW_DEBUG { fprintf(stderr, "%s:%d ", file, row); #ifdef HAVE_VSNPRINTF vsnprintf(tmp, sizeof(tmp), fmt, ap); #else vsprintf(tmp, fmt, ap); #endif fprintf(stderr, "%s\n", tmp); } #else /* OWNETC_OW_DEBUG */ if(Globals.fatal_debug) { LEVEL_DEFAULT("%s:%d ", file, row); #ifdef HAVE_VSNPRINTF vsnprintf(tmp, sizeof(tmp), fmt, ap); #else vsprintf(tmp, fmt, ap); #endif LEVEL_DEFAULT(tmp); } if(Globals.fatal_debug_file != NULL) { FILE *fp; char filename[64]; sprintf(filename, "%s.%d", Globals.fatal_debug_file, getpid()); if((fp = fopen(filename, "a")) != NULL) { if(!Globals.fatal_debug) { #ifdef HAVE_VSNPRINTF vsnprintf(tmp, sizeof(tmp), fmt, ap); #else vsprintf(tmp, fmt, ap); #endif } fprintf(fp, "%s:%d %s\n", file, row, tmp); fclose(fp); } } #endif /* OWNETC_OW_DEBUG */ va_end(ap); } owfs-2.8p15/module/ownet/c/src/c/globals.c0000664000175000017500000000247611025727336015274 00000000000000/* $Id: globals.c,v 1.5 2008/06/17 12:32:30 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_server.h" /* Globalss for port and bus communication */ /* connections globals stored in ow_connect.c */ /* i.e. connection_in * head_inbound_list ... */ /* State information, sent to remote or kept locally */ /* cacheenabled, presencecheck, tempscale, devform */ #if OW_CACHE int32_t SemiGlobal = ((uint8_t) fdi) << 24 | ((uint8_t) temp_celsius) << 16 | ((uint8_t) 1) << 8 | ((uint8_t) 1); #else int32_t SemiGlobal = ((uint8_t) fdi) << 24 | ((uint8_t) temp_celsius) << 16 | ((uint8_t) 1) << 8; #endif struct global Globals = { #if OW_ZERO .browse = NULL, #endif .progname = NULL, // "One Wire File System" , Can't allocate here since it's freed .now_background = 0, .error_level = e_err_default, .error_print = e_err_print_mixed, .readonly = 0, }; /* Statistics globals are stored in ow_stats.c */ #include "ow_server.h" struct ow_global ow_Global = { .timeout_network = 1, .timeout_server = 10, .autoserver = 0, }; owfs-2.8p15/module/ownet/c/src/c/ow_rwlock.c0000664000175000017500000000341111130373466015643 00000000000000/* $Id: ow_rwlock.c,v 1.6 2009/01/05 12:04:06 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* locks are to handle multithreading */ #include #include "owfs_config.h" #include "ow.h" #if OW_MT void my_rwlock_init(my_rwlock_t * my_rwlock) { my_pthread_mutex_init(&(my_rwlock->protect_reader_count), Mutex.pmattr); sem_init(&(my_rwlock->allow_readers), 0, 1); sem_init(&(my_rwlock->no_processes), 0, 1); my_rwlock->reader_count = 1; } inline void my_rwlock_write_lock(my_rwlock_t * my_rwlock) { sem_wait(&(my_rwlock->allow_readers)); sem_wait(&(my_rwlock->no_processes)); } inline void my_rwlock_write_unlock(my_rwlock_t * my_rwlock) { sem_post(&(my_rwlock->allow_readers)); sem_post(&(my_rwlock->no_processes)); } inline void my_rwlock_read_lock(my_rwlock_t * my_rwlock) { sem_wait(&(my_rwlock->allow_readers)); sem_post(&(my_rwlock->allow_readers)); my_pthread_mutex_lock(&(my_rwlock->protect_reader_count)); if (++my_rwlock->reader_count == 1) { sem_wait(&(my_rwlock->no_processes)); } my_pthread_mutex_unlock(&(my_rwlock->protect_reader_count)); } inline void my_rwlock_read_unlock(my_rwlock_t * my_rwlock) { my_pthread_mutex_lock(&(my_rwlock->protect_reader_count)); if (--my_rwlock->reader_count == 0) { sem_post(&(my_rwlock->no_processes)); } my_pthread_mutex_unlock(&(my_rwlock->protect_reader_count)); } void my_rwlock_destroy(my_rwlock_t * my_rwlock) { my_pthread_mutex_destroy(&(my_rwlock->protect_reader_count)); sem_destroy(&(my_rwlock->allow_readers)); sem_destroy(&(my_rwlock->no_processes)); } #endif /* OW_MT */ owfs-2.8p15/module/ownet/c/src/c/Makefile.am0000664000175000017500000000277011334350522015526 00000000000000# $Id: Makefile.am,v 1.12 2010/02/09 21:19:14 alfille Exp $ LIBOWNET_SOURCE = \ compat.c \ error.c \ getaddrinfo.c \ getopt.c \ globals.c \ ow_browse.c \ ow_charblob.c \ ow_connect.c \ ow_dl.c \ ow_dnssd.c \ ow_locks.c \ ow_net_client.c \ ownet_close.c \ ownet_dir.c \ ownet_init.c \ ownet_read.c \ ownet_present.c \ ownet_setget.c \ ownet_write.c \ ow_rwlock.c \ ow_server.c \ ow_tcp_read.c lib_LTLIBRARIES = libownet.la libownet_la_SOURCES = ${LIBOWNET_SOURCE} if HAVE_CYGWIN libownet_la_LDFLAGS = ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -no-undefined else libownet_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so endif # Maybe need this for MacOS X #if HAVE_DARWIN #LDADDS = -framework IOKit -framework CoreFoundation #endif #libow_la_LDFLAGS = -shared -shrext .so \ # -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ # -release $(LT_RELEASE) \ # -export-dynamic \ # $(LDADDS) AM_CFLAGS = -I../include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${PIC_FLAGS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/ownet/c/src/c/ow_tcp_read.c0000664000175000017500000000525111371665546016141 00000000000000/* $Id: ow_tcp_read.c,v 1.3 2010/05/10 02:11:50 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" /* Read "n" bytes from a descriptor. */ /* Stolen from Unix Network Programming by Stevens, Fenner, Rudoff p89 */ ssize_t tcp_read(int file_descriptor, void *vptr, size_t n, const struct timeval * ptv) { size_t nleft; ssize_t nread; char *ptr; //printf("NetRead attempt %d bytes Time:(%ld,%ld)\n",(int)n,ptv->tv_sec,ptv->tv_usec ) ; ptr = vptr; nleft = n; while (nleft > 0) { int rc; fd_set readset; struct timeval tv = { ptv->tv_sec, ptv->tv_usec, }; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); /* Read if it doesn't timeout first */ rc = select(file_descriptor + 1, &readset, NULL, NULL, &tv); if (rc > 0) { /* Is there something to read? */ if (FD_ISSET(file_descriptor, &readset) == 0) { return -EIO; /* error */ } //update_max_delay(pn); if ((nread = read(file_descriptor, ptr, nleft)) < 0) { if (errno == EINTR) { errno = 0; // clear errno. We never use it anyway. nread = 0; /* and call read() again */ } else { ERROR_DATA("Network data read error\n"); return (-1); } } else if (nread == 0) { break; /* EOF */ } //Debug_Bytes( "NETREAD",ptr, nread ) ; nleft -= nread; ptr += nread; } else if (rc < 0) { /* select error */ if (errno == EINTR) { /* select() was interrupted, try again */ continue; } ERROR_DATA("Selection error (network)\n"); return -EINTR; } else { /* timed out */ LEVEL_CONNECT("TIMEOUT after %d bytes\n", n - nleft); return -EAGAIN; } } return (n - nleft); /* return >= 0 */ } void tcp_read_flush(int file_descriptor) { ASCII buffer[16]; ssize_t nread; int flags = fcntl(file_descriptor, F_GETFL, 0); // Apparently you can test for GET_FL success like this // see http://www.informit.com/articles/article.asp?p=99706&seqNum=13&rl=1 if (flags < 0) return; if (fcntl(file_descriptor, F_SETFL, flags | O_NONBLOCK) < 0) return; while ((nread = read(file_descriptor, (BYTE *) buffer, 16)) > 0) { Debug_Bytes("tcp_read_flush", (BYTE *) buffer, nread); continue; } fcntl(file_descriptor, F_SETFL, flags); } owfs-2.8p15/module/ownet/c/src/c/compat.c0000664000175000017500000001771710750074145015135 00000000000000/* $Id: compat.c,v 1.2 2008/01/30 13:15:17 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #ifndef HAVE_STRSEP /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Get next token from string *stringp, where tokens are possibly-empty * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. * On return, *stringp points past the last NUL written (if there might * be further tokens), or is NULL (if there are definitely no more tokens). * * If *stringp is NULL, strsep returns NULL. */ char *strsep(char **stringp, const char *delim) { char *s; const char *spanp; int c, sc; char *tok; if ((s = *stringp) == NULL) return (NULL); for (tok = s;;) { c = *s++; spanp = delim; do { if ((sc = *spanp++) == c) { if (c == 0) s = NULL; else s[-1] = 0; *stringp = s; return (tok); } } while (sc != 0); } /* NOTREACHED */ } #endif /* !defined(HAVE_STRSEP) */ #ifndef HAVE_TDESTROY /* uClibc older than 0.9.19 is missing tdestroy() (don't know exactly when it was added) I added a replacement to this, just to be able to compile owfs for WRT54G without any patched uClibc. */ #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif static void tdestroy_recurse_(node * root, void (*freefct) (void *)) { if (root->left != NULL) tdestroy_recurse_(root->left, freefct); if (root->right != NULL) tdestroy_recurse_(root->right, freefct); if (root->key) { (*freefct) ((void *) root->key); //free(root->key); root->key = NULL; } /* Free the node itself. */ free(root); } void tdestroy(void *vroot, void (*freefct) (void *)) { node *root = (node *) vroot; if (root != NULL) { tdestroy_recurse_(root, freefct); } } #endif /* HAVE_TDESTROY */ #ifndef HAVE_TSEARCH #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* find or insert datum into search tree. char *key; key to be located register node **rootp; address of tree root int (*compar)(); ordering function */ void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar) { register node *q; register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0) return ((struct node_t *) 0); while (*rootp != (struct node_t *) 0) { /* Knuth's T1: */ int r; if ((r = (*compar) (key, (*rootp)->key)) == 0) /* T2: */ return (*rootp); /* we found it! */ rootp = (r < 0) ? &(*rootp)->left : /* T3: follow left branch */ &(*rootp)->right; /* T4: follow right branch */ } q = (node *) malloc(sizeof(node)); /* T5: key not found */ if (q != (struct node_t *) 0) { /* make new node */ *rootp = q; /* link new node to old */ q->key = (void *) key; /* initialize new node */ q->left = q->right = (struct node_t *) 0; } return (q); } #endif #ifndef HAVE_TFIND #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif void *tfind(__const void *key, void *__const * vrootp, __compar_fn_t compar) { register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0) return ((struct node_t *) 0); while (*rootp != (struct node_t *) 0) { /* Knuth's T1: */ int r; if ((r = (*compar) (key, (*rootp)->key)) == 0) /* T2: */ return (*rootp); /* we found it! */ rootp = (r < 0) ? &(*rootp)->left : /* T3: follow left branch */ &(*rootp)->right; /* T4: follow right branch */ } return NULL; } #endif #ifndef HAVE_TFIND #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* delete node with given key char *key; key to be deleted register node **rootp; address of the root of tree int (*compar)(); comparison function */ void *tdelete(__const void *key, void **vrootp, __compar_fn_t compar) { node *p; register node *q; register node *r; int cmp; register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0 || (p = *rootp) == (struct node_t *) 0) return ((struct node_t *) 0); while ((cmp = (*compar) (key, (*rootp)->key)) != 0) { p = *rootp; rootp = (cmp < 0) ? &(*rootp)->left : /* follow left branch */ &(*rootp)->right; /* follow right branch */ if (*rootp == (struct node_t *) 0) return ((struct node_t *) 0); /* key not found */ } r = (*rootp)->right; /* D1: */ if ((q = (*rootp)->left) == (struct node_t *) 0) /* Left (struct node_t *)0? */ q = r; else if (r != (struct node_t *) 0) { /* Right link is null? */ if (r->left == (struct node_t *) 0) { /* D2: Find successor */ r->left = q; q = r; } else { /* D3: Find (struct node_t *)0 link */ for (q = r->left; q->left != (struct node_t *) 0; q = r->left) r = q; r->left = q->right; q->left = (*rootp)->left; q->right = (*rootp)->right; } } free((struct node_t *) *rootp); /* D4: Free node */ *rootp = q; /* link parent to new node */ return (p); } #endif #ifndef HAVE_TWALK #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* Walk the nodes of a tree register node *root; Root of the tree to be walked register void (*action)(); Function to be called at each node register int level; */ static void trecurse(__const void *vroot, __action_fn_t action, int level) { register node *root = (node *) vroot; if (root->left == (struct node_t *) 0 && root->right == (struct node_t *) 0) (*action) (root, leaf, level); else { (*action) (root, preorder, level); if (root->left != (struct node_t *) 0) trecurse(root->left, action, level + 1); (*action) (root, postorder, level); if (root->right != (struct node_t *) 0) trecurse(root->right, action, level + 1); (*action) (root, endorder, level); } } /* void twalk(root, action) Walk the nodes of a tree node *root; Root of the tree to be walked void (*action)(); Function to be called at each node PTR */ void twalk(__const void *vroot, __action_fn_t action) { register __const node *root = (node *) vroot; if (root != (node *) 0 && action != (__action_fn_t) 0) trecurse(root, action, 0); } #endif owfs-2.8p15/module/ownet/c/Makefile.in0000664000175000017500000005116211756250030014526 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/ownet/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/ownet/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/ownet/c/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/ownet/c/Makefile.am0000664000175000017500000000005710741364106014515 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owtap/0000775000175000017500000000000011756315511012316 500000000000000owfs-2.8p15/module/owtap/owtap.tcl0000664000175000017500000014010511333400543014064 00000000000000#!/bin/sh # the next line restarts using wish \ if [ -z `which wish` ] ; then exec tclsh "$0" -- "$@" ; else exec wish "$0" -- "$@" ; fi # $Id: owtap.tcl,v 1.47 2010/02/06 23:55:15 alfille Exp $ package require Tk # Global: IPAddress() loose tap server # -- port number of this program (tap) and real owserver (server). loose is stray garbage set SocketVars {string version type payload size sg offset tokenlength totallength paylength typetext ping state sock versiontext flagtext persist return id } set MessageList {ERROR NOP READ WRITE DIR SIZE PRESENCE DIRALL GET DIRALLSLASH GETSLASH} set MessageListPlus $MessageList lappend MessageListPlus PING BadHeader Unknown Total # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html set HttpList [list "GET " POST HEAD CONN "PUT " DELE TRAC] set stats(clientlist) {} set setup_flags(detail_list) {} # Global: setup_flags => For object-oriented initialization # Global: serve => information on current transaction # serve($sock.string) -- message to this point # serve($sock. version size payload sg offset type tokenlength ) -- message parsed parts # serve($sock.version size # serve(sockets) -- list of active sockets for timeout # Global: stats => statistical counts and flags for stats windows # Global: circ_buffer => data for the last n transactions displayed in the listboxes #Main procedure. We actually start it at the end, to allow Proc-s to be defined first. proc Main { argv } { ArgumentProcess CircBufferSetup 50 DisplaySetup StatsSetup SetupTap } # Command line processing # looks at command line arguments # two options "p" and "s" for (this) tap's _p_ort, and the target ow_s_erver port # Can handle command lines like # -p 3000 -s 3001 # -p3000 -s 3001 # etc proc ArgumentProcess { } { global IPAddress set mode "loose" # "Clear" ports # INADDR_ANY # tk_messageBox -message "$::argv" -type ok set IPAddress(tap.ip) "0.0.0.0" set IPAddress(tap.port) "0" set IPAddress(server.ip) "0.0.0.0" set IPAddress(server.port) "4304" foreach a $::argv { if { [regexp -- {^-p(.*)$} $a whole address] } { set mode "tap" } elseif { [regexp -- {^-s(.*)$} $a whole address] } { set mode "server" } else { set address $a } IPandPort $mode $address } MainTitle $IPAddress(tap.ip):$IPAddress(tap.port) $IPAddress(server.ip):$IPAddress(server.port) } proc IPandPort { mode argument_string } { global IPAddress if { [regexp -- {^(.*?):(.*)$} $argument_string wholestring firstpart secondpart] } { if { $firstpart != "" } { set IPAddress($mode.ip) $firstpart } if { $secondpart != "" } { set IPAddress($mode.port) $secondpart } } else { if { $argument_string != "" } { set IPAddress($mode.port) $argument_string } } } # Accept from client (our "server" portion) proc SetupTap { } { global IPAddress StatusMessage "Attempting to open surrogate server on $IPAddress(tap.ip):$IPAddress(tap.port)" if {[catch {socket -server TapAccept -myaddr $IPAddress(tap.ip) $IPAddress(tap.port)} result] } { ErrorMessage $result } StatusMessage "Success. Tap server address=[PrettySock $result]" MainTitle [PrettySock $result] $IPAddress(server.ip):$IPAddress(server.port) } #Main loop. Called whenever the server (listen) port accepts a connection. proc TapAccept { sock addr port } { global serve global stats # Start the State machine set serve($sock.state) "Open client" while {1} { #puts $serve($sock.state) switch $serve($sock.state) { "Open client" { StatusMessage "Reading client request from $addr port $port" 0 set persist 0 fconfigure $sock -buffering full -translation binary -encoding binary -blocking 0 set serve($sock.state) "Persistent loop" } "Persistent loop" { TapSetup $sock set serve($sock.sock) $sock set current [CircBufferAllocate] set serve($sock.state) "Read client" } "Read client" { # wait a long time (3hr) for very first packet ResetSockTimer $sock 10000000 fileevent $sock readable [list TapProcess $sock] # ShowMessage $sock vwait serve($sock.state) } "Process client packet" { fileevent $sock readable {} ClearSockTimer $sock StatusMessage "Success reading client request" 0 set message_type $serve($sock.typetext) CircBufferEntryRequest $current "$addr:$port $message_type $serve($sock.payload) bytes" $serve($sock.string) AddClient $addr:$port #stats RequestStatsIncr $sock 0 # now owserver if {$persist>0} { set serve($sock.state) "Send to server" } else { set serve($sock.state) "Open server" } } "Client early end" { StatusMessage "Client dropped connection" CircBufferEntryRequest $current "Client done" $serve($sock.string) CircBufferEntryResponse $current "" RequestStatsIncr $sock 1 set serve($sock.state) "Done with client" } "Web client" { StatusMessage "Error: owtap is not a web server" CircBufferEntryRequest $current "Not a web server" CircBufferEntryResponse $current "" RequestStatsIncr $sock 1 WebResponse $sock set serve($sock.state) "Done with client" } "Open server" { global IPAddress StatusMessage "Attempting to open connection to OWSERVER" 0 if {[catch {socket $IPAddress(server.ip) $IPAddress(server.port)} relay] } { set serve($sock.state) "Unopened server" } else { set serve($sock.state) "Send to server" } } "Unopened server" { StatusMessage "OWSERVER error: $relay at $IPAddress(server.ip):$IPAddress(server.port)" set serve($relay.string) {} CircBufferEntryResponse $current "owserver not responding" set serve($sock.state) "Done with client" } "Send to server" { StatusMessage "Sending client request to OWSERVER" 0 fconfigure $relay -translation binary -buffering full -encoding binary -blocking 0 set serve($relay.sock) $sock puts -nonewline $relay $serve($sock.string) flush $relay set serve($sock.state) "Read from server" } "Read from server" { StatusMessage "Reading OWSERVER response" 0 TapSetup $relay ResetSockTimer $relay fileevent $relay readable [list RelayProcess $relay] vwait serve($sock.state) } "Server early end" { StatusMessage "FAILURE reading OWSERVER response" 0 ResponseStatsIncr $relay 1 CircBufferEntryResponse $current "network read error" $serve($relay.string) set serve($sock.state) "Done with server" } "Process server packet" { StatusMessage "Success reading OWSERVER response" 0 ResponseAdd $relay fileevent $relay readable {} CircBufferEntryResponse $current $serve($relay.return) $serve($relay.string) #stats ResponseStatsIncr $relay 0 set serve($sock.state) "Send to client" } "Send to client" { ClearSockTimer $relay StatusMessage "Sending OWSERVER response to client" 0 puts -nonewline $sock $serve($relay.string) flush $sock # filter out the multi-response types and continue listening if { $serve($relay.ping) == 1 } { set serve($sock.state) "Ping received" } elseif { ( $message_type=="DIR" ) && ($serve($relay.paylength)>0)} { set serve($sock.state) "Dir element received" } else { set serve($sock.state) "Persistent test" } } "Ping received" { set serve($sock.state) "Read from server" } "Dir element received" { set serve($sock.state) "Read from server" } "Persistent test" { if { $serve($relay.persist)==1 } { StatPersistCounter $persist incr persist ClearTap $sock ClearTap $relay set serve($sock.state) "Persistent loop" } else { set serve($sock.state) "Done with server" } } "Server timeout" { CircBufferEntryResponse $current "owserver read timeout" set serve($sock.state) "Done with server" } "Done with server" { CloseSock $relay set serve($sock.state) "Done with client" } "Client timeout" { CircBufferEntryRequest $current "client read timeout" CircBufferEntryResponse $current "" set serve($sock.state) "Done with client" } "Done with client" { CloseSock $sock set serve($sock.state) "Done with all" } "Done with all" { StatusMessage "Ready" 0 return } default { StatusMessage "Internal error -- bad state: $serve($sock.state)" 1 return } } } } # initialize statistics proc StatsSetup { } { global stats global MessageListPlus foreach x $MessageListPlus { set stats($x.tries) 0 set stats($x.errors) 0 set stats($x.rate) 0 set stats($x.request_bytes) 0 set stats($x.response_bytes) 0 } foreach x { request_yes request_no grant refuse -1 0 denominator max request_rate grant_rate } { set stats(persistence_length.$x) 0 } set stats(persistence_length.15plus) 0 } # increment stats for request proc RequestStatsIncr { sock is_error} { global stats global serve set message_type $serve($sock.typetext) set length [string length $serve($sock.string)] incr stats($message_type.tries) incr stats($message_type.errors) $is_error set stats($message_type.rate) [expr {100 * $stats($message_type.errors) / $stats($message_type.tries)} ] incr stats($message_type.request_bytes) $length incr stats(Total.tries) incr stats(Total.errors) $is_error set stats(Total.rate) [expr {100 * $stats(Total.errors) / $stats(Total.tries)} ] incr stats(Total.request_bytes) $length # persistence stats if { [info exist serve($sock.persist)] } { if { $serve($sock.persist) == 0 } { incr stats(persistence_length.request_no) } else { incr stats(persistence_length.request_yes) incr stats(persistence_length.refuse) set stats(persistence_length.grant_rate) [expr {100 * $stats(persistence_length.grant) / $stats(persistence_length.request_yes)}] } set stats(persistence_length.request_rate) [expr { 100 * $stats(persistence_length.request_yes) / $stats(Total.tries) }] } } # increment stats for request proc ResponseStatsIncr { sock is_error} { global stats global serve set message_type $serve($serve($sock.sock).typetext) set length [string length $serve($sock.string)] incr stats($message_type.errors) $is_error set stats($message_type.rate) [expr {100 * $stats($message_type.errors) / $stats($message_type.tries)} ] incr stats($message_type.response_bytes) $length incr stats(Total.errors) $is_error set stats(Total.rate) [expr {100 * $stats(Total.errors) / $stats(Total.tries)} ] incr stats(Total.response_bytes) $length } # Counter of Persistence lengths proc StatPersistCounter { persist } { global stats # max persistence length if { $persist > $stats(persistence_length.max) } { set stats(persistence_length.max) $persist set stats(persistence_length.$persist) 0 } # increment this bin (and decrement prior) if { $persist==0 } { incr stats(persistence_length.denominator) } set old_persist [expr {$persist-1}] incr stats(persistence_length.$old_persist) -1 if { $persist == 16 } { incr stats(persistence_length.15plus) } incr stats(persistence_length.$persist) incr stats(persistence_length.grant) incr stats(persistence_length.refuse) -1 set stats(persistence_length.grant_rate) [expr {100 * $stats(persistence_length.grant) / $stats(persistence_length.request_yes)}] set length_sum 0 for {set x 0} {$x <= $stats(persistence_length.max)} {incr x} { incr length_sum [expr {$stats(persistence_length.$x) * $x}] } set stats(persistence_length.mean) [expr {($length_sum)/$stats(persistence_length.denominator)}] } # Initialize array for client request proc TapSetup { sock } { global serve set serve($sock.string) "" set serve($sock.totallength) 0 } # Clear out client request array after a connection (frees memory) proc ClearTap { sock } { global serve global SocketVars foreach x $SocketVars { if { [info exist serve($sock.$x)] } { unset serve($sock.$x) } } if { [info exist serve($sock.num] } { for {set i $serve($sock.num)} {$i >= 0} {incr i -1} { unset serve($sock.$i) } unset serve($sock.num) } } proc ResponseAdd { sock } { global serve if { [info exist serve($sock.num)] } { incr serve($sock.num) } else { set serve($sock.num) 0 } set serve($sock.$serve($sock.num)) $serve($sock.string) } # close client request socket proc SockTimeout { sock } { global serve switch $serve($serve($sock.sock).state) { "Read client" { set serve($serve($sock.sock).state) "Client timeout" } "Read from server" { set serve($serve($sock.sock).state) "Server timeout" } default { ErrorMessage "Strange timeout for $sock state=$serve($serve($sock.sock).state)" set serve($serve($sock.sock).state) "Server timeout" } } StatusMessage "Network read timeout [PrettySock $sock]" 1 } # close client request socket proc CloseSock { sock } { global serve ClearSockTimer $sock close $sock ClearTap $sock } proc ClearSockTimer { sock } { global serve if { [info exist serve($sock.id)] } { after cancel $serve($sock.id) unset serve($sock.id) } } proc ResetSockTimer { sock { msec 2000 } } { global serve ClearSockTimer $sock set serve($sock.id) [after $msec [list SockTimeout $sock ]] } # Wrapper for processing -- either change a vwait var, or just return waiting for more network traffic proc TapProcess { sock } { global serve set read_value [ReadProcess $sock] switch $read_value { "Web client" { set serve($sock.state) "Web client" } "Client early end" { set serve($sock.state) "Client early end" } "Packet reloop" { return } "Process packet" { set serve($sock.state) "Process client packet" } } TypeParser serve $sock } # Process a oncomming owserver packet, adjusting size from header information proc ReadProcess { sock } { global serve # test eof if { [eof $sock] } { return "Client early end" } # read what's waiting set new_string [read $sock] if { $new_string == {} } { return "Packet reloop" } append serve($sock.string) $new_string ResetSockTimer $sock set len [string length $serve($sock.string)] if { $len < 24 } { #do nothing -- reloop return "Packet reloop" } elseif { $serve($sock.totallength) == 0 } { # Look for web browser global HttpList if { [lsearch -exact $HttpList [string range $serve($sock.string) 0 3]] >= 0 } { return "Web client" } # at least header is in HeaderParser serve $sock $serve($sock.string) } #already in payload (and token) portion if { $len < $serve($sock.totallength) } { #do nothing -- reloop return "Packet reloop" } # Fully parsed set new_length [string length $serve($sock.string)] return "Process packet" } # Wrapper for processing -- either change a vwait var, or just return waiting for more network traffic proc RelayProcess { relay } { global serve set read_value [ReadProcess $relay] #puts "Current length [string length $serve($relay.string)] return val=$read_value" switch $read_value { "Web client" - "Client early end" { set serve($serve($relay.sock).state) "Server early end"} "Packet reloop" { return } "Process packet" { set serve($serve($relay.sock).state) "Process server packet" } } ErrorParser serve $relay #puts $serve($serve($relay.sock).typetext) # ShowMessage $relay } # Debugging routine -- show all the packet info proc ShowMessage { sock } { global serve global SocketVars foreach x $SocketVars { if { [info exist serve($sock.$x)] } { puts "\t$sock.$x = $serve($sock.$x)" } } } # callback from scrollbar, moves each listbox field proc ScrollTogether { args } { eval {.log.request_list yview} $args eval {.log.response_list yview} $args } # scroll other listbox and scrollbar proc Left_ScrollByKey { args } { eval { .log.transaction_scroll set } $args .log.response_list yview moveto [lindex [.log.request_list yview] 0 ] .log.response_list activate [.log.request_list index active ] } # scroll other listbox and scrollbar proc Right_ScrollByKey { args } { eval { .log.transaction_scroll set } $args .log.request_list yview moveto [lindex [.log.response_list yview] 0 ] .log.request_list activate [.log.response_list index active ] } # Selection from listbox proc SelectionMade { widget y } { set index [ $widget nearest $y ] if { $index >= 0 } { TransactionDetail [current_from_index $index] } } # create visual aspects of program proc DisplaySetup { } { global circ_buffer # Top pane, tranaction logs frame .log -bg yellow scrollbar .log.transaction_scroll -command [ list ScrollTogether ] label .log.request_title -text "Client request" -bg yellow -relief ridge label .log.response_title -text "Owserver response" -bg yellow -relief ridge listbox .log.request_list -width 40 -height 10 -selectmode single -yscroll [list Left_ScrollByKey ] -bg lightyellow listbox .log.response_list -width 40 -height 10 -selectmode single -yscroll [list Right_ScrollByKey] -bg lightyellow foreach lb {request_list response_list} { bind .log.$lb {+ SelectionMade %W %y } bind .log.$lb {+ SelectionMade %W } } grid .log.request_title -row 0 -column 0 -sticky news grid .log.response_title -row 0 -column 1 -sticky news grid .log.request_list -row 1 -column 0 -sticky news grid .log.response_list -row 1 -column 1 -sticky news grid .log.transaction_scroll -row 1 -column 2 -sticky news pack .log -side top -fill x -expand true #bottom pane, status label .status -anchor w -width 80 -relief sunken -height 1 -textvariable current_status -bg white pack .status -side bottom -fill x bind .status [list .main_menu.view invoke "Status messages"] SetupMenu } # Menu construction proc SetupMenu { } { global stats # toplevel . -menu .main_menu menu .main_menu -tearoff 0 . config -menu .main_menu # file menu menu .main_menu.file -tearoff 0 .main_menu add cascade -label File -menu .main_menu.file -underline 0 .main_menu.file add command -label "Log to File..." -underline 0 -command SaveLog -state disabled .main_menu.file add command -label "Stop logging" -underline 0 -command SaveAsLog -state disabled .main_menu.file add separator .main_menu.file add command -label "Restart" -underline 0 -command Restart .main_menu.file add separator .main_menu.file add command -label "Quit" -underline 0 -command exit # statistics menu menu .main_menu.view -tearoff 0 .main_menu add cascade -label View -menu .main_menu.view -underline 0 .main_menu.view add checkbutton -label "Statistics by Message type" -underline 14 -indicatoron 1 -command {StatByType} .main_menu.view add checkbutton -label "Persistence rates" -underline 12 -indicatoron 1 -command {RatePersist} .main_menu.view add checkbutton -label "Persistence lengths" -underline 12 -indicatoron 1 -command {LengthPersist} .main_menu.view add separator .main_menu.view add checkbutton -label "Detail window list" -underline 0 -indicatoron 1 -command {DetailList} .main_menu.view add separator .main_menu.view add checkbutton -label "Clients" -underline 0 -indicatoron 1 -command {StatByClient} .main_menu.view add separator .main_menu.view add checkbutton -label "Status messages" -underline 0 -indicatoron 1 -command {StatusWindow} # help menu menu .main_menu.help -tearoff 0 .main_menu add cascade -label Help -menu .main_menu.help -underline 0 .main_menu.help add command -label "About OWTAP" -underline 0 -command About .main_menu.help add command -label "Command Line" -underline 0 -command CommandLine .main_menu.help add command -label "OWSERVER Protocol" -underline 0 -command Protocol .main_menu.help add command -label "Version" -underline 0 -command Version } # error routine -- popup and exit proc ErrorMessage { msg } { StatusMessage "Fatal error -- $msg" tk_messageBox -title "Fatal error" -message $msg -type ok -icon error exit 1 } # status -- set status message # possibly store past messages # Use priority to test if should be stored proc StatusMessage { msg { priority 1 } } { global current_status set current_status $msg if { $priority > 0 } { global status_messages lappend status_messages $msg if { [llength $status_messages] > 50 } { set status_messages [lreplace $status_messages 0 0] } } } # Circular buffer for past connections # size is number of elements proc CircBufferSetup { size } { global circ_buffer set circ_buffer(size) $size set circ_buffer(total) -1 } # Save a spot for the coming connection proc CircBufferAllocate { } { global circ_buffer set size $circ_buffer(size) incr circ_buffer(total) set total $circ_buffer(total) set cb_index [ expr { $total % $size } ] if { $total >= $size } { # delete top listbox entry (oldest) .log.request_list delete 0 .log.response_list delete 0 # clear old entry if { [info exist circ_buffer($cb_index.num)] } { set num $circ_buffer($cb_index.num) for {set x 0} { $x < $num } {incr x} { unset circ_buffer($cb_index.response.$x) } } } set circ_buffer($cb_index.num) 0 set circ_buffer($cb_index.request) "" .log.request_list insert end "$total: pending" .log.response_list insert end "$total: pending" return $total } # place a new request packet proc CircBufferEntryRequest { current request {transaction_string "" } } { global circ_buffer set size $circ_buffer(size) set total $circ_buffer(total) if { [expr {$current + $size}] <= $total } { StatusMessage "Packet buffer history overflow. (nonfatal)" 0 return } # Still filling for the first time? if { $total < $size } { set index $current } else { set index [ expr $size - $total + $current - 1 ] } .log.request_list insert $index $request .log.request_list delete [expr $index + 1 ] #Now store packet set cb_index [ expr { $current % $size } ] set circ_buffer($cb_index.request) $transaction_string } # place a new response packet proc CircBufferEntryResponse { current response {transaction_string "" } } { global circ_buffer set size $circ_buffer(size) set total $circ_buffer(total) if { [expr {$current + $size}] <= $total } { StatusMessage "Packet buffer history overflow. (nonfatal)" 0 return } # Still filling for the first time? if { $total < $size } { set index $current } else { set index [ expr $size - $total + $current - 1 ] } .log.response_list insert $index "$current: $response" .log.response_list delete [expr $index + 1 ] #Now store packet set cb_index [ expr { $current % $size } ] set circ_buffer($cb_index.response.$circ_buffer($cb_index.num)) $transaction_string incr circ_buffer($cb_index.num) } # get the slot in the circ_buffer from the listbox index proc cb_from_index { index } { global circ_buffer set size $circ_buffer(size) set total $circ_buffer(total) if { $total < $size } { return $index } return [expr { ($total + $index) % $size }] } # get the total list from listbox index proc current_from_index { index } { global circ_buffer set size $circ_buffer(size) set total $circ_buffer(total) if { $total < $size } { return $index } return [expr { $total + $index - $size + 1 }] } # Popup giving attribution proc About { } { tk_messageBox -type ok -title {About owtap} -message { Program: owtap Synopsis: owserver protocol inspector Description: owtap is interposed between owserver and client. The communication is logged and shown on screen. All messages are transparently forwarded between client and server. Author: Paul H Alfille Copyright: July 2007 GPL 2.0 license Website: http://www.owfs.org } } # Popup giving commandline proc CommandLine { } { tk_messageBox -type ok -title {owtap command line} -message { syntax: owtap.tcl -s serverport -p tapport server port is the address of owserver tapport is the port assigned this program Usage (owdir example) If owserver was invoked as: owserver -p 3000 -u a client (say owdir) would normally call: owdir -s 3000 / To use owtap, invoke it with owtap.tcl -s 3000 -p 4000 and now call owdir with: owdir -s 4000 / } } # Popup giving version proc Version { } { regsub -all {[$:a-zA-Z]} {$Revision: 1.47 $} {} Version regsub -all {[$:a-zA-Z]} {$Date: 2010/02/06 23:55:15 $} {} Date tk_messageBox -type ok -title {owtap version} -message " Version $Version Date $Date " } # Popup on protocol proc Protocol { } { tk_messageBox -type ok -title {owserver protocol} -message { The owserver protocol is a tcp/ip protocol for communication between owserver and clients. It is recognized as a "well known port" by the IANA (4304) and has an associated mDNS service (_owserver._tcp). Datails can be found at: http://www.owfs.org/index.php?page=owserver-protocol } } # Show a list of detail windows proc DetailList { } { set window_name .detaillist set menu_name .main_menu.view set menu_index "Detail window list" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global setup_flags listbox $window_name.lb -listvariable setup_flags(detail_list) -width 30 -yscrollcommand [list $window_name.sb set] -selectmode extended -bg lightyellow scrollbar $window_name.sb -command [list $window_name.lb yview] set f [frame $window_name.f] set all [button $f.all -text All -command [list $window_name.lb selection set 0 end]] set none [button $f.none -text None -command [list $window_name.lb selection clear 0 end]] set delete [button $f.close -text "Close selected" -command [list DetailClear $window_name.lb]] pack $all -side left pack $none -side left pack $delete -side right pack $f -side bottom -fill x pack $window_name.sb -side right -fill y pack $window_name.lb -side left -fill both -expand true } proc DetailClear { list_box } { foreach i [$list_box curselection] { lappend windows [$list_box get $i] } foreach w $windows { DetailDelete $w } } proc DetailDelete { window_name } { global setup_flags set i [lsearch -exact $setup_flags(detail_list) $window_name] if { $i >= 0 } { set setup_flags(detail_list) [lreplace $setup_flags(detail_list) $i $i] } destroy $window_name } # Client list proc AddClient { client } { global ClientList if { [info exist ClientList($client)] } { incr ClientList($client) } else { set ClientList($client) 1 } global setup_flags if { [ info exist setup_flags(.clientlist) ] } { BuildClientList } } proc BuildClientList { } { global stats global ClientList set l {} foreach {k v} [array get ClientList] { lappend l [format {%20.20s %8d} $k $v] } set stats(clientlist) $l } # Show a table of Past status messages proc StatByClient { } { set window_name .clientlist set menu_name .main_menu.view set menu_index "Clients" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global stats BuildClientList listbox $window_name.lb -listvariable stats(clientlist) -width 30 -yscrollcommand [list $window_name.sb set] -bg lightyellow scrollbar $window_name.sb -command [list $window_name.lb yview] pack $window_name.sb -side right -fill y pack $window_name.lb -side left -fill both -expand true } # Show a table of Past status messages proc LengthPersist { } { set window_name .lengthpersistwindow set menu_name .main_menu.view set menu_index "Persistence lengths" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global stats label $window_name.at -text "Length" -bg blue -fg white grid $window_name.at -row 0 -column 0 -sticky news label $window_name.bt -text "Count" -bg blue -fg white grid $window_name.bt -row 0 -column 1 -sticky news label $window_name.ax -textvariable stats(persistence_length.max) -bg lightyellow grid $window_name.ax -row 1 -column 0 -sticky news label $window_name.bx -text "Max" -bg lightyellow grid $window_name.bx -row 1 -column 1 -sticky news label $window_name.am -textvariable stats(persistence_length.mean) -bg lightyellow grid $window_name.am -row 2 -column 0 -sticky news label $window_name.bm -text "Mean" -bg lightyellow grid $window_name.bm -row 2 -column 1 -sticky news set row 3 set bg white for {set x 0} {$x < 16} {incr x} { label $window_name.a${x} -text $x -bg $bg grid $window_name.a${x} -row $row -column 0 -sticky news label $window_name.b${x} -textvariable stats(persistence_length.$x) -bg $bg grid $window_name.b${x} -row $row -column 1 -sticky news if {$bg=="white"} { set bg lightyellow} else {set bg white} incr row } label $window_name.ap -text "> 15" -bg $bg grid $window_name.ap -row $row -column 0 -sticky news label $window_name.bp -textvariable stats(persistence_length.15plus) -bg $bg grid $window_name.bp -row $row -column 1 -sticky news } # Show a table of Past status messages proc RatePersist { } { set window_name .ratepersistwindow set menu_name .main_menu.view set menu_index "Persistence rates" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global stats label $window_name.a0 -text "Persistence" -bg blue -fg white grid $window_name.a0 -row 0 -column 0 -sticky news label $window_name.a1 -text "Requests" -bg lightblue grid $window_name.a1 -row 1 -column 0 -sticky news label $window_name.a2 -text "Granted" -bg lightblue grid $window_name.a2 -row 2 -column 0 -sticky news label $window_name.b0 -text "number" -bg yellow grid $window_name.b0 -row 0 -column 1 -sticky news label $window_name.b1 -textvariable stats(persistence_length.request_yes) -bg white grid $window_name.b1 -row 1 -column 1 -sticky news label $window_name.b2 -textvariable stats(persistence_length.grant) -bg white grid $window_name.b2 -row 2 -column 1 -sticky news label $window_name.c0 -text "total" -bg orange grid $window_name.c0 -row 0 -column 2 -sticky news label $window_name.c1 -textvariable stats(Total.tries) -bg lightyellow grid $window_name.c1 -row 1 -column 2 -sticky news label $window_name.c2 -textvariable stats(persistence_length.request_yes) -bg lightyellow grid $window_name.c2 -row 2 -column 2 -sticky news label $window_name.d0 -text "rate %" -bg yellow grid $window_name.d0 -row 0 -column 3 -sticky news label $window_name.d1 -textvariable stats(persistence_length.request_rate) -bg white grid $window_name.d1 -row 1 -column 3 -sticky news label $window_name.d2 -textvariable stats(persistence_length.grant_rate) -bg white grid $window_name.d2 -row 2 -column 3 -sticky news } # Show a table of Past status messages proc StatusWindow { } { set window_name .statuswindow set menu_name .main_menu.view set menu_index "Status messages" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global status_messages # create status window scrollbar $window_name.xsb -orient horizontal -command [list $window_name.lb xview] pack $window_name.xsb -side bottom -fill x -expand 1 scrollbar $window_name.ysb -orient vertical -command [list $window_name.lb yview] pack $window_name.ysb -fill y -expand 1 -side right listbox $window_name.lb -listvar status_messages -bg white -yscrollcommand [list $window_name.ysb set] -xscrollcommand [list $window_name.xsb set] -width 80 pack $window_name.lb -fill both -expand 1 -side left } #proc window handler for statistics and status windows #return 1 if old, 0 if new proc WindowAlreadyExists { window_name menu_name menu_index } { global setup_flags if { [ info exist setup_flags($window_name) ] } { if { $setup_flags($window_name) } { # hide window wm withdraw $window_name set setup_flags($window_name) 0 } else { # show window wm deiconify $window_name set setup_flags($window_name) 1 } return 1 } # create window toplevel $window_name wm title $window_name $menu_index # delete handler wm protocol $window_name WM_DELETE_WINDOW [list $menu_name invoke $menu_index] # now set flag set setup_flags($window_name) 1 return 0 } # Show a table of packets and bytes by type (DIR, READ,...) # Separate window that is pretty self contained. # Data values use -textvariable so auto-update # linked by "globals" for variables and types # linked my menu position and index (checkbox) # catches delete and hides instead (via menu action) proc StatByType { } { set window_name .statbytype set menu_name .main_menu.view set menu_index "Statistics by Message type" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global stats global MessageListPlus # create stats window set column_number 0 label $window_name.l${column_number}0 -text "Type" -bg blue -fg white grid $window_name.l${column_number}0 -row 0 -column $column_number -sticky news label $window_name.l${column_number}1 -text "Packets" -bg lightblue grid $window_name.l${column_number}1 -row 1 -column $column_number -sticky news label $window_name.l${column_number}2 -text "Errors" -bg lightblue grid $window_name.l${column_number}2 -row 2 -column $column_number -sticky news label $window_name.l${column_number}3 -text "Error %" -bg lightblue grid $window_name.l${column_number}3 -row 3 -column $column_number -sticky news frame $window_name.ff4 -bg blue grid $window_name.ff4 -column 1 -row 0 label $window_name.l${column_number}5 -text "bytes in" -bg lightblue grid $window_name.l${column_number}5 -row 5 -column $column_number -sticky news label $window_name.l${column_number}6 -text "bytes out" -bg lightblue grid $window_name.l${column_number}6 -row 6 -column $column_number -sticky news set bgcolor white set bgcolor2 yellow foreach x $MessageListPlus { incr column_number label $window_name.${column_number}0 -text $x -bg $bgcolor2 grid $window_name.${column_number}0 -row 0 -column $column_number -sticky news label $window_name.${column_number}1 -textvariable stats($x.tries) -bg $bgcolor grid $window_name.${column_number}1 -row 1 -column $column_number -sticky news label $window_name.${column_number}2 -textvariable stats($x.errors) -bg $bgcolor grid $window_name.${column_number}2 -row 2 -column $column_number -sticky news label $window_name.${column_number}3 -textvariable stats($x.rate) -bg $bgcolor grid $window_name.${column_number}3 -row 3 -column $column_number -sticky news label $window_name.${column_number}5 -textvariable stats($x.request_bytes) -bg $bgcolor grid $window_name.${column_number}5 -row 5 -column $column_number -sticky news label $window_name.${column_number}6 -textvariable stats($x.response_bytes) -bg $bgcolor grid $window_name.${column_number}6 -row 6 -column $column_number -sticky news if { $bgcolor == "white" } { set bgcolor lightyellow } else { set bgcolor white } if { $bgcolor2 == "yellow" } { set bgcolor2 orange } else { set bgcolor2 yellow } } frame $window_name.f4 -bg yellow grid $window_name.f4 -column 1 -row 4 -columnspan [llength MessageListPlus] } #make a window that has to be dismissed by hand proc TransactionDetail { index } { # make a unique window name global setup_flags set window_name .transaction_$index # Does the window exist? if { [winfo exists $window_name] == 1 } { raise $window_name return } # Make the window toplevel $window_name -bg white wm title $window_name "Transaction $index" set cb_index [cb_from_index $index] RequestDetail $window_name $cb_index ResponseDetail $window_name $cb_index # Add to a list set l [concat $setup_flags(detail_list) $window_name] set setup_flags(detail_list) [lsort -unique $l] # delete handler wm protocol $window_name WM_DELETE_WINDOW [list DetailDelete $window_name ] } # Parse for return HeaderParser proc ErrorParser { array_name prefix } { upvar 1 $array_name a_name set a_name($prefix.return) [DetailReturn a_name $prefix] } # Parse for TYPE after HeaderParser proc TypeParser { array_name prefix } { upvar 1 $array_name a_name global MessageList if { $a_name($prefix.totallength) < 24 } { set a_name($prefix.typetext) BadHeader return } set type [lindex $MessageList $a_name($prefix.type)] if { $type == {} } { set a_name($prefix.typetext) Unknown return } set a_name($prefix.typetext) $type } #Parse header information and place in array # works for request or response (though type is "ret" in response) proc HeaderParser { array_name prefix string_value } { upvar 1 $array_name a_name set length [string length $string_value] foreach x {version payload type flags size offset typetext} { set a_name($prefix.$x) "" } foreach x {paylength tokenlength totallength ping} { set a_name($prefix.$x) 0 } binary scan $string_value {IIIIII} a_name($prefix.version) a_name($prefix.payload) a_name($prefix.type) a_name($prefix.flags) a_name($prefix.size) a_name($prefix.offset) if { $length < 24 } { set a_name($prefix.totallength) $length set a_name($prefix.typetext) BadHeader return } if { $a_name($prefix.payload) == -1 } { set a_name($prefix.paylength) 0 set a_name($prefix.ping) 1 } else { set a_name($prefix.paylength) $a_name($prefix.payload) } set version $a_name($prefix.version) set flags $a_name($prefix.flags) set tok [expr { $version & 0xFFFF}] set ver [expr { $version >> 16}] set a_name($prefix.persist) [expr {($flags&0x04)?1:0}] set a_name($prefix.versiontext) "T$tok V$ver" set a_name($prefix.flagtext) [DetailFlags $flags] set a_name($prefix.tokenlength) [expr {$tok * 16} ] set a_name($prefix.totallength) [expr {$a_name($prefix.tokenlength)+$a_name($prefix.paylength)+24}] } # Request portion proc RequestDetail { window_name cb_index } { global circ_buffer DetailRow $window_name yellow orange version payload type flags size offset # get request data HeaderParser q x $circ_buffer($cb_index.request) # request headers DetailRow $window_name white lightyellow $q(x.version) $q(x.payload) $q(x.type) $q(x.flags) $q(x.size) $q(x.offset) # request headers if { [string length $circ_buffer($cb_index.request)] >= 24 } { TypeParser q x DetailRow $window_name white lightyellow $q(x.versiontext) $q(x.paylength) $q(x.typetext) $q(x.flagtext) $q(x.size) $q(x.offset) if { $q(x.paylength) > 0 } { switch $q(x.typetext) { "WRITE" { DetailPayloadPlus $window_name lightyellow white $circ_buffer($cb_index.request) $q(x.paylength) $q(x.size) } default { DetailPayload $window_name lightyellow $circ_buffer($cb_index.request) $q(x.paylength) } } } wm title $window_name "[wm title $window_name]: $q(x.typetext)" } } # Response portion proc ResponseDetail { window_name cb_index } { global circ_buffer DetailRow $window_name #a6dcff #a6b1ff version payload return flags size offset # get response data set num $circ_buffer($cb_index.num) for {set i 0} {$i < $num} {incr i} { HeaderParser r x $circ_buffer($cb_index.response.$i) set offset $r(x.offset) DetailRowPlus $window_name white #EEEEFF $i $r(x.version) $r(x.payload) $r(x.type) $r(x.flags) $r(x.size) $offset if { [string length $circ_buffer($cb_index.response.$i)] >= 24 } { ErrorParser r x switch [$window_name.x22 cget -text] { "DIR" - "DIRALL" {set offset [DetailOffset $offset]} "DIRALLSLASH" {set offset [DetailOffset $offset]} } DetailRow $window_name white #EEEEFF $r(x.versiontext) [expr {$r(x.ping)?"PING":$r(x.paylength)}] $r(x.return) $r(x.flagtext) $r(x.size) $offset DetailPayload $window_name #EEEEFF $circ_buffer($cb_index.response.$i) $r(x.paylength) } } } proc DetailPayload { window_name color full_string payload } { DetailText $window_name $color [string range $full_string 24 [expr {$payload + 24}] ] } proc DetailPayloadPlus { window_name color1 color2 full_string payload size } { set endpay [expr {24+$payload-$size-1}] DetailText $window_name $color1 [string range $full_string 24 $endpay ] incr endpay DetailText $window_name $color2 [string range $full_string $endpay [expr {$payload + 24}] ] } proc DetailText { window_name color text_string } { set row [lindex [grid size $window_name] 1] set columns [lindex [grid size $window_name] 0] label $window_name.t${row} -text $text_string -bg $color -relief ridge -wraplength 640 -justify left -anchor w grid $window_name.t${row} -row $row -columnspan $columns -sticky news } # Standard detail row, one cell per value proc DetailRow { window_name color1 color2 v0 v1 v2 v3 v4 v5 } { set row [lindex [grid size $window_name] 1] set w0 [label $window_name.x${row}0 -text $v0 -bg $color1] DetailRowRest $window_name $color1 $color2 $row $w0 $v1 $v2 $v3 $v4 $v5 } # Augmented detail row, one cell per value, plus num in blue proc DetailRowPlus { window_name color1 color2 num v0 v1 v2 v3 v4 v5 } { set row [lindex [grid size $window_name] 1] set w0 [frame $window_name.x${row}0 -bd 0 -relief flat] set n0 [label $w0.n -text $num -bg #a6b1ff -fg white] set m0 [label $w0.m -text $v0 -bg $color1] pack $n0 -side left -anchor w -fill none pack $m0 -side right -fill x -expand 1 DetailRowRest $window_name $color1 $color2 $row $w0 $v1 $v2 $v3 $v4 $v5 } # first element could be augmented by packet number # adds row and widget for first cell instead of value proc DetailRowRest { window_name color1 color2 row w0 v1 v2 v3 v4 v5 } { label $window_name.x${row}1 -text $v1 -bg $color2 label $window_name.x${row}2 -text $v2 -bg $color1 label $window_name.x${row}3 -text $v3 -bg $color2 label $window_name.x${row}4 -text $v4 -bg $color1 label $window_name.x${row}5 -text $v5 -bg $color2 grid $w0 $window_name.x${row}1 $window_name.x${row}2 $window_name.x${row}3 $window_name.x${row}4 $window_name.x${row}5 -row $row -sticky news } proc DetailReturn { array_name prefix } { upvar 1 $array_name a_name if { [info exists a_name($prefix.type)] } { set ret $a_name($prefix.type) } else { return "ESHORT" } if { $ret >= 0 } { return "OK" } switch -- $ret { -1 { return "EPERM"} -2 { return "ENOENT"} -5 { return "EIO"} -12 { return "ENOMEM"} -14 { return "EFAULT"} -19 { return "ENODEV"} -20 { return "ENOTDIR"} -21 { return "EISDIR"} -22 { return "EINVAL"} -34 { return "ERANGE"} -42 { return "ENOMSG"} default { return "ERROR"} } } proc DetailOffset { offset } { return [expr {$offset&0x0001?"resume ":""}][expr {$offset&0x0002?"alarm ":""}][expr {$offset&0x0004?"ovdr ":""}][expr {$offset&0x8000?"temp ":""}][expr {$offset&0x4000?"volt ":""}][expr {$offset&0x2000?"chain ":""}] } proc DetailFlags { flags } { switch [expr {($flags >>16)&0xFF}] { 0 {set T "C"} 1 {set T "F"} 2 {set T "K"} 3 {set T "R"} default {set T "?temp"} } switch [expr {$flags >>24}] { 0 {set F " f.i"} 1 {set F " fi"} 2 {set F " f.i.c"} 3 {set F " f.ic"} 4 {set F " fi.c"} 5 {set F " fic"} default {set F " ?format"} } return $T$F[expr {$flags&0x10?" safe":""}][expr {$flags&0x08?" alias":""}][expr {$flags&0x04?" persist":""}][expr {$flags&0x02?" bus":""}][expr {$flags&0x01?" cache":""}] } proc WebResponse { sock } { set R [lindex {$Revision: 1.47 $} 1] fconfigure $sock -buffering full -translation crlf -blocking 0 puts $sock "HTTP/1.0 400 Bad Request" puts $sock "Date: [clock format [clock seconds] -gmt 1]" puts $sock "Server: OWTAP-$R" puts $sock "Last-Modified: [clock format [clock seconds] -gmt 1]" puts $sock "Content-Type: text/html" puts $sock "" puts $sock "OWTAP-$R owserver protocol inspector" puts $sock "

Attempt to access OWTAP directly. You probably meant to access OWHTTPD, the 1-wire web server.

" puts $sock "

For more information see OWFS website or the Sourceforge site." flush $sock } # socket name in readable format proc PrettySock { sock } { set socklist [fconfigure $sock -sockname] return [lindex $socklist 1]:[lindex $socklist 2] } proc PrettyPeer { sock } { set socklist [fconfigure $sock -peername] return [lindex $socklist 1]:[lindex $socklist 2] } proc MainTitle { tap server } { wm title . "OWTAP ($tap) tap of owserver ($server)" } proc Restart { } { # foreach ch [chan names] { close $ch } foreach channel [file channels] { if { [regexp -- {^std(out|in|err)$} $channel ] == 0 } { # change to non-blocking and close if { [ catch { fconfigure $channel -blocking 0 ; close $channel; } reason ] == 1 } { StatusMessage "Error closing channel $channel $reason" 1 } } } # exec [info nameofexecutable] $::argv0 "--" {*}$::argv & if { [info nameofexecutable] eq $::argv0 } { eval exec [list [info nameofexecutable]] "--" $::argv & } else { eval exec [list [info nameofexecutable]] [list $::argv0] "--" $::argv "&" } exit } #Finally, all the Proc-s have been defined, so run everything. Main $argv owfs-2.8p15/module/owtap/Makefile.in0000664000175000017500000003323611756250030014304 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.4 2007/08/28 19:48:55 d1mag Exp $ 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@ target_triplet = @target@ subdir = module/owtap DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = owtap.tcl 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 module/owtap/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owtap/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): 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-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-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 install: @INSTALL@ -d $(DESTDIR)$(bindir) @INSTALL@ -m 755 owtap.tcl $(DESTDIR)$(bindir)/owtap # 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: owfs-2.8p15/module/owtap/Makefile.am0000664000175000017500000000026410665076047014302 00000000000000# $Id: Makefile.am,v 1.4 2007/08/28 19:48:55 d1mag Exp $ EXTRA_DIST = owtap.tcl install: @INSTALL@ -d $(DESTDIR)$(bindir) @INSTALL@ -m 755 owtap.tcl $(DESTDIR)$(bindir)/owtap owfs-2.8p15/module/owftpd/0000775000175000017500000000000011756315510012466 500000000000000owfs-2.8p15/module/owftpd/COPYING0000664000175000017500000000240510110544544013434 00000000000000Copyright 2000, 2001 Shane Kerr. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. owfs-2.8p15/module/owftpd/TODO0000664000175000017500000000310410110544544013066 00000000000000$Id: TODO,v 1.1 2004/08/18 03:13:40 alfille Exp $ User requested: - STOR - User login - Bandwidth limits From RIPE: - Limit maximum download time Externally visible: - Add support for SIZE command (RFC 959?) - Add support for STAT command (RFC 959?) - Add support for the RECORD structure in transfer. Surely someone must use it. :) - Allow server messages to be configurable. I'm not sure of the best way to do this. The problem is that this entails putting the messages in a single location, which means that you *don't* see what the message is when you are looking through the code. Hm. I may just make it a comment in the code to allow readability. - Better LIST and NLST support. - Drop browser connections before the 15-minute timeout. You can detect this by looking for users who logged in as "mozilla@" or "IEUser@". In Perl, this would be /^.+\@$/ Internal use only: - Handle glob() returns more elegantly. Right now if a glob() returns 0 files, it's okay. This should return an error unless a wildcard was specified. - Possibly write our own glob() to reduce memory fragmentation. - Perhaps buffer NLST and LIST output. - Use getrlimit()/setrlimit() to cap the amount of memory allowable, and possibly other resources as well. Auditing requirements: - Run through its4, and find other lint-like tools to pound code with. - Sprinkle assert() more fully. Testing: - Find more ftp clients - Create automated test - Run on multi-CPU box Porting: - Compile on FreeBSD - Port to Windows? Other stuff: - Document design - pth support? owfs-2.8p15/module/owftpd/NEWS0000664000175000017500000000067610110544544013110 000000000000002004-08-08 owftpd is an adaptation of oftpd for the 1-wire filesystem 2004-03-25 oftpd is more-or-less abandoned at this point. Fortunately it pretty much just works. Please drop me a line if you want to maintain it. 2000-12-13 IPv6 code is maintained by Mauro Tortonesi . You can download the latest patches for oftpd from the Project6 website: http://project6.ferrara.linux.it Thanks Mauro! owfs-2.8p15/module/owftpd/AUTHORS0000664000175000017500000000102610110544544013447 00000000000000Authors of oftpd: Shane Kerr Contributors: Beau Kuiper (Netscape timing bug fix) Mauro Tortonesi (IPv6 support, RPM spec file) Matthew Danish (Debian compile help, command-line options, address parse consolidation, configure modifications to deal with ss_family variations) Eric Jensen (Red Hat 7.0 init script) Anders Nordby (FreeBSD port) Adapted to OWFS by Paul Alfille owfs-2.8p15/module/owftpd/src/0000775000175000017500000000000011756315510013255 500000000000000owfs-2.8p15/module/owftpd/src/Makefile.in0000664000175000017500000005120111756250027015242 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owftpd/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include all: all-recursive .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 module/owftpd/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owftpd/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owftpd/src/Makefile.am0000664000175000017500000000006610504776327015242 00000000000000SUBDIRS = c include clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owftpd/src/include/0000775000175000017500000000000011756315511014701 500000000000000owfs-2.8p15/module/owftpd/src/include/owftpd.h0000664000175000017500000002250411401337441016271 00000000000000/* * $Id: owftpd.h,v 1.23 2010/06/02 02:17:05 alfille Exp $ */ #ifndef OWFTPD_H #define OWFTPD_H #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LIMITS_H #include #endif #include #include /* _x_ must be a pointer to a sockaddr structure */ #define SAFAM(_x_) (((struct sockaddr *)(_x_))->sa_family) #define cSAFAM(_x_) (((const struct sockaddr *)(_x_))->sa_family) #define SIN4ADDR(_x_) (((struct sockaddr_in *)(_x_))->sin_addr) #define SIN4PORT(_x_) (((struct sockaddr_in *)(_x_))->sin_port) #define SIN6ADDR(_x_) (((struct sockaddr_in6 *)(_x_))->sin6_addr) #define SIN6PORT(_x_) (((struct sockaddr_in6 *)(_x_))->sin6_port) #define cSIN4ADDR(_x_) (((const struct sockaddr_in *)(_x_))->sin_addr) #define cSIN4PORT(_x_) (((const struct sockaddr_in *)(_x_))->sin_port) #define cSIN6ADDR(_x_) (((const struct sockaddr_in6 *)(_x_))->sin6_addr) #define cSIN6PORT(_x_) (((const struct sockaddr_in6 *)(_x_))->sin6_port) #ifdef INET6 #define SINADDR(_x_) ((SAFAM(_x_)==AF_INET6) ? SIN6ADDR(_x_) : SIN4ADDR(_x_)) #define SINPORT(_x_) ((SAFAM(_x_)==AF_INET6) ? SIN6PORT(_x_) : SIN4PORT(_x_)) #define cSINADDR(_x_) ((cSAFAM(_x_)==AF_INET6) ? cSIN6ADDR(_x_) : cSIN4ADDR(_x_)) #define cSINPORT(_x_) ((cSAFAM(_x_)==AF_INET6) ? cSIN6PORT(_x_) : cSIN4PORT(_x_)) #else #define SINADDR(_x_) SIN4ADDR(_x_) #define SINPORT(_x_) SIN4PORT(_x_) #define cSINADDR(_x_) cSIN4ADDR(_x_) #define cSINPORT(_x_) cSIN4PORT(_x_) #endif #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif #ifndef INET6_ADDRSTRLEN #define INET6_ADDRSTRLEN 46 #endif #ifdef INET6 #define IP6_ADDRSTRLEN INET6_ADDRSTRLEN #define IP4_ADDRSTRLEN INET_ADDRSTRLEN #define IP_ADDRSTRLEN INET6_ADDRSTRLEN #else #define IP_ADDRSTRLEN INET_ADDRSTRLEN #endif #if defined(INET6) && defined(HAVE_STRUCT_SOCKADDR_STORAGE) typedef struct sockaddr_storage sockaddr_storage_t; #define SSFAM(_x_) (((sockaddr_storage_t *)(_x_))->ss_family) #define cSSFAM(_x_) (((const sockaddr_storage_t *)(_x_))->ss_family) #else typedef struct sockaddr_in sockaddr_storage_t; #define SSFAM(_x_) (((sockaddr_storage_t *)(_x_))->sin_family) #define cSSFAM(_x_) (((const sockaddr_storage_t *)(_x_))->sin_family) #endif #ifdef HAVE_BROKEN_SS_FAMILY #undef SSFAM #undef cSSFAM #define SSFAM(_x_) (((sockaddr_storage_t *)(_x_))->__ss_family) #define cSSFAM(_x_) (((const sockaddr_storage_t *)(_x_))->__ss_family) #endif /* address to listen on (use NULL to listen on all addresses) */ #define FTP_ADDRESS NULL /* default port FTP server listens on (use 0 to listen on default port) */ #define FTP_PORT 0 /* ranges possible for command-line specified port numbers */ #define MIN_PORT 0 #define MAX_PORT 65535 /* default port FTP server listens on (use 0 to listen on default port) */ #define DEFAULT_PORTNAME "0.0.0.0:21" /* bounds on command-line specified number of clients */ #define MIN_NUM_CLIENTS 1 #define MAX_NUM_CLIENTS 300 enum parse_status_e { parse_status_init, // need to test for initial / parse_status_init2, // need to test for virginity (no wildness) parse_status_back, // .. still allowed parse_status_next, // figure out this level parse_status_last, // last level parse_status_tame, // no wildcard at all }; enum file_list_e { file_list_list, file_list_nlst, }; struct file_parse_s { ASCII buffer[PATH_MAX + 1]; ASCII *rest; enum parse_status_e pse; // state machine enum file_list_e fle; // long or short listing flag int out; // file descriptor to send result int ret; // return status int start; }; struct cd_parse_s { ASCII buffer[PATH_MAX + 1]; // working copy of current directory ASCII *rest; enum parse_status_e pse; // state machine int ret; // return status int solutions; // is the solution unique? ASCII *dir; }; void FileLexParse(struct file_parse_s *fps); void FileLexCD(struct cd_parse_s *cps); /* each watched thread gets one of these structures */ struct watched_s { /* thread to monitor */ pthread_t watched_thread; /* flag whether in a watchdog list */ int in_list; /* time when to cancel thread if no activity */ time_t alarm_time; /* for location in doubly-linked list */ struct watched_s *older; struct watched_s *newer; /* watchdog that this watched_s is in */ void *watchdog; }; /* the watchdog keeps track of all information */ struct watchdog_s { pthread_mutex_t mutex; int inactivity_timeout; /* the head and tail of our list */ struct watched_s *oldest; struct watched_s *newest; }; int watchdog_init(struct watchdog_s *w, int inactivity_timeout); void watchdog_add_watched(struct watchdog_s *w, struct watched_s *watched); void watchdog_defer_watched(struct watched_s *watched); void watchdog_remove_watched(struct watched_s *watched); /* size of buffer */ #define BUF_LEN 2048 /* information on a telnet session */ struct telnet_session_s { int in_fd; int in_errno; int in_eof; int in_take; int in_add; char in_buf[BUF_LEN]; int in_buflen; int in_status; int out_fd; int out_errno; int out_eof; int out_take; int out_add; char out_buf[BUF_LEN]; int out_buflen; }; #ifdef NDEBUG #define daemon_assert(expr) #else /* NDEBUG */ void daemon_assert_fail(const char *assertion, const char *file, int line, const char *function); #ifndef __STRING #define __STRING(x) #x #endif #define daemon_assert(expr) \ ((expr) ? 0 : \ (daemon_assert_fail(__STRING(expr), __FILE__, __LINE__, __func__))) #endif /* NDEBUG */ /* data representation types supported */ #define TYPE_ASCII 0 #define TYPE_IMAGE 1 /* file structure types supported */ #define STRU_FILE 0 #define STRU_RECORD 1 /* data path chosen */ #define DATA_PORT 0 #define DATA_PASSIVE 1 /* space required for text representation of address and port, e.g. "192.168.0.1 port 1024" or "2001:3333:DEAD:BEEF:0666:0013:0069:0042 port 65535" */ #define ADDRPORT_STRLEN 58 /* structure encapsulating an FTP session's information */ struct ftp_session_s { /* flag whether session is active */ int session_active; /* incremented for each command */ unsigned long command_number; /* options about transfer set by user */ int data_type; int file_structure; /* offset to begin sending file from */ off_t file_offset; unsigned long file_offset_command_number; /* flag set if client requests ESPV ALL - this prevents subsequent use of PORT, PASV, LPRT, LPSV, or EPRT */ int epsv_all_set; /* address of client */ sockaddr_storage_t client_addr; char client_addr_str[ADDRPORT_STRLEN]; /* address of server (including IPv4 version) */ sockaddr_storage_t server_addr; struct sockaddr_in server_ipv4_addr; /* telnet session to encapsulate control channel logic */ struct telnet_session_s *telnet_session; /* current working directory of this connection */ char dir[PATH_MAX + 1]; /* data channel information, including type, and client address or server port depending on type */ int data_channel; sockaddr_storage_t data_port; int server_fd; /* watchdog to handle timeout */ struct watched_s *watched; }; int ftp_session_init(struct ftp_session_s *f, const sockaddr_storage_t * client_addr, const sockaddr_storage_t * server_addr, struct telnet_session_s *t, const char *dir); void ftp_session_drop(struct ftp_session_s *f, const char *reason); void ftp_session_run(struct ftp_session_s *f, struct watched_s *watched); void ftp_session_destroy(struct ftp_session_s *f); struct ftp_listener_s { /* file descriptor incoming connections arrive on */ int file_descriptor; /* maximum number of connections */ int max_connections; /* current number of connections */ int num_connections; /* timeout (in seconds) for connections */ int inactivity_timeout; /* watchdog monitoring this listener's connections */ struct watchdog_s watchdog; /* mutext to lock changes to this structure */ pthread_mutex_t mutex; /* starting directory */ char dir[3]; // only root directory for OWFS /* boolean defining whether listener is running or not */ int listener_running; /* thread identifier for listener */ pthread_t listener_thread; /* end of pipe to wake up listening thread with */ /* end of pipe listening thread waits on */ int shutdown_request_fd[2]; /* condition to signal thread requesting shutdown */ pthread_cond_t shutdown_cond; }; int ftp_listener_init(struct ftp_listener_s *f); int ftp_listener_start(struct ftp_listener_s *f); void ftp_listener_stop(struct ftp_listener_s *f); /* special macro for handling EPSV ALL requests */ #define EPSV_ALL (-1) /* maximum possible number of arguments */ #define MAX_ARG 2 /* maximum string length */ #define MAX_STRING_LEN PATH_MAX struct ftp_command_s { char command[5]; int num_arg; union { char string[MAX_STRING_LEN + 1]; sockaddr_storage_t host_port; int num; off_t offset; } arg[MAX_ARG]; }; /* methods */ int ftp_command_parse(const char *input, struct ftp_command_s *cmd); /* functions */ void telnet_session_init(struct telnet_session_s *t, int in, int out); int telnet_session_print(struct telnet_session_s *t, const char *s); int telnet_session_println(struct telnet_session_s *t, const char *s); int telnet_session_readln(struct telnet_session_s *t, char *buf, int buflen); void telnet_session_destroy(struct telnet_session_s *t); #endif /* OWFTPD_H */ owfs-2.8p15/module/owftpd/src/include/Makefile.in0000664000175000017500000003661111756250027016675 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owftpd/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = owftpd.h 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 module/owftpd/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owftpd/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owftpd/src/include/Makefile.am0000664000175000017500000000007310432627750016656 00000000000000noinst_HEADERS = owftpd.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owftpd/src/c/0000775000175000017500000000000011756315511013500 500000000000000owfs-2.8p15/module/owftpd/src/c/owftpd.c0000664000175000017500000000432611673510254015073 00000000000000/* * $Id: owftpd.c,v 1.33 2011/08/10 01:54:06 alfille Exp $ */ #include "owftpd.h" #include int main(int argc, char *argv[]) { int c; int err, signo; struct ftp_listener_s ftp_listener; sigset_t myset; /* Set up owlib */ LibSetup(program_type_ftpd); /* grab our executable name */ if (argc > 0) { Globals.progname = strdup(argv[0]); } /* check our command-line arguments */ while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* FTP on default port? */ if (Outbound_Control.active == 0) { ARG_Server(NULL); // default or ephemeral port } /* non-option args are adapters */ while (optind < argc) { //printf("Adapter(%d): %s\n",optind,argv[optind]); ARG_Generic(argv[optind]); ++optind; } /* become a daemon if not told otherwise */ if ( BAD(EnterBackground()) ) { ow_exit(1); } sigemptyset(&myset); sigaddset(&myset, SIGHUP); sigaddset(&myset, SIGINT); // SIGTERM is used to kill all outprocesses which hang in accept() pthread_sigmask(SIG_BLOCK, &myset, NULL); /* Set up adapters */ if ( BAD(LibStart()) ) { ow_exit(1); } set_exit_signal_handlers(exit_handler); set_signal_handlers(NULL); /* create our main listener */ if (!ftp_listener_init(&ftp_listener)) { LEVEL_CONNECT("Problem initializing FTP listener"); ow_exit(1); } /* start our listener */ if (ftp_listener_start(&ftp_listener) == 0) { LEVEL_CONNECT("Problem starting FTP service"); ow_exit(1); } sigemptyset(&myset); sigaddset(&myset, SIGHUP); sigaddset(&myset, SIGINT); sigaddset(&myset, SIGTERM); while (!StateInfo.shutting_down) { if ((err = sigwait(&myset, &signo)) == 0) { if (signo == SIGHUP) { LEVEL_DEBUG("owftpd: ignore signo=%d", signo); continue; } LEVEL_DEBUG("owftpd: break signo=%d", signo); break; } else { LEVEL_DEBUG("owftpd: sigwait error %d", err); } } StateInfo.shutting_down = 1; LEVEL_DEBUG("owftpd shutdown initiated"); ftp_listener_stop(&ftp_listener); LEVEL_CONNECT("All connections finished, FTP server exiting"); ow_exit(0); return 0; } owfs-2.8p15/module/owftpd/src/c/ftp_command.c0000664000175000017500000002770710750074137016067 00000000000000/* * $Id: ftp_command.c,v 1.13 2008/01/30 13:15:11 d1mag Exp $ */ #include "owftpd.h" #include /* argument types */ #define ARG_NONE 0 #define ARG_STRING 1 #define ARG_OPTIONAL_STRING 2 #define ARG_HOST_PORT 3 #define ARG_TYPE 4 #define ARG_STRUCTURE 5 #define ARG_MODE 6 #define ARG_OFFSET 7 #define ARG_HOST_PORT_LONG 8 #define ARG_HOST_PORT_EXT 9 #define ARG_OPTIONAL_NUMBER 10 /* our FTP commands */ struct { char *name; int arg_type; } command_def[] = { { "USER", ARG_STRING}, { "PASS", ARG_STRING}, { "CWD", ARG_STRING}, { "CDUP", ARG_NONE}, { "QUIT", ARG_NONE}, { "PORT", ARG_HOST_PORT}, { "LPRT", ARG_HOST_PORT_LONG}, { "EPRT", ARG_HOST_PORT_EXT}, { "PASV", ARG_NONE}, { "LPSV", ARG_NONE}, { "EPSV", ARG_OPTIONAL_NUMBER}, { "TYPE", ARG_TYPE}, { "STRU", ARG_STRUCTURE}, { "MODE", ARG_MODE}, { "RETR", ARG_STRING}, { "STOR", ARG_STRING}, { "PWD", ARG_NONE}, { "LIST", ARG_OPTIONAL_STRING}, { "NLST", ARG_OPTIONAL_STRING}, { "SYST", ARG_NONE}, { "HELP", ARG_OPTIONAL_STRING}, { "NOOP", ARG_NONE}, { "REST", ARG_OFFSET}, { "SIZE", ARG_STRING}, { "MDTM", ARG_STRING} }; #define NUM_COMMAND (sizeof(command_def) / sizeof(command_def[0])) /* prototypes */ static const char *copy_string(char *dst, const char *src); static const char *parse_host_port(struct sockaddr_in *addr, const char *s); static const char *parse_number(int *num, const char *s, int max_num); static const char *parse_offset(off_t * ofs, const char *s); static const char *parse_host_port_long(sockaddr_storage_t * sa, const char *s); static const char *parse_host_port_ext(sockaddr_storage_t * sa, const char *s); int ftp_command_parse(const char *input, struct ftp_command_s *cmd) { size_t match; struct ftp_command_s tmp; int c; const char *optional_number; if (input == NULL || cmd == NULL) return 0; /* see if our input starts with a valid command */ for (match = 0; match < NUM_COMMAND; ++match) { if (strncasecmp(input, command_def[match].name, strlen(command_def[match].name)) == 0) break; } /* if we didn't find a match, return error */ if (match == NUM_COMMAND) return 0; /* copy our command */ strcpy(tmp.command, command_def[match].name); /* advance input past the command */ input += strlen(command_def[match].name); /* now act based on the command */ switch (command_def[match].arg_type) { case ARG_NONE: tmp.num_arg = 0; break; case ARG_STRING: if (*input != ' ') return 0; ++input; input = copy_string(tmp.arg[0].string, input); tmp.num_arg = 1; break; case ARG_OPTIONAL_STRING: if (*input == ' ') { ++input; input = copy_string(tmp.arg[0].string, input); tmp.num_arg = 1; } else { tmp.num_arg = 0; } break; case ARG_HOST_PORT: if (*input != ' ') { return 0; } input++; /* parse the host & port information (if any) */ input = parse_host_port(&tmp.arg[0].host_port, input); if (input == NULL) return 0; tmp.num_arg = 1; break; case ARG_HOST_PORT_LONG: if (*input != ' ') return 0; input++; /* parse the host & port information (if any) */ input = parse_host_port_long(&tmp.arg[0].host_port, input); if (input == NULL) return 0; tmp.num_arg = 1; break; case ARG_HOST_PORT_EXT: if (*input != ' ') return 0; input++; /* parse the host & port information (if any) */ input = parse_host_port_ext(&tmp.arg[0].host_port, input); if (input == NULL) return 0; tmp.num_arg = 1; break; /* the optional number may also be "ALL" */ case ARG_OPTIONAL_NUMBER: if (*input == ' ') { ++input; optional_number = parse_number(&tmp.arg[0].num, input, 255); if (optional_number != NULL) { input = optional_number; } else { if ((tolower(input[0]) == 'a') && (tolower(input[1]) == 'l') && (tolower(input[2]) == 'l')) { tmp.arg[0].num = EPSV_ALL; input += 3; } else { return 0; } } tmp.num_arg = 1; } else { tmp.num_arg = 0; } break; case ARG_TYPE: if (*input != ' ') { return 0; } input++; c = toupper(*input); if ((c == 'A') || (c == 'E')) { tmp.arg[0].string[0] = c; tmp.arg[0].string[1] = '\0'; input++; if (*input == ' ') { input++; c = toupper(*input); if ((c != 'N') && (c != 'T') && (c != 'C')) return 0; tmp.arg[1].string[0] = c; tmp.arg[1].string[1] = '\0'; input++; tmp.num_arg = 2; } else { tmp.num_arg = 1; } } else if (c == 'I') { tmp.arg[0].string[0] = 'I'; tmp.arg[0].string[1] = '\0'; input++; tmp.num_arg = 1; } else if (c == 'L') { tmp.arg[0].string[0] = 'L'; tmp.arg[0].string[1] = '\0'; input++; input = parse_number(&tmp.arg[1].num, input, 255); if (input == NULL) return 0; tmp.num_arg = 2; } else { return 0; } break; case ARG_STRUCTURE: if (*input != ' ') return 0; input++; c = toupper(*input); if ((c != 'F') && (c != 'R') && (c != 'P')) return 0; input++; tmp.arg[0].string[0] = c; tmp.arg[0].string[1] = '\0'; tmp.num_arg = 1; break; case ARG_MODE: if (*input != ' ') return 0; input++; c = toupper(*input); if ((c != 'S') && (c != 'B') && (c != 'C')) return 0; input++; tmp.arg[0].string[0] = c; tmp.arg[0].string[1] = '\0'; tmp.num_arg = 1; break; case ARG_OFFSET: if (*input != ' ') return 0; input++; input = parse_offset(&tmp.arg[0].offset, input); if (input == NULL) return 0; tmp.num_arg = 1; break; default: daemon_assert(0); } /* check for our ending newline */ if (*input != '\n') return 0; /* return our result */ *cmd = tmp; return 1; } /* copy a string terminated with a newline */ static const char *copy_string(char *dst, const char *src) { int i; daemon_assert(dst != NULL); daemon_assert(src != NULL); for (i = 0; (i <= MAX_STRING_LEN) && (src[i] != '\0') && (src[i] != '\n'); i++) { dst[i] = src[i]; } dst[i] = '\0'; return src + i; } static const char *parse_host_port(struct sockaddr_in *addr, const char *s) { int i; int octets[6]; char addr_str[16]; int port; struct in_addr in_addr; daemon_assert(addr != NULL); daemon_assert(s != NULL); /* scan in 5 pairs of "#," */ for (i = 0; i < 5; i++) { s = parse_number(&octets[i], s, 255); if (s == NULL) return NULL; if (*s != ',') return NULL; s++; } /* scan in ending "#" */ s = parse_number(&octets[5], s, 255); if (s == NULL) return NULL; daemon_assert(octets[0] >= 0); daemon_assert(octets[0] <= 255); daemon_assert(octets[1] >= 0); daemon_assert(octets[1] <= 255); daemon_assert(octets[2] >= 0); daemon_assert(octets[2] <= 255); daemon_assert(octets[3] >= 0); daemon_assert(octets[3] <= 255); /* convert our number to a IP/port */ sprintf(addr_str, "%d.%d.%d.%d", octets[0], octets[1], octets[2], octets[3]); port = (octets[4] << 8) | octets[5]; #ifdef HAVE_INET_ATON if (inet_aton(addr_str, &in_addr) == 0) { return NULL; } #else in_addr.s_addr = inet_addr(addr_str); if (in_addr.s_addr == (in_addr_t) - 1) { return NULL; } #endif addr->sin_family = AF_INET; addr->sin_addr = in_addr; addr->sin_port = htons(port); /* return success */ return s; } /* note: returns success even for unknown address families */ /* this is okay, as long as subsequent uses VERIFY THE FAMILY first */ static const char *parse_host_port_long(sockaddr_storage_t * sa, const char *s) { int i; int family; int tmp; int addr_len; unsigned char addr[255]; int port_len; unsigned char port[255]; /* we are family */ s = parse_number(&family, s, 255); if (s == NULL) { return NULL; } if (*s != ',') { return NULL; } s++; /* parse host length */ s = parse_number(&addr_len, s, 255); if (s == NULL) { return NULL; } if (*s != ',') { return NULL; } s++; /* parse address */ for (i = 0; i < addr_len; i++) { //daemon_assert(i < sizeof(addr)/sizeof(addr[0])); s = parse_number(&tmp, s, 255); addr[i] = tmp; if (s == NULL) { return NULL; } if (*s != ',') { return NULL; } s++; } /* parse port length */ s = parse_number(&port_len, s, 255); if (s == NULL) { return NULL; } /* parse port */ for (i = 0; i < port_len; i++) { if (*s != ',') { return NULL; } s++; //daemon_assert(i < sizeof(port)/sizeof(port[0])); s = parse_number(&tmp, s, 255); port[i] = tmp; } /* okay, everything parses, load the address if possible */ if (family == 4) { SAFAM(sa) = AF_INET; if (addr_len != sizeof(struct in_addr)) { return NULL; } if (port_len != 2) { return NULL; } memcpy(&SINADDR(sa), addr, addr_len); SINPORT(sa) = htons((port[0] << 8) + port[1]); } #ifdef INET6 else if (family == 6) { SAFAM(sa) = AF_INET6; if (addr_len != sizeof(struct in6_addr)) { return NULL; } if (port_len != 2) { return NULL; } memcpy(&SIN6ADDR(sa), addr, addr_len); SINPORT(sa) = htons((port[0] << 8) + port[1]); } #endif else { SAFAM(sa) = -1; } /* return new pointer */ return s; } static const char *parse_host_port_ext(sockaddr_storage_t * sa, const char *s) { int delimeter; int family; char *p; ssize_t len; char addr_str[256]; int port; /* get delimeter character */ if ((*s < 33) || (*s > 126)) { return NULL; } delimeter = *s; s++; /* get address family */ if (*s == '1') { family = AF_INET; } #ifdef INET6 else if (*s == '2') { family = AF_INET6; } #endif else { return NULL; } s++; if (*s != delimeter) { return NULL; } s++; /* get address string */ p = strchr(s, delimeter); if (p == NULL) { return NULL; } len = p - s; if (len >= (ssize_t) sizeof(addr_str)) { return NULL; } memcpy(addr_str, s, len); addr_str[len] = '\0'; s = p + 1; /* get port */ s = parse_number(&port, s, 65535); if (s == NULL) { return NULL; } if (*s != delimeter) { return NULL; } s++; /* now parse the value passed */ #ifndef INET6 { struct in_addr in_addr; #ifdef HAVE_INET_ATON if (inet_aton(addr_str, &in_addr) == 0) { return NULL; } #else in_addr.s_addr = inet_addr(addr_str); if (in_addr.s_addr == (in_addr_t) - 1) { return NULL; } #endif /* HAVE_INET_ATON */ SIN4ADDR(sa) = in_addr; } #else { struct addrinfo hints; struct *res; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; hints.ai_family = family; if (getaddrinfo(addr_str, NULL, &hints, &res) != 0) { return NULL; } memcpy(sa, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); } #endif /* INET6 */ SAFAM(sa) = family; SINPORT(sa) = htons(port); /* return new pointer */ return s; } /* scan the string for a number from 0 to max_num */ /* returns the next non-numberic character */ /* returns NULL if not at least one digit */ static const char *parse_number(int *num, const char *s, int max_num) { int tmp; int cur_digit; daemon_assert(s != NULL); daemon_assert(num != NULL); /* handle first character */ if (!isdigit(*s)) { return NULL; } tmp = (*s - '0'); s++; /* handle subsequent characters */ while (isdigit(*s)) { cur_digit = (*s - '0'); /* check for overflow */ if ((max_num - cur_digit) < (tmp * 10)) { return NULL; } tmp *= 10; tmp += cur_digit; s++; } daemon_assert(tmp >= 0); daemon_assert(tmp <= max_num); /* return the result */ *num = tmp; return s; } static const char *parse_offset(off_t * ofs, const char *s) { off_t tmp_ofs; int cur_digit; off_t max_ofs; daemon_assert(ofs != NULL); daemon_assert(s != NULL); /* calculate maximum allowable offset based on size of off_t */ if (sizeof(off_t) == 8) { max_ofs = (off_t) 9223372036854775807LL; } else if (sizeof(off_t) == 4) { max_ofs = (off_t) 2147483647LL; } else if (sizeof(off_t) == 2) { max_ofs = (off_t) 32767LL; } else { max_ofs = 0; } daemon_assert(max_ofs != 0); /* handle first character */ if (!isdigit(*s)) { return NULL; } tmp_ofs = (*s - '0'); s++; /* handle subsequent characters */ while (isdigit(*s)) { cur_digit = (*s - '0'); /* check for overflow */ if ((max_ofs - cur_digit) < (tmp_ofs * 10)) { return NULL; } tmp_ofs *= 10; tmp_ofs += cur_digit; s++; } /* return */ *ofs = tmp_ofs; return s; } owfs-2.8p15/module/owftpd/src/c/watchdog.c0000664000175000017500000001404411447211130015354 00000000000000/* * $Id: watchdog.c,v 1.19 2010/09/24 21:04:24 alfille Exp $ */ #include "owftpd.h" static int invariant(struct watchdog_s *w); static void insert(struct watchdog_s *w, struct watched_s *watched); static void delete(struct watchdog_s *w, struct watched_s *watched); static void *watcher(void *void_w); int watchdog_init(struct watchdog_s *w, int inactivity_timeout) { pthread_t thread_id; int error_code; daemon_assert(w != NULL); daemon_assert(inactivity_timeout > 0); _MUTEX_INIT(w->mutex); w->inactivity_timeout = inactivity_timeout; w->oldest = NULL; w->newest = NULL; error_code = pthread_create(&thread_id, DEFAULT_THREAD_ATTR, watcher, w); if (error_code != 0) { errno = error_code; ERROR_CONNECT("Watchdog thread create problem\n"); return 0; } pthread_detach(thread_id); daemon_assert(invariant(w)); return 1; } void watchdog_add_watched(struct watchdog_s *w, struct watched_s *watched) { daemon_assert(invariant(w)); _MUTEX_LOCK(w->mutex); watched->watched_thread = pthread_self(); watched->watchdog = w; insert(w, watched); _MUTEX_UNLOCK(w->mutex); daemon_assert(invariant(w)); } void watchdog_defer_watched(struct watched_s *watched) { struct watchdog_s *w; daemon_assert(invariant(watched->watchdog)); w = watched->watchdog; _MUTEX_LOCK(w->mutex); delete(w, watched); insert(w, watched); _MUTEX_UNLOCK(w->mutex); daemon_assert(invariant(w)); } void watchdog_remove_watched(struct watched_s *watched) { struct watchdog_s *w; daemon_assert(invariant(watched->watchdog)); w = watched->watchdog; _MUTEX_LOCK(w->mutex); delete(w, watched); _MUTEX_UNLOCK(w->mutex); daemon_assert(invariant(w)); } static void insert(struct watchdog_s *w, struct watched_s *watched) { /********************************************************************* Set alarm to current time + timeout duration. Note that this is not strictly legal, since time_t is an abstract data type. *********************************************************************/ watched->alarm_time = NOW_TIME + w->inactivity_timeout; /********************************************************************* If the system clock got set backwards, we really should search for the correct location, instead of just inserting at the end. However, this happens very rarely (ntp and other synchronization protocols speed up or slow down the clock to adjust the time), so we'll just set our alarm to the time of the newest alarm - giving any watched processes added some extra time. *********************************************************************/ if (w->newest != NULL) { if (w->newest->alarm_time > watched->alarm_time) { watched->alarm_time = w->newest->alarm_time; } } /* set our pointers */ watched->older = w->newest; watched->newer = NULL; /* add to list */ if (w->oldest == NULL) { w->oldest = watched; } else { w->newest->newer = watched; } w->newest = watched; watched->in_list = 1; } static void delete(struct watchdog_s *w, struct watched_s *watched) { if (!watched->in_list) { return; } if (watched->newer == NULL) { daemon_assert(w->newest == watched); w->newest = w->newest->older; if (w->newest != NULL) { w->newest->newer = NULL; } } else { daemon_assert(w->newest != watched); watched->newer->older = watched->older; } if (watched->older == NULL) { daemon_assert(w->oldest == watched); w->oldest = w->oldest->newer; if (w->oldest != NULL) { w->oldest->older = NULL; } } else { daemon_assert(w->oldest != watched); watched->older->newer = watched->newer; } watched->older = NULL; watched->newer = NULL; watched->in_list = 0; } static void *watcher(void *void_w) { struct watchdog_s *w; struct timeval tvwatch = { 1, 0 } ; // 1 second time_t now; struct watched_s *watched; w = (struct watchdog_s *) void_w; for (;;) { struct timeval tv ; timercpy( &tv, &tvwatch ) ; select(0, NULL, NULL, NULL, &tv); time(&now); _MUTEX_LOCK(w->mutex); while ((w->oldest != NULL) && (difftime(now, w->oldest->alarm_time) > 0)) { watched = w->oldest; /******************************************************* This might seem like a memory leak, but in oftpd the struct watched_s structure is held in the thread itself, so canceling the thread effectively frees the memory. I'm not sure whether this is elegant or a hack. :) *******************************************************/ delete(w, watched); pthread_cancel(watched->watched_thread); } _MUTEX_UNLOCK(w->mutex); } return VOID_RETURN ; } #ifndef NDEBUG static int invariant(struct watchdog_s *w) { int ret_val; struct watched_s *ptr; int old_to_new_count; int new_to_old_count; if (w == NULL) { return 0; } ret_val = 0; _MUTEX_LOCK(w->mutex); if (w->inactivity_timeout <= 0) { goto exit_invariant; } /* either oldest and newest are both NULL, or neither is */ if (w->oldest != NULL) { if (w->newest == NULL) { goto exit_invariant; } /* check list from oldest to newest */ old_to_new_count = 0; ptr = w->oldest; while (ptr != NULL) { old_to_new_count++; if (ptr->older != NULL) { if (ptr->alarm_time < ptr->older->alarm_time) { goto exit_invariant; } } if (ptr->newer != NULL) { if (ptr->alarm_time > ptr->newer->alarm_time) { goto exit_invariant; } } ptr = ptr->newer; } /* check list from newest to oldest */ new_to_old_count = 0; ptr = w->newest; while (ptr != NULL) { new_to_old_count++; if (ptr->older != NULL) { if (ptr->alarm_time < ptr->older->alarm_time) { goto exit_invariant; } } if (ptr->newer != NULL) { if (ptr->alarm_time > ptr->newer->alarm_time) { goto exit_invariant; } } ptr = ptr->older; } /* verify forward and backward lists at least have the same count */ if (old_to_new_count != new_to_old_count) { goto exit_invariant; } } else { if (w->newest != NULL) { goto exit_invariant; } } /* at this point, we're probably okay */ ret_val = 1; exit_invariant: _MUTEX_UNLOCK(w->mutex); return ret_val; } #endif /* NDEBUG */ owfs-2.8p15/module/owftpd/src/c/file_list.c0000664000175000017500000002213711371330656015543 00000000000000/* * $Id: file_list.c,v 1.32 2010/05/08 18:47:10 alfille Exp $ */ #include "owftpd.h" #include #include #include /* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca(); # endif # endif # endif #endif static void fdprintf(int file_descriptor, const char *fmt, ...); static void List_show(struct file_parse_s *fps, const struct parsedname *pn); static void WildLexParse(struct file_parse_s *fps, ASCII * match); static char *skip_ls_options(char *filespec); /* if no localtime_r() is available, provide one */ #ifndef HAVE_LOCALTIME_R #include struct tm *localtime_r(const time_t * timep, struct tm *timeptr) { static pthread_mutex_t time_lock = PTHREAD_MUTEX_INITIALIZER; _MUTEX_LOCK(time_lock); *timeptr = *(localtime(timep)); _MUTEX_UNLOCK(time_lock); return timeptr; } #endif /* HAVE_LOCALTIME_R */ static void List_show(struct file_parse_s *fps, const struct parsedname *pn) { struct stat stbuf; time_t now; struct tm tm_now; double age; char date_buf[13]; ASCII *perms[] = { "---------", "--x--x--x", "-w--w--w-", "-wx-wx-wx", "r--r--r--", "r-xr-xr-x", "rw-rw-rw-", "rwxrwxrwx", }; LEVEL_DEBUG("List_show %s", pn->path); switch (fps->fle) { case file_list_list: FS_fstat_postparse(&stbuf, pn); fdprintf(fps->out, "%s%s", stbuf.st_mode & S_IFDIR ? "d" : "-", perms[stbuf.st_mode & 0x07]); /* fps->output link & ownership information */ fdprintf(fps->out, " %3d %-8d %-8d %8lu ", stbuf.st_nlink, stbuf.st_uid, stbuf.st_gid, (unsigned long) stbuf.st_size); /* fps->output date */ time(&now); localtime_r(&stbuf.st_mtime, &tm_now); age = difftime(now, stbuf.st_mtime); if ((age > 60 * 60 * 24 * 30 * 6) || (age < -(60 * 60 * 24 * 30 * 6))) { strftime(date_buf, sizeof(date_buf), "%b %e %Y", &tm_now); } else { strftime(date_buf, sizeof(date_buf), "%b %e %H:%M", &tm_now); } fdprintf(fps->out, "%s ", date_buf); /* Fall Through */ case file_list_nlst: /* fps->output filename */ fdprintf(fps->out, "%s\r\n", &pn->path[fps->start]); } } void FileLexParse(struct file_parse_s *fps) { struct parsedname pn; while (1) { switch (fps->pse) { case parse_status_init: LEVEL_DEBUG("FTP parse_status_init Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ fps->ret = 0; fps->start = strlen(fps->buffer); if (fps->start > 1) ++fps->start; fps->rest = skip_ls_options(fps->rest); if (fps->rest == NULL || fps->rest[0] == '\0') { fps->pse = parse_status_tame; } else { if (fps->rest[0] == '/') { // root specification fps->buffer[1] = '\0'; fps->start = 0; ++fps->rest; } fps->pse = parse_status_init2; } break; case parse_status_init2: LEVEL_DEBUG("FTP parse_status_init2 Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ if ((fps->rest[0] == '.' && fps->rest[1] == '.') || strpbrk(fps->rest, "*[?")) { fps->pse = parse_status_back; } else { fps->pse = parse_status_tame; } break; case parse_status_back: LEVEL_DEBUG("FTP parse_status_back Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ if (fps->rest[0] == '.' && fps->rest[1] == '.') { // Move back ASCII *back = strrchr(fps->buffer, '/'); back[1] = '\0'; fps->start = strlen(fps->buffer); // look for next file part if (fps->rest[2] == '\0') { fps->pse = parse_status_last; fps->rest = NULL; } else if (fps->rest[2] == '/') { fps->pse = parse_status_next; fps->rest = &fps->rest[3]; } else { fps->ret = -ENOENT; return; } } else { fps->pse = parse_status_next; // off the double dot trail } break; case parse_status_next: LEVEL_DEBUG("FTP parse_status_next Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ if (fps->rest == NULL || fps->rest[0] == '\0') { fps->pse = parse_status_last; } else { ASCII *oldrest = strsep(&fps->rest, "/"); if (strpbrk(oldrest, "*[?")) { WildLexParse(fps, oldrest); return; } else { if (oldrest && (strlen(fps->buffer) + strlen(oldrest) + 4 > PATH_MAX)) { fps->ret = -ENAMETOOLONG; return; } if (fps->buffer[1]) strcat(fps->buffer, "/"); strcat(fps->buffer, oldrest); fps->pse = parse_status_next; } } break; case parse_status_tame: LEVEL_DEBUG("FTP parse_status_tame Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ if (fps->rest && (strlen(fps->buffer) + strlen(fps->rest) + 4 > PATH_MAX)) { fps->ret = -ENAMETOOLONG; return; } if (fps->buffer[1]) strcat(fps->buffer, "/"); strcat(fps->buffer, fps->rest); if (FS_ParsedName(fps->buffer, &pn) == 0) { if (IsDir(&pn)) { fps->start = strlen(fps->buffer) + 1; if (fps->start == 2) { fps->start = 1; } else if (fps->buffer[fps->start - 2] == '/') { --fps->start; fps->buffer[fps->start - 1] = '\0'; } fps->rest = NULL; WildLexParse(fps, "*"); } else { List_show(fps, &pn); } FS_ParsedName_destroy(&pn); } else { fps->ret = -ENOENT; } return; case parse_status_last: LEVEL_DEBUG("FTP parse_status_last Path<%s> File <%s>", fps->buffer, fps->rest); /* fps->buffer is absolute */ /* trailing / only at root */ if (fps->rest && (strlen(fps->buffer) + strlen(fps->rest) + 4 > PATH_MAX)) { fps->ret = -ENAMETOOLONG; return; } if (FS_ParsedNamePlus(fps->buffer, fps->rest, &pn) == 0) { List_show(fps, &pn); FS_ParsedName_destroy(&pn); } return; } } } struct wildlexparse { ASCII *end; ASCII *match; struct file_parse_s *fps; }; /* Called for each directory element, and operates recursively */ /* uses C library fnmatch for file wildcard comparisons */ static void WildLexParseCallback(void *v, const struct parsedname *const pn_entry) { struct wildlexparse *wlp = v; struct file_parse_s fps; // duplicate for recursive call /* get real name from parsedname struct */ strcpy(&wlp->end[1], FS_DirName(pn_entry)); LEVEL_DEBUG("WildLexParseCallback: Try %s vs %s", &wlp->end[1], wlp->match); if (fnmatch(wlp->match, &wlp->end[1], FNM_PATHNAME)) { return; } /* Matched! So set up for recursive call on nect elements in path name */ memcpy(&fps, wlp->fps, sizeof(fps)); fps.pse = parse_status_next; FileLexParse(&fps); } /* Called for each directory, calls WildLEexParseCallback on each element to see if matches wildcards (even used for normal listings with * wildcard) */ static void WildLexParse(struct file_parse_s *fps, ASCII * match) { struct parsedname pn; /* Embedded callback function */ LEVEL_DEBUG("FTP Wildcard patern matching: Path=%s, Pattern=%s, File=%s", SAFESTRING(fps->buffer), SAFESTRING(match), SAFESTRING(fps->rest)); /* Check potential length */ if (strlen(fps->buffer) + OW_FULLNAME_MAX + 2 > PATH_MAX) { fps->ret = -ENAMETOOLONG; return; } /* Can we understand the current path? */ if (FS_ParsedName(fps->buffer, &pn) != 0 ) { fps->ret = -ENOENT; return; } if (pn.selected_filetype) { fps->ret = -ENOTDIR; } else { struct wildlexparse wlp = { NULL, match, fps, }; int root = (fps->buffer[1] == '\0'); wlp.end = &fps->buffer[strlen(fps->buffer)]; if (root) --wlp.end; wlp.end[0] = '/'; FS_dir(WildLexParseCallback, &wlp, &pn); if (root) ++wlp.end; wlp.end[0] = '\0'; // restore fps->buffer } FS_ParsedName_destroy(&pn); } /* write with care for max length and incomplete outout */ static void fdprintf(int file_descriptor, const char *fmt, ...) { char buf[PATH_MAX + 1]; ssize_t buflen; va_list ap; int amt_written; int write_ret; daemon_assert(file_descriptor >= 0); daemon_assert(fmt != NULL); va_start(ap, fmt); buflen = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if (buflen <= 0) { return; } if ((size_t) buflen >= sizeof(buf)) { buflen = sizeof(buf) - 1; } amt_written = 0; while (amt_written < buflen) { write_ret = write(file_descriptor, buf + amt_written, buflen - amt_written); if (write_ret <= 0) { return; } amt_written += write_ret; } } /* hack workaround clients like Midnight Commander that send: LIST -al /dirname */ static char *skip_ls_options(char *filespec) { daemon_assert(filespec != NULL); for (;;) { /* end when we've passed all options */ if (*filespec != '-') { break; } filespec++; /* if we find "--", eat it and any following whitespace then return */ if ((filespec[0] == '-') && (filespec[1] == ' ')) { filespec += 2; while (isspace(*filespec)) { filespec++; } break; } /* otherwise, skip this option */ while ((*filespec != '\0') && !isspace(*filespec)) { filespec++; } /* and skip any whitespace */ while (isspace(*filespec)) { filespec++; } } daemon_assert(filespec != NULL); return filespec; } owfs-2.8p15/module/owftpd/src/c/Makefile.in0000664000175000017500000005243211756250027015473 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.21 2008/06/24 11:06:47 d1mag Exp $ 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@ target_triplet = @target@ bin_PROGRAMS = owftpd$(EXEEXT) subdir = module/owftpd/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_owftpd_OBJECTS = file_list.$(OBJEXT) file_cd.$(OBJEXT) \ ftp_command.$(OBJEXT) ftp_listener.$(OBJEXT) \ ftp_session.$(OBJEXT) owftpd.$(OBJEXT) \ telnet_session.$(OBJEXT) watchdog.$(OBJEXT) \ daemon_assert.$(OBJEXT) owftpd_OBJECTS = $(am_owftpd_OBJECTS) owftpd_LDADD = $(LDADD) am__DEPENDENCIES_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(owftpd_SOURCES) DIST_SOURCES = $(owftpd_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ owftpd_SOURCES = file_list.c \ file_cd.c \ ftp_command.c \ ftp_listener.c \ ftp_session.c \ owftpd.c \ telnet_session.c \ watchdog.c \ daemon_assert.c owftpd_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${LIBUSB_CFLAGS} \ ${PTHREAD_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} 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 module/owftpd/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owftpd/src/c/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-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_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 owftpd$(EXEEXT): $(owftpd_OBJECTS) $(owftpd_DEPENDENCIES) $(EXTRA_owftpd_DEPENDENCIES) @rm -f owftpd$(EXEEXT) $(LINK) $(owftpd_OBJECTS) $(owftpd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon_assert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_cd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp_command.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp_listener.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp_session.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owftpd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/telnet_session.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watchdog.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic 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-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owftpd/src/c/file_cd.c0000664000175000017500000001253411356707632015163 00000000000000/* * $Id: file_cd.c,v 1.13 2010/04/06 19:46:34 alfille Exp $ */ #include "owftpd.h" #include #include #include /* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca(); # endif # endif # endif #endif static void WildLexCD(struct cd_parse_s *cps, ASCII * match); void FileLexCD(struct cd_parse_s *cps) { struct parsedname pn; while (1) { switch (cps->pse) { case parse_status_init: LEVEL_DEBUG("FTP parse_status_init Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ cps->ret = 0; cps->solutions = 0; cps->dir = NULL; if (cps->rest == NULL || cps->rest[0] == '\0') { cps->pse = parse_status_tame; } else { if (cps->rest[0] == '/') { // root (absolute) specification cps->buffer[1] = '\0'; ++cps->rest; } cps->pse = parse_status_init2; } break; case parse_status_init2: LEVEL_DEBUG("FTP parse_status_init2 Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ if ((cps->rest[0] == '.' && cps->rest[1] == '.') || strpbrk(cps->rest, "*[?")) { cps->pse = parse_status_back; } else { cps->pse = parse_status_tame; } break; case parse_status_back: LEVEL_DEBUG("FTP parse_status_back Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ if (cps->rest[0] == '.' && cps->rest[1] == '.') { // Move back ASCII *back = strrchr(cps->buffer, '/'); back[1] = '\0'; // look for next file part if (cps->rest[2] == '\0') { cps->pse = parse_status_last; cps->rest = NULL; } else if (cps->rest[2] == '/') { cps->pse = parse_status_next; cps->rest = &cps->rest[3]; } else { cps->ret = -ENOENT; return; } } else { cps->pse = parse_status_next; // off the double dot trail } break; case parse_status_next: LEVEL_DEBUG("FTP parse_status_next Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ if (cps->rest == NULL || cps->rest[0] == '\0') { cps->pse = parse_status_last; } else { ASCII *oldrest = strsep(&cps->rest, "/"); if (strpbrk(oldrest, "*[?")) { WildLexCD(cps, oldrest); return; } else { if (oldrest && (strlen(cps->buffer) + strlen(oldrest) + 4 > PATH_MAX)) { cps->ret = -ENAMETOOLONG; return; } if (cps->buffer[1]) strcat(cps->buffer, "/"); strcat(cps->buffer, oldrest); cps->pse = parse_status_next; } } break; case parse_status_tame: LEVEL_DEBUG("FTP parse_status_tame Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ if (cps->rest && (strlen(cps->buffer) + strlen(cps->rest) + 4 > PATH_MAX)) { cps->ret = -ENAMETOOLONG; return; } if (cps->buffer[1]) strcat(cps->buffer, "/"); strcat(cps->buffer, cps->rest); if (FS_ParsedName(cps->buffer, &pn) == 0) { if (IsDir(&pn)) { ++cps->solutions; if (cps->solutions == 1) cps->dir = strdup(pn.path); } else { cps->ret = -ENOTDIR; } FS_ParsedName_destroy(&pn); } else { cps->ret = -ENOENT; } return; case parse_status_last: LEVEL_DEBUG("FTP parse_status_last Path<%s> File <%s>", cps->buffer, cps->rest); /* cps->buffer is absolute */ /* trailing / only at root */ if (cps->rest && (strlen(cps->buffer) + strlen(cps->rest) + 4 > PATH_MAX)) { cps->ret = -ENAMETOOLONG; return; } if (FS_ParsedNamePlus(cps->buffer, cps->rest, &pn) == 0) { if (IsDir(&pn)) { ++cps->solutions; if (cps->solutions == 1) cps->dir = strdup(pn.path); } else { cps->ret = -ENOTDIR; } FS_ParsedName_destroy(&pn); } return; } } } struct wildlexcd { ASCII *end; ASCII *match; struct cd_parse_s *cps; }; static void WildLexCDCallback(void *v, const struct parsedname *const pn_entry) { struct wildlexcd *wlcd = v; struct cd_parse_s cps; strcpy(&wlcd->end[1], FS_DirName(pn_entry)); //printf("Try %s vs %s\n",end,match) ; //if ( fnmatch( match, end, FNM_PATHNAME|FNM_CASEFOLD ) ) return ; if (fnmatch(wlcd->match, &wlcd->end[1], FNM_PATHNAME)) { return; } //printf("Match! %s\n",end) ; memcpy(&cps, wlcd->cps, sizeof(cps)); cps.pse = parse_status_next; FileLexCD(&cps); } static void WildLexCD(struct cd_parse_s *cps, ASCII * match) { struct parsedname pn; LEVEL_DEBUG("FTP Wildcard patern matching: Path=%s, Pattern=%s, rest=%s", SAFESTRING(cps->buffer), SAFESTRING(match), SAFESTRING(cps->rest)); /* Check potential length */ if (strlen(cps->buffer) + OW_FULLNAME_MAX + 2 > PATH_MAX) { cps->ret = -ENAMETOOLONG; return; } if ( FS_ParsedName(cps->buffer, &pn) != 0 ) { cps->ret = -ENOENT; return; } if (!IsDir(&pn)) { cps->ret = -ENOTDIR; } else { struct wildlexcd wlcd = { NULL, match, cps, }; int root = (cps->buffer[1] == '\0'); wlcd.end = &cps->buffer[strlen(cps->buffer)]; if (root) { --wlcd.end; } wlcd.end[0] = '/'; FS_dir(WildLexCDCallback, &wlcd, &pn); if (root) { ++wlcd.end; } wlcd.end[0] = '\0'; // restore cps->buffer } FS_ParsedName_destroy(&pn); } owfs-2.8p15/module/owftpd/src/c/ftp_listener.c0000644000175000017500000002512611731463642016270 00000000000000/* $Id: ftp_listener.c,v 1.41 2012/03/13 14:13:19 alfille Exp $ This is the code that waits for client connections and creates the threads that handle them. When ftp_listener_init() is called, it binds to the appropriate socket and sets up the other values for the structure. Then, when ftp_listener_start() is called, a thread is started dedicatd to accepting connections. This thread waits for input on two file descriptors. If input arrives on the socket, then it accepts the connection and creates a thread to handle it. If input arrives on the shutdown_request pipe, then the thread terminates. This is how ftp_listener_stop() signals the listener to end. */ #include "owftpd.h" #include #include /* maximum number of consecutive errors in accept() before we terminate listener */ #define MAX_ACCEPT_ERROR 10 /* buffer to hold address string */ #define ADDR_BUF_LEN 100 /* information for a specific connection */ struct connection_info_s { struct ftp_listener_s *ftp_listener; struct telnet_session_s telnet_session; struct ftp_session_s ftp_session; struct watched_s watched; struct connection_info *next; }; /* prototypes */ static int invariant(const struct ftp_listener_s *f); static void *connection_acceptor(void *v); static char *addr2string(const sockaddr_storage_t * s); static void *connection_handler(void *v); static void connection_handler_cleanup(void *v); /* initialize an FTP listener */ /* ftp uses 0 as an error return */ int ftp_listener_init(struct ftp_listener_s *f) { int flags; daemon_assert(f != NULL); LEVEL_DEBUG("ftp_listener_init: name=[%s]", Outbound_Control.head->name); // For sone reason, there must be an IP address included if (strchr(Outbound_Control.head->name, ':') == NULL) { char *newname; char *oldname = Outbound_Control.head->name; newname = malloc(8 + strlen(oldname) + 1); // "0.0.0.0:" + null-char. if (newname == NULL) { LEVEL_DEFAULT("Cannot allocate menory for port name"); return 0; } strcpy(newname, "0.0.0.0:"); strcat(newname, oldname); //LEVEL_DEBUG("OWSERVER composite name <%s> -> <%s>\n",oldname,newname); Outbound_Control.head->name = newname; free(oldname); } if ( BAD( ServerOutSetup(Outbound_Control.head) ) ) { return 0; } // Zeroconf/Bonjour start (since owftpd doesn't use ServerProcess yet) ZeroConf_Announce(Outbound_Control.head); /* prevent socket from blocking on accept() */ flags = fcntl(Outbound_Control.head->file_descriptor, F_GETFL); if (flags == -1) { ERROR_CONNECT("Error getting flags on socket"); return 0; } if (fcntl(Outbound_Control.head->file_descriptor, F_SETFL, flags | O_NONBLOCK) != 0) { ERROR_CONNECT("Error setting socket to non-blocking"); return 0; } /* create a pipe to wake up our listening thread */ if (pipe(f->shutdown_request_fd) != 0) { ERROR_CONNECT("Error creating pipe for internal use"); return 0; } fcntl (f->shutdown_request_fd[fd_pipe_read], F_SETFD, FD_CLOEXEC); // for safe forking fcntl (f->shutdown_request_fd[fd_pipe_write], F_SETFD, FD_CLOEXEC); // for safe forking /* now load the values into the structure, since we can't fail from here */ f->file_descriptor = Outbound_Control.head->file_descriptor; f->max_connections = Globals.max_clients; f->num_connections = 0; f->inactivity_timeout = Globals.timeout_ftp; _MUTEX_INIT(f->mutex); strcpy(f->dir, "/"); f->listener_running = 0; pthread_cond_init(&f->shutdown_cond, NULL); daemon_assert(invariant(f)); return 1; } /* receive connections */ int ftp_listener_start(struct ftp_listener_s *f) { pthread_t thread_id; int ret_val; int error_code; daemon_assert(invariant(f)); error_code = pthread_create(&thread_id, DEFAULT_THREAD_ATTR, connection_acceptor, f); if (error_code == 0) { f->listener_running = 1; f->listener_thread = thread_id; ret_val = 1; } else { errno = error_code; ERROR_CONNECT("Unable to create thread"); ret_val = 0; } daemon_assert(invariant(f)); return ret_val; } #ifndef NDEBUG static int invariant(const struct ftp_listener_s *f) { int dir_len; if (f == NULL) { return 0; } if (f->file_descriptor < 0) { return 0; } if (f->max_connections <= 0) { return 0; } if ((f->num_connections < 0) || (f->num_connections > f->max_connections)) { return 0; } dir_len = strlen(f->dir); if ((dir_len <= 0) || (dir_len > PATH_MAX)) { return 0; } if (f->shutdown_request_fd[fd_pipe_write] < 0) { return 0; } if (f->shutdown_request_fd[fd_pipe_read] < 0) { return 0; } return 1; } #endif /* NDEBUG */ /* handle incoming connections */ static void *connection_acceptor(void *v) { struct ftp_listener_s *f = (struct ftp_listener_s *) v; int num_error; int file_descriptor; int tcp_nodelay; sockaddr_storage_t client_addr; sockaddr_storage_t server_addr; unsigned addr_len; struct connection_info_s *info; pthread_t thread_id; int error_code; fd_set readfds; daemon_assert(invariant(f)); if (!watchdog_init(&f->watchdog, f->inactivity_timeout)) { LEVEL_CONNECT("Error initializing watchdog thread"); return VOID_RETURN; } num_error = 0; for (;;) { /* wait for something to happen */ FD_ZERO(&readfds); FD_SET(f->file_descriptor, &readfds); FD_SET(f->shutdown_request_fd[fd_pipe_read], &readfds); select(FD_SETSIZE, &readfds, NULL, NULL, NULL); /* if data arrived on our pipe, we've been asked to exit */ if (FD_ISSET(f->shutdown_request_fd[fd_pipe_read], &readfds)) { close(f->file_descriptor); LEVEL_CONNECT("Listener no longer accepting connections"); pthread_exit(NULL); return VOID_RETURN; } /* otherwise accept our pending connection (if any) */ addr_len = sizeof(sockaddr_storage_t); file_descriptor = accept(f->file_descriptor, (struct sockaddr *) &client_addr, &addr_len); if (file_descriptor >= 0) { tcp_nodelay = 1; if (setsockopt(file_descriptor, IPPROTO_TCP, TCP_NODELAY, (void *) &tcp_nodelay, sizeof(int)) != 0) { ERROR_CONNECT("Error in setsockopt(), FTP server dropping connection"); close(file_descriptor); continue; } addr_len = sizeof(sockaddr_storage_t); if (getsockname(file_descriptor, (struct sockaddr *) &server_addr, &addr_len) == -1) { ERROR_CONNECT("Error in getsockname(), FTP server dropping connection"); close(file_descriptor); continue; } info = (struct connection_info_s *) malloc(sizeof(struct connection_info_s)); if (info == NULL) { LEVEL_CONNECT("Out of memory, FTP server dropping connection"); close(file_descriptor); continue; } info->ftp_listener = f; telnet_session_init(&info->telnet_session, file_descriptor, file_descriptor); if (!ftp_session_init(&info->ftp_session, &client_addr, &server_addr, &info->telnet_session, f->dir)) { LEVEL_CONNECT("Eerror initializing FTP session, FTP server exiting"); close(file_descriptor); telnet_session_destroy(&info->telnet_session); free(info); continue; } error_code = pthread_create(&thread_id, DEFAULT_THREAD_ATTR, connection_handler, info); if (error_code != 0) { errno = error_code; ERROR_CONNECT("Error creating new thread"); close(file_descriptor); telnet_session_destroy(&info->telnet_session); free(info); } num_error = 0; } else { if ((errno == ECONNABORTED) || (errno == ECONNRESET)) { ERROR_CONNECT("Interruption accepting FTP connection"); } else { ERROR_CONNECT("Error accepting FTP connection"); ++num_error; } if (num_error >= MAX_ACCEPT_ERROR) { LEVEL_CONNECT("Too many consecutive errors, FTP server exiting"); return VOID_RETURN; } } } return VOID_RETURN; } /* convert an address to a printable string */ /* NOT THREADSAFE - wrap with a mutex before calling! */ static char *addr2string(const sockaddr_storage_t * s) { char *ret_val; daemon_assert(s != NULL); #ifdef INET6 { static char addr[IP_ADDRSTRLEN + 1]; int error; error = getnameinfo((struct sockaddr *) s, sizeof(sockaddr_storage_t), addr, sizeof(addr), NULL, 0, NI_NUMERICHOST); if (error != 0) { LEVEL_CONNECT("getnameinfo error; %s", gai_strerror(error)); ret_val = "Unknown IP"; } else { ret_val = addr; } } #else ret_val = inet_ntoa(s->sin_addr); #endif return ret_val; } static void *connection_handler(void *v) { struct connection_info_s *info = (struct connection_info_s *) v; struct ftp_listener_s *f; int num_connections; char drop_reason[80]; /* for ease of use only */ f = info->ftp_listener; /* don't save state for pthread_join() */ DETACH_THREAD; /* set up our watchdog */ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); watchdog_add_watched(&f->watchdog, &info->watched); /* set up our cleanup handler */ pthread_cleanup_push(connection_handler_cleanup, info); /* process global data */ _MUTEX_LOCK(f->mutex); num_connections = ++f->num_connections; ERROR_DEBUG("%s port %d connection", addr2string(&info->ftp_session.client_addr), ntohs(SINPORT(&info->ftp_session.client_addr))); _MUTEX_UNLOCK(f->mutex); /* handle the session */ if (num_connections <= f->max_connections) { ftp_session_run(&info->ftp_session, &info->watched); } else { /* too many users */ sprintf(drop_reason, "Too many users logged in, dropping connection (%d logins maximum)", f->max_connections); ftp_session_drop(&info->ftp_session, drop_reason); /* log the rejection */ _MUTEX_LOCK(f->mutex); LEVEL_CONNECT ("%s port %d exceeds max users (%d), dropping connection", addr2string(&info->ftp_session.client_addr), ntohs(SINPORT(&info->ftp_session.client_addr)), num_connections); _MUTEX_UNLOCK(f->mutex); } /* exunt (pop calls cleanup function) */ pthread_cleanup_pop(1); /* return for form :) */ return VOID_RETURN; } /* clean up a connection */ static void connection_handler_cleanup(void *v) { struct connection_info_s *info = (struct connection_info_s *) v; struct ftp_listener_s *f; f = info->ftp_listener; watchdog_remove_watched(&info->watched); _MUTEX_LOCK(f->mutex); f->num_connections--; pthread_cond_signal(&f->shutdown_cond); LEVEL_CONNECT("%s port %d disconnected", addr2string(&info->ftp_session.client_addr), ntohs(SINPORT(&info->ftp_session.client_addr))); _MUTEX_UNLOCK(f->mutex); ftp_session_destroy(&info->ftp_session); telnet_session_destroy(&info->telnet_session); free(info); } void ftp_listener_stop(struct ftp_listener_s *f) { int ignore ; daemon_assert(invariant(f)); /* write a byte to the listening thread - this will wake it up */ ignore = write(f->shutdown_request_fd[fd_pipe_write], "", 1); /* wait for client connections to complete */ _MUTEX_LOCK(f->mutex); while (f->num_connections > 0) { pthread_cond_wait(&f->shutdown_cond, &f->mutex); } _MUTEX_UNLOCK(f->mutex); } owfs-2.8p15/module/owftpd/src/c/telnet_session.c0000664000175000017500000002411610750074137016625 00000000000000/* * $Id: telnet_session.c,v 1.11 2008/01/30 13:15:11 d1mag Exp $ */ #include "owftpd.h" /* characters to process */ #define SE 240 #define NOP 241 #define DATA_MARK 242 #define BRK 243 #define IP 244 #define AO 245 #define AYT 246 #define EC 247 #define EL 248 #define GA 249 #define SB 250 #define WILL 251 #define WONT 252 #define DO 253 #define DONT 254 #define IAC 255 /* input states */ #define NORMAL 0 #define GOT_IAC 1 #define GOT_WILL 2 #define GOT_WONT 3 #define GOT_DO 4 #define GOT_DONT 5 #define GOT_CR 6 /* prototypes */ static int invariant(const struct telnet_session_s *t); static void process_data(struct telnet_session_s *t, int wait_flag); static void read_incoming_data(struct telnet_session_s *t); static void process_incoming_char(struct telnet_session_s *t, int c); static void add_incoming_char(struct telnet_session_s *t, int c); static int use_incoming_char(struct telnet_session_s *t); static void write_outgoing_data(struct telnet_session_s *t); static void add_outgoing_char(struct telnet_session_s *t, int c); static int max_input_read(struct telnet_session_s *t); /* initialize a telnet session */ void telnet_session_init(struct telnet_session_s *t, int in, int out) { daemon_assert(t != NULL); daemon_assert(in >= 0); daemon_assert(out >= 0); t->in_fd = in; t->in_errno = 0; t->in_eof = 0; t->in_take = t->in_add = 0; t->in_buflen = 0; t->in_status = NORMAL; t->out_fd = out; t->out_errno = 0; t->out_eof = 0; t->out_take = t->out_add = 0; t->out_buflen = 0; process_data(t, 0); daemon_assert(invariant(t)); } /* print output */ int telnet_session_print(struct telnet_session_s *t, const char *s) { int len; int amt_printed; daemon_assert(invariant(t)); len = strlen(s); if (len == 0) { daemon_assert(invariant(t)); return 1; } amt_printed = 0; do { if ((t->out_errno != 0) || (t->out_eof != 0)) { daemon_assert(invariant(t)); return 0; } while ((amt_printed < len) && (t->out_buflen < BUF_LEN)) { daemon_assert(s[amt_printed] != '\0'); add_outgoing_char(t, s[amt_printed]); amt_printed++; } process_data(t, 1); } while (amt_printed < len); while (t->out_buflen > 0) { if ((t->out_errno != 0) || (t->out_eof != 0)) { daemon_assert(invariant(t)); return 0; } process_data(t, 1); } daemon_assert(invariant(t)); return 1; } /* print a line output */ int telnet_session_println(struct telnet_session_s *t, const char *s) { daemon_assert(invariant(t)); if (!telnet_session_print(t, s)) { daemon_assert(invariant(t)); return 0; } if (!telnet_session_print(t, "\015\012")) { daemon_assert(invariant(t)); return 0; } daemon_assert(invariant(t)); return 1; } /* read a line */ int telnet_session_readln(struct telnet_session_s *t, char *buf, int buflen) { int amt_read; daemon_assert(invariant(t)); amt_read = 0; for (;;) { if ((t->in_errno != 0) || (t->in_eof != 0)) { daemon_assert(invariant(t)); return 0; } while (t->in_buflen > 0) { if (amt_read == buflen - 1) { buf[amt_read] = '\0'; daemon_assert(invariant(t)); return 1; } daemon_assert(amt_read >= 0); daemon_assert(amt_read < buflen); buf[amt_read] = use_incoming_char(t); if (buf[amt_read] == '\012') { daemon_assert(amt_read + 1 >= 0); daemon_assert(amt_read + 1 < buflen); buf[amt_read + 1] = '\0'; daemon_assert(invariant(t)); return 1; } amt_read++; } process_data(t, 1); } } void telnet_session_destroy(struct telnet_session_s *t) { daemon_assert(invariant(t)); close(t->in_fd); if (t->out_fd != t->in_fd) { close(t->out_fd); } t->in_fd = -1; t->out_fd = -1; } /* receive any incoming data, send any pending data */ static void process_data(struct telnet_session_s *t, int wait_flag) { fd_set readfds; fd_set writefds; fd_set exceptfds; struct timeval tv_zero; struct timeval *tv; /* set up our select() variables */ FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); if (wait_flag) { tv = NULL; } else { tv_zero.tv_sec = 0; tv_zero.tv_usec = 0; tv = &tv_zero; } /* only check for input if we can accept input */ if ((t->in_errno == 0) && (t->in_eof == 0) && (max_input_read(t) > 0)) { FD_SET(t->in_fd, &readfds); FD_SET(t->in_fd, &exceptfds); } /* only check for output if we have pending output */ if ((t->out_errno == 0) && (t->out_eof == 0) && (t->out_buflen > 0)) { FD_SET(t->out_fd, &writefds); FD_SET(t->out_fd, &exceptfds); } /* see if there's anything to do */ if (select(FD_SETSIZE, &readfds, &writefds, &exceptfds, tv) > 0) { if (FD_ISSET(t->in_fd, &exceptfds)) { t->in_eof = 1; } else if (FD_ISSET(t->in_fd, &readfds)) { read_incoming_data(t); } if (FD_ISSET(t->out_fd, &exceptfds)) { t->out_eof = 1; } else if (FD_ISSET(t->out_fd, &writefds)) { write_outgoing_data(t); } } } static void read_incoming_data(struct telnet_session_s *t) { ssize_t read_ret; char buf[BUF_LEN]; ssize_t i; /* read as much data as we have buffer space for */ daemon_assert(max_input_read(t) <= BUF_LEN); read_ret = read(t->in_fd, buf, max_input_read(t)); /* handle three possible read results */ if (read_ret == -1) { t->in_errno = errno; } else if (read_ret == 0) { t->in_eof = 1; } else { for (i = 0; i < read_ret; i++) { process_incoming_char(t, (unsigned char) buf[i]); } } } /* process a single character */ static void process_incoming_char(struct telnet_session_s *t, int c) { switch (t->in_status) { case GOT_IAC: switch (c) { case WILL: t->in_status = GOT_WILL; break; case WONT: t->in_status = GOT_WONT; break; case DO: t->in_status = GOT_DO; break; case DONT: t->in_status = GOT_DONT; break; case IAC: add_incoming_char(t, IAC); t->in_status = NORMAL; break; default: t->in_status = NORMAL; } break; case GOT_WILL: add_outgoing_char(t, IAC); add_outgoing_char(t, DONT); add_outgoing_char(t, c); t->in_status = NORMAL; break; case GOT_WONT: t->in_status = NORMAL; break; case GOT_DO: add_outgoing_char(t, IAC); add_outgoing_char(t, WONT); add_outgoing_char(t, c); t->in_status = NORMAL; break; case GOT_DONT: t->in_status = NORMAL; break; case GOT_CR: add_incoming_char(t, '\012'); if (c != '\012') { add_incoming_char(t, c); } t->in_status = NORMAL; break; case NORMAL: if (c == IAC) { t->in_status = GOT_IAC; } else if (c == '\015') { t->in_status = GOT_CR; } else { add_incoming_char(t, c); } } } /* add a single character, wrapping buffer if necessary (should never occur) */ static void add_incoming_char(struct telnet_session_s *t, int c) { daemon_assert(t->in_add >= 0); daemon_assert(t->in_add < BUF_LEN); t->in_buf[t->in_add] = c; t->in_add++; if (t->in_add == BUF_LEN) { t->in_add = 0; } if (t->in_buflen == BUF_LEN) { t->in_take++; if (t->in_take == BUF_LEN) { t->in_take = 0; } } else { t->in_buflen++; } } /* remove a single character */ static int use_incoming_char(struct telnet_session_s *t) { int c; daemon_assert(t->in_take >= 0); daemon_assert(t->in_take < BUF_LEN); c = t->in_buf[t->in_take]; t->in_take++; if (t->in_take == BUF_LEN) { t->in_take = 0; } t->in_buflen--; return c; } /* add a single character, hopefully will never happen :) */ static void add_outgoing_char(struct telnet_session_s *t, int c) { daemon_assert(t->out_add >= 0); daemon_assert(t->out_add < BUF_LEN); t->out_buf[t->out_add] = c; t->out_add++; if (t->out_add == BUF_LEN) { t->out_add = 0; } if (t->out_buflen == BUF_LEN) { t->out_take++; if (t->out_take == BUF_LEN) { t->out_take = 0; } } else { t->out_buflen++; } } static void write_outgoing_data(struct telnet_session_s *t) { ssize_t write_ret; if (t->out_take < t->out_add) { /* handle a buffer that looks like this: */ /* |-- empty --|-- data --|-- empty --| */ daemon_assert(t->out_take >= 0); daemon_assert(t->out_take < BUF_LEN); daemon_assert(t->out_buflen > 0); daemon_assert(t->out_buflen + t->out_take <= BUF_LEN); write_ret = write(t->out_fd, t->out_buf + t->out_take, t->out_buflen); } else { /* handle a buffer that looks like this: */ /* |-- data --|-- empty --|-- data --| */ daemon_assert(t->out_take >= 0); daemon_assert(t->out_take < BUF_LEN); daemon_assert((BUF_LEN - t->out_take) > 0); write_ret = write(t->out_fd, t->out_buf + t->out_take, BUF_LEN - t->out_take); } /* handle three possible write results */ if (write_ret == -1) { t->out_errno = errno; } else if (write_ret == 0) { t->out_eof = 1; } else { t->out_buflen -= write_ret; t->out_take += write_ret; if (t->out_take >= BUF_LEN) { t->out_take -= BUF_LEN; } } } /* return the amount of a read */ static int max_input_read(struct telnet_session_s *t) { int max_in; int max_out; daemon_assert(invariant(t)); /* figure out how much space is available in the input buffer */ if (t->in_buflen < BUF_LEN) { max_in = BUF_LEN - t->in_buflen; } else { max_in = 0; } /* worry about space in the output buffer (for DONT/WONT replies) */ if (t->out_buflen < BUF_LEN) { max_out = BUF_LEN - t->out_buflen; } else { max_out = 0; } daemon_assert(invariant(t)); /* return the minimum of the two values */ return (max_in < max_out) ? max_in : max_out; } #ifndef NDEBUG static int invariant(const struct telnet_session_s *t) { if (t == NULL) { return 0; } if (t->in_fd < 0) { return 0; } if ((t->in_take < 0) || (t->in_take >= BUF_LEN)) { return 0; } if ((t->in_add < 0) || (t->in_add >= BUF_LEN)) { return 0; } if ((t->in_buflen < 0) || (t->in_buflen > BUF_LEN)) { return 0; } switch (t->in_status) { case NORMAL: break; case GOT_IAC: break; case GOT_WILL: break; case GOT_WONT: break; case GOT_DO: break; case GOT_DONT: break; case GOT_CR: break; default: return 0; } if (t->out_fd < 0) { return 0; } if ((t->out_take < 0) || (t->out_take >= BUF_LEN)) { return 0; } if ((t->out_add < 0) || (t->out_add >= BUF_LEN)) { return 0; } if ((t->out_buflen < 0) || (t->out_buflen > BUF_LEN)) { return 0; } return 1; } #endif /* NDEBUG */ owfs-2.8p15/module/owftpd/src/c/Makefile.am0000664000175000017500000000150611030152507015443 00000000000000# $Id: Makefile.am,v 1.21 2008/06/24 11:06:47 d1mag Exp $ bin_PROGRAMS = owftpd owftpd_SOURCES = file_list.c \ file_cd.c \ ftp_command.c \ ftp_listener.c \ ftp_session.c \ owftpd.c \ telnet_session.c \ watchdog.c \ daemon_assert.c owftpd_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${LIBUSB_CFLAGS} \ ${PTHREAD_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owftpd/src/c/ftp_session.c0000644000175000017500000011566011731463642016131 00000000000000/* * $Id: ftp_session.c,v 1.67 2012/03/13 00:06:35 alfille Exp $ */ #include "owftpd.h" #include #include #include /* space requirements */ #define ADDRPORT_STRLEN 58 /* prototypes */ static int invariant(const struct ftp_session_s *f); static void reply(struct ftp_session_s *f, int code, const char *fmt, ...); static void change_dir(struct ftp_session_s *f, const char *new_dir); static int open_connection(struct ftp_session_s *f); static int write_fully(int file_descriptor, const char *buf, int buflen); static void init_passive_port(void); static int get_passive_port(void); static int convert_newlines(char *dst, const char *src, int srclen); static void get_addr_str(const sockaddr_storage_t * s, char *buf, int bufsiz); static void send_readme(const struct ftp_session_s *f, int code); static void netscape_hack(int file_descriptor); static void set_port(struct ftp_session_s *f, const sockaddr_storage_t * host_port); static int set_pasv(struct ftp_session_s *f, sockaddr_storage_t * host_port); //static int ip_equal(const sockaddr_storage_t *a, const sockaddr_storage_t *b); static int ip_equal(const sockaddr_storage_t * a, const sockaddr_storage_t * b); static void get_absolute_fname(char *fname, size_t fname_len, const char *dir, const char *file); static void both_list(struct ftp_session_s *f, const struct ftp_command_s *cmd, enum file_list_e fle); /* command handlers */ static void do_user(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_pass(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_cwd(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_cdup(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_quit(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_port(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_pasv(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_type(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_stru(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_mode(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_retr(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_stor(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_pwd(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_nlst(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_list(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_syst(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_noop(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_rest(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_lprt(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_lpsv(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_eprt(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_epsv(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_size(struct ftp_session_s *f, const struct ftp_command_s *cmd); static void do_mdtm(struct ftp_session_s *f, const struct ftp_command_s *cmd); static struct { char *name; void (*func) (struct ftp_session_s * f, const struct ftp_command_s * cmd); } command_func[] = { { "USER", do_user}, { "PASS", do_pass}, { "CWD", do_cwd}, { "CDUP", do_cdup}, { "QUIT", do_quit}, { "PORT", do_port}, { "PASV", do_pasv}, { "LPRT", do_lprt}, { "LPSV", do_lpsv}, { "EPRT", do_eprt}, { "EPSV", do_epsv}, { "TYPE", do_type}, { "STRU", do_stru}, { "MODE", do_mode}, { "RETR", do_retr}, { "STOR", do_stor}, { "PWD", do_pwd}, { "NLST", do_nlst}, { "LIST", do_list}, { "SYST", do_syst}, { "NOOP", do_noop}, { "REST", do_rest}, { "SIZE", do_size}, { "MDTM", do_mdtm} }; #define NUM_COMMAND_FUNC (sizeof(command_func) / sizeof(command_func[0])) int ftp_session_init(struct ftp_session_s *f, const sockaddr_storage_t * client_addr, const sockaddr_storage_t * server_addr, struct telnet_session_s *t, const char *dir) { daemon_assert(f != NULL); daemon_assert(client_addr != NULL); daemon_assert(server_addr != NULL); daemon_assert(t != NULL); daemon_assert(dir != NULL); daemon_assert(strlen(dir) <= PATH_MAX); #ifdef INET6 /* if the control connection is on IPv6, we need to get an IPv4 address */ /* to bind the socket to */ if (SSFAM(server_addr) == AF_INET6) { struct addrinfo hints; struct addrinfo *res; int errcode; /* getaddrinfo() does the job nicely */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_INET; hints.ai_flags = AI_PASSIVE; if (getaddrinfo(NULL, "ftp", &hints, &res) != 0) { ERROR_CONNECT("Unable to determing IPv4 address; %s", gai_strerror(errcode)); return 0; } /* let's sanity check */ daemon_assert(res != NULL); daemon_assert(sizeof(f->server_ipv4_addr) >= res->ai_addrlen); daemon_assert(SSFAM(host_port) == AF_INET); /* copy the result and free memory as necessary */ memcpy(&f->server_ipv4_addr, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); } else { daemon_assert(SSFAM(host_port) == AF_INET); f->server_ipv4_addr = *server_addr; } #else f->server_ipv4_addr = *server_addr; #endif f->session_active = 1; f->command_number = 0; f->data_type = TYPE_ASCII; f->file_structure = STRU_FILE; f->file_offset = 0; f->file_offset_command_number = ULONG_MAX; f->epsv_all_set = 0; f->client_addr = *client_addr; get_addr_str(client_addr, f->client_addr_str, sizeof(f->client_addr_str)); f->server_addr = *server_addr; f->telnet_session = t; daemon_assert(strlen(dir) < sizeof(f->dir)); strcpy(f->dir, dir); f->data_channel = DATA_PORT; f->data_port = *client_addr; f->server_fd = -1; daemon_assert(invariant(f)); return 1; } void ftp_session_drop(struct ftp_session_s *f, const char *reason) { daemon_assert(invariant(f)); daemon_assert(reason != NULL); /* say goodbye */ reply(f, 421, "%s.", reason); daemon_assert(invariant(f)); } void ftp_session_run(struct ftp_session_s *f, struct watched_s *watched) { char buf[2048]; int len; struct ftp_command_s cmd; size_t i; daemon_assert(invariant(f)); daemon_assert(watched != NULL); /* record our watchdog */ f->watched = watched; /* say hello */ send_readme(f, 220); reply(f, 220, "Service ready for new user."); /* process commands */ while (f->session_active && telnet_session_readln(f->telnet_session, buf, sizeof(buf))) { /* delay our timeout based on this input */ watchdog_defer_watched(f->watched); /* increase our command count */ if (f->command_number == ULONG_MAX) { f->command_number = 0; } else { f->command_number++; } /* make sure we read a whole line */ len = strlen(buf); if (buf[len - 1] != '\n') { reply(f, 500, "Command line too long."); while (telnet_session_readln(f->telnet_session, buf, sizeof(buf))) { len = strlen(buf); if (buf[len - 1] == '\n') break; } goto next_command; } syslog(LOG_DEBUG, "%s %s", f->client_addr_str, buf); /* parse the line */ if (!ftp_command_parse(buf, &cmd)) { reply(f, 500, "Syntax error, command unrecognized."); goto next_command; } /* dispatch the command */ for (i = 0; i < NUM_COMMAND_FUNC; i++) { if (strcmp(cmd.command, command_func[i].name) == 0) { (command_func[i].func) (f, &cmd); goto next_command; } } /* oops, we don't have this command (shouldn't happen - shrug) */ reply(f, 502, "Command not implemented."); next_command:{ } } daemon_assert(invariant(f)); } void ftp_session_destroy(struct ftp_session_s *f) { daemon_assert(invariant(f)); if (f->server_fd != -1) { close(f->server_fd); f->server_fd = -1; } } #ifndef NDEBUG static int invariant(const struct ftp_session_s *f) { int len; if (f == NULL) { return 0; } if ((f->session_active != 0) && (f->session_active != 1)) { return 0; } if ((f->data_type != TYPE_ASCII) && (f->data_type != TYPE_IMAGE)) { return 0; } if ((f->file_structure != STRU_FILE) && (f->file_structure != STRU_RECORD)) { return 0; } if (f->file_offset < 0) { return 0; } if ((f->epsv_all_set != 0) && (f->epsv_all_set != 1)) { return 0; } len = strlen(f->client_addr_str); if ((len <= 0) || (len >= ADDRPORT_STRLEN)) { return 0; } if (f->telnet_session == NULL) { return 0; } switch (f->data_channel) { case DATA_PORT: /* If the client specifies a port, verify that it is from the */ /* host the client connected from. This prevents a client from */ /* using the server to open connections to arbritrary hosts. */ if (!ip_equal(&f->client_addr, &f->data_port)) { return 0; } if (f->server_fd != -1) { return 0; } break; case DATA_PASSIVE: if (f->server_fd < 0) { return 0; } break; default: return 0; } return 1; } #endif /* NDEBUG */ static void reply(struct ftp_session_s *f, int code, const char *fmt, ...) { char buf[256]; va_list ap; daemon_assert(invariant(f)); daemon_assert(code >= 100); daemon_assert(code <= 559); daemon_assert(fmt != NULL); /* prepend our code to the buffer */ sprintf(buf, "%d", code); buf[3] = ' '; /* add the formatted output of the caller to the buffer */ va_start(ap, fmt); vsnprintf(buf + 4, sizeof(buf) - 4, fmt, ap); va_end(ap); /* log our reply */ LEVEL_DATA("%s %s", f->client_addr_str, buf); /* send the output to the other side */ telnet_session_println(f->telnet_session, buf); daemon_assert(invariant(f)); } static void do_user(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const char *user; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); user = cmd->arg[0].string; if (strcasecmp(user, "ftp") && strcasecmp(user, "anonymous")) { LEVEL_CONNECT("%s attempted to log in as \"%s\"", f->client_addr_str, user); //reply(f, 530, "Only anonymous FTP supported."); reply(f, 331, "Force Anonymous. Send e-mail address as password."); } else { reply(f, 331, "Send e-mail address as password."); } daemon_assert(invariant(f)); } static void do_pass(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const char *password; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); password = cmd->arg[0].string; LEVEL_CONNECT("%s reports e-mail address \"%s\"", f->client_addr_str, password); reply(f, 230, "User logged in, proceed."); daemon_assert(invariant(f)); } #ifdef INET6 static void get_addr_str(const sockaddr_storage_t * s, char *buf, int bufsiz) { int port; int error; int len; daemon_assert(s != NULL); daemon_assert(buf != NULL); /* buf must be able to contain (at least) a string representing an * ipv4 addr, followed by the string " port " (6 chars) and the port * number (which is 5 chars max), plus the '\0' character. */ daemon_assert(bufsiz >= (INET_ADDRSTRLEN + 12)); error = getnameinfo(client_addr, sizeof(sockaddr_storage_t), buf, bufsiz, NULL, 0, NI_NUMERICHOST); /* getnameinfo() should never fail when called with NI_NUMERICHOST */ daemon_assert(error == 0); len = strlen(buf); daemon_assert(bufsiz >= len + 12); snprintf(buf + len, bufsiz - len, " port %d", ntohs(SINPORT(&f->client_addr))); } #else static void get_addr_str(const sockaddr_storage_t * s, char *buf, int bufsiz) { unsigned int addr; int port; daemon_assert(s != NULL); daemon_assert(buf != NULL); /* buf must be able to contain (at least) a string representing an * ipv4 addr, followed by the string " port " (6 chars) and the port * number (which is 5 chars max), plus the '\0' character. */ daemon_assert(bufsiz >= (INET_ADDRSTRLEN + 12)); addr = ntohl(s->sin_addr.s_addr); port = ntohs(s->sin_port); snprintf(buf, bufsiz, "%d.%d.%d.%d port %d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff, port); } #endif static void do_cwd(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const char *new_dir; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); new_dir = cmd->arg[0].string; change_dir(f, new_dir); daemon_assert(invariant(f)); } static void do_cdup(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); change_dir(f, ".."); daemon_assert(invariant(f)); } static void change_dir(struct ftp_session_s *f, const char *new_dir) { struct cd_parse_s cps; strcpy(cps.buffer, (ASCII *) f->dir); strcpy(cps.rest, new_dir); cps.pse = parse_status_init; LEVEL_DEBUG("CD dir=%s, file=%s", SAFESTRING(cps.buffer), SAFESTRING(new_dir)); FileLexCD(&cps); switch (cps.solutions) { case 0: cps.ret = -ENOENT; case 1: break; default: cps.ret = -EFAULT; } if (cps.dir == NULL) { cps.ret = -ENOMEM; } if (cps.ret) { reply(f, 550, "Error changing directory. %s", strerror(-cps.ret)); } else { strcpy(f->dir, cps.dir); reply(f, 250, "Directory change successful."); } if (cps.dir) { free(cps.dir); } if (cps.rest) { free(cps.dir); } } static void do_quit(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); reply(f, 221, "Service closing control connection."); f->session_active = 0; daemon_assert(invariant(f)); } /* support for the various port setting functions */ static void set_port(struct ftp_session_s *f, const sockaddr_storage_t * host_port) { daemon_assert(invariant(f)); daemon_assert(host_port != NULL); if (f->epsv_all_set) { reply(f, 500, "After EPSV ALL, only EPSV allowed."); } else if (!ip_equal(&f->client_addr, host_port)) { reply(f, 500, "Port must be on command channel IP."); } else if (ntohs(cSINPORT(host_port)) < IPPORT_RESERVED) { reply(f, 500, "Port may not be less than 1024, which is reserved."); } else { /* close any outstanding PASSIVE port */ if (f->data_channel == DATA_PASSIVE) { close(f->server_fd); f->server_fd = -1; } f->data_channel = DATA_PORT; f->data_port = *host_port; reply(f, 200, "Command okay."); } daemon_assert(invariant(f)); } /* set IP and port for client to receive data on */ static void do_port(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const sockaddr_storage_t *host_port; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); host_port = &cmd->arg[0].host_port; daemon_assert(cSSFAM(host_port) == AF_INET); set_port(f, host_port); daemon_assert(invariant(f)); } /* set IP and port for client to receive data on, transport independent */ static void do_lprt(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const sockaddr_storage_t *host_port; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); host_port = &cmd->arg[0].host_port; #ifdef INET6 if ((cSSFAM(host_port) != AF_INET) && (cSSFAM(host_port) != AF_INET6)) { reply(f, 521, "Only IPv4 and IPv6 supported, address families (4,6)"); } #else if (cSSFAM(host_port) != AF_INET) { reply(f, 521, "Only IPv4 supported, address family (4)"); } #endif set_port(f, host_port); daemon_assert(invariant(f)); } /* set IP and port for the client to receive data on, IPv6 extension */ /* */ /* RFC 2428 specifies that if the data connection is going to be on */ /* the same IP as the control connection, EPSV must be used. Since */ /* that is the only mode of transfer we support, we reject all EPRT */ /* requests. */ static void do_eprt(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); reply(f, 500, "EPRT not supported, use EPSV."); daemon_assert(invariant(f)); } /* support for the various pasv setting functions */ /* returns the file descriptor of the bound port, or -1 on error */ /* note: the "host_port" parameter will be modified, having its port set */ static int set_pasv(struct ftp_session_s *f, sockaddr_storage_t * bind_addr) { int socket_fd; int port; daemon_assert(invariant(f)); daemon_assert(bind_addr != NULL); socket_fd = socket(SSFAM(bind_addr), SOCK_STREAM, 0); if (socket_fd == -1) { reply(f, 500, "Error creating server socket; %s.", strerror(errno)); return -1; } fcntl (socket_fd, F_SETFD, FD_CLOEXEC); // for safe forking for (;;) { port = get_passive_port(); SINPORT(bind_addr) = htons(port); if (bind(socket_fd, (struct sockaddr *) bind_addr, sizeof(struct sockaddr)) == 0) { break; } if (errno != EADDRINUSE) { reply(f, 500, "Error binding server port; %s.", strerror(errno)); close(socket_fd); return -1; } } if (listen(socket_fd, 1) != 0) { reply(f, 500, "Error listening on server port; %s.", strerror(errno)); close(socket_fd); return -1; } return socket_fd; } /* pick a server port to listen for connection on */ static void do_pasv(struct ftp_session_s *f, const struct ftp_command_s *cmd) { int socket_fd; unsigned int addr; int port; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); if (f->epsv_all_set) { reply(f, 500, "After EPSV ALL, only EPSV allowed."); goto exit_pasv; } socket_fd = set_pasv(f, &f->server_ipv4_addr); if (socket_fd == -1) { goto exit_pasv; } /* report port to client */ addr = ntohl(f->server_ipv4_addr.sin_addr.s_addr); port = ntohs(f->server_ipv4_addr.sin_port); reply(f, 227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d).", addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff, port >> 8, port & 0xff); /* close any outstanding PASSIVE port */ if (f->data_channel == DATA_PASSIVE) { close(f->server_fd); } f->data_channel = DATA_PASSIVE; f->server_fd = socket_fd; exit_pasv: daemon_assert(invariant(f)); } /* pick a server port to listen for connection on, including IPv6 */ static void do_lpsv(struct ftp_session_s *f, const struct ftp_command_s *cmd) { int socket_fd; char addr[80]; uint8_t *a; uint8_t *p; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); if (f->epsv_all_set) { reply(f, 500, "After EPSV ALL, only EPSV allowed."); goto exit_lpsv; } socket_fd = set_pasv(f, &f->server_addr); if (socket_fd == -1) { goto exit_lpsv; } /* report address and port to client */ #ifdef INET6 if (SSFAM(&f->server_addr) == AF_INET6) { a = (uint8_t *) & SIN6ADDR(&f->server_addr); p = (uint8_t *) & SIN6PORT(&f->server_addr); snprintf(addr, sizeof(addr), "(6,16,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,2,%d,%d)", a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], p[0], p[1]); } else #endif { a = (uint8_t *) & SIN4ADDR(&f->server_addr); p = (uint8_t *) & SIN4PORT(&f->server_addr); snprintf(addr, sizeof(addr), "(4,4,%d,%d,%d,%d,2,%d,%d)", a[0], a[1], a[2], a[3], p[0], p[1]); } reply(f, 228, "Entering Long Passive Mode %s", addr); /* close any outstanding PASSIVE port */ if (f->data_channel == DATA_PASSIVE) { close(f->server_fd); } f->data_channel = DATA_PASSIVE; f->server_fd = socket_fd; exit_lpsv: daemon_assert(invariant(f)); } /* pick a server port to listen for connection on, new IPv6 method */ static void do_epsv(struct ftp_session_s *f, const struct ftp_command_s *cmd) { int socket_fd; sockaddr_storage_t *addr; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert((cmd->num_arg == 0) || (cmd->num_arg == 1)); /* check our argument, if any, and use the appropriate address */ if (cmd->num_arg == 0) { addr = &f->server_addr; } else { switch (cmd->arg[0].num) { /* EPSV_ALL is a special number indicating the client sent */ /* the command "EPSV ALL" - this is not a request to assign */ /* a new passive port, but rather to deny all future port */ /* assignment requests other than EPSV */ case EPSV_ALL: f->epsv_all_set = 1; reply(f, 200, "EPSV ALL command successful."); goto exit_epsv; case 1: addr = (sockaddr_storage_t *) & f->server_ipv4_addr; break; #ifdef INET6 case 2: addr = &f->server_addr; break; default: reply(f, 522, "Only IPv4 and IPv6 supported, use (1,2)"); goto exit_epsv; #else default: reply(f, 522, "Only IPv4 supported, use (1)"); goto exit_epsv; #endif } } /* bind port and so on */ socket_fd = set_pasv(f, addr); if (socket_fd == -1) { goto exit_epsv; } /* report port to client */ reply(f, 229, "Entering Extended Passive Mode (|||%d|)", ntohs(SINPORT(&f->server_addr))); /* close any outstanding PASSIVE port */ if (f->data_channel == DATA_PASSIVE) { close(f->server_fd); } f->data_channel = DATA_PASSIVE; f->server_fd = socket_fd; exit_epsv: daemon_assert(invariant(f)); } /* seed the random number generator used to pick a port */ static void init_passive_port() { struct timeval tv; unsigned short int seed[3]; gettimeofday(&tv, NULL); seed[0] = (tv.tv_sec >> 16) & 0xFFFF; seed[1] = tv.tv_sec & 0xFFFF; seed[2] = tv.tv_usec & 0xFFFF; seed48(seed); } /* pick a port to try to bind() for passive FTP connections */ static int get_passive_port() { static pthread_once_t once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; int port; /* initialize the random number generator the first time we're called */ pthread_once(&once_control, init_passive_port); /* pick a random port between 1024 and 65535, inclusive */ _MUTEX_LOCK(mutex); port = (lrand48() % 64512) + 1024; _MUTEX_UNLOCK(mutex); return port; } static void do_type(struct ftp_session_s *f, const struct ftp_command_s *cmd) { char type; char form; int cmd_okay; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg >= 1); daemon_assert(cmd->num_arg <= 2); type = cmd->arg[0].string[0]; if (cmd->num_arg == 2) { form = cmd->arg[1].string[0]; } else { form = 0; } cmd_okay = 0; if (type == 'A') { if ((cmd->num_arg == 1) || ((cmd->num_arg == 2) && (form == 'N'))) { f->data_type = TYPE_ASCII; cmd_okay = 1; } } else if (type == 'I') { f->data_type = TYPE_IMAGE; cmd_okay = 1; } if (cmd_okay) { reply(f, 200, "Command okay."); } else { reply(f, 504, "Command not implemented for that parameter."); } daemon_assert(invariant(f)); } static void do_stru(struct ftp_session_s *f, const struct ftp_command_s *cmd) { char structure; int cmd_okay; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); structure = cmd->arg[0].string[0]; cmd_okay = 0; if (structure == 'F') { f->file_structure = STRU_FILE; cmd_okay = 1; } else if (structure == 'R') { f->file_structure = STRU_RECORD; cmd_okay = 1; } if (cmd_okay) { reply(f, 200, "Command okay."); } else { reply(f, 504, "Command not implemented for that parameter."); } daemon_assert(invariant(f)); } static void do_mode(struct ftp_session_s *f, const struct ftp_command_s *cmd) { char mode; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); mode = cmd->arg[0].string[0]; if (mode == 'S') { reply(f, 200, "Command okay."); } else { reply(f, 504, "Command not implemented for that parameter."); } daemon_assert(invariant(f)); } /* convert the user-entered file name into a full path on our local drive */ static void get_absolute_fname(char *fname, size_t fname_len, const char *dir, const char *file) { daemon_assert(fname != NULL); daemon_assert(dir != NULL); daemon_assert(file != NULL); if (*file == '/') { /* absolute path, use as input */ daemon_assert(strlen(file) < fname_len); strcpy(fname, file); } else { /* construct a file name based on our current directory */ daemon_assert(strlen(dir) + 1 + strlen(file) < fname_len); strcpy(fname, dir); /* add a seperating '/' if we're not at the root */ if (fname[1] != '\0') { strcat(fname, "/"); } /* and of course the actual file name */ strcat(fname, file); } } static void do_retr(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const char *file_name; int file_fd; int socket_fd; ASCII *buf2 = NULL; ASCII *bufwrite; struct timeval start_timestamp; struct timeval end_timestamp; struct timeval transfer_time; struct one_wire_query owq; size_t size_write; SIZE_OR_ERROR returned_length; off_t offset = 0; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); /* set up for exit */ file_fd = -1; socket_fd = -1; /* create an absolute name for our file */ file_name = cmd->arg[0].string; /* if the last command was a REST command, restart at the */ /* requested position in the file */ if ((f->file_offset_command_number == (f->command_number - 1))) { offset = f->file_offset; } /* Can we parse the name? */ if ( BAD( OWQ_create_plus(f->dir, file_name, &owq) ) ) { reply(f, 550, "File does not exist."); goto exit_retr; } if (IsDir(PN(&owq))) { reply(f, 550, "Error, file is a directory."); goto exit_retr; } if (OWQ_pn(&owq).selected_filetype->read == NO_READ_FUNCTION) { reply(f, 550, "Error, file is write-only."); goto exit_retr; } if ((OWQ_pn(&owq).selected_filetype->format == ft_binary) && (f->data_type == TYPE_ASCII)) { reply(f, 550, "Error, binary file (type ascii)."); goto exit_retr; } if ( BAD( OWQ_allocate_read_buffer(&owq)) ) { reply(f, 550, "Error, file too large."); goto exit_retr; } OWQ_offset(&owq) = offset ; returned_length = FS_read_postparse(&owq); if (returned_length < 0) { reply(f, 550, "Error reading from file; %s.", strerror(-returned_length)); goto exit_retr; } if (f->data_type == TYPE_IMAGE) { bufwrite = OWQ_buffer(&owq); size_write = returned_length; goto good_retr; } buf2 = malloc(2 * returned_length); if (buf2 == NULL) { reply(f, 550, "Error, file too large."); goto exit_retr; } // TYPE_ASCII size_write = convert_newlines(buf2, OWQ_buffer(&owq), returned_length); bufwrite = buf2; good_retr: /* ready to transfer */ reply(f, 150, "About to open data connection."); /* mark start time */ gettimeofday(&start_timestamp, NULL); /* open data path */ socket_fd = open_connection(f); if (socket_fd == -1) goto exit_retr; /* we're golden, send the file */ if (write_fully(socket_fd, bufwrite, size_write) == -1) { reply(f, 550, "Error writing to data connection; %s.", strerror(errno)); goto exit_retr; } watchdog_defer_watched(f->watched); /* disconnect */ close(socket_fd); socket_fd = -1; /* hey, it worked, let the other side know */ reply(f, 226, "File transfer complete."); /* mark end time */ gettimeofday(&end_timestamp, NULL); /* calculate transfer rate */ timersub( &end_timestamp, &start_timestamp, &transfer_time ) ; /* note the transfer */ LEVEL_DATA("%s retrieved \"%s\", %ld bytes in "TVformat, f->client_addr_str, OWQ_pn(&owq).path, size_write, TVvar(&transfer_time) ); exit_retr: OWQ_destroy(&owq); // safe at any speed if (buf2) { free(buf2); } f->file_offset = 0; if (socket_fd != -1) { close(socket_fd); } if (file_fd != -1) { close(file_fd); } daemon_assert(invariant(f)); } /* Write to 1-wire device */ static void do_stor(struct ftp_session_s *f, const struct ftp_command_s *cmd) { int file_fd; int socket_fd; struct timeval start_timestamp; struct timeval end_timestamp; struct timeval transfer_time; struct timeval limit_time = { Globals.timeout_ftp, 0 }; size_t size_read; off_t offset = 0 ; char * data_in ; struct parsedname *pn; OWQ_allocate_struct_and_pointer(owq); pn = PN(owq); daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); /* set up for exit */ file_fd = -1; socket_fd = -1; /* create an absolute name for our file */ if ( BAD( OWQ_create_plus(f->dir, cmd->arg[0].string, owq) ) ) { reply(f, 550, "File does not exist."); goto exit_stor; } /* if the last command was a REST command, restart at the */ /* requested position in the file */ if ((f->file_offset_command_number == (f->command_number - 1))) { offset = f->file_offset; } if (IsDir(pn)) { reply(f, 550, "Error, file is a directory."); goto exit_stor; } if (pn->selected_filetype->write == NO_WRITE_FUNCTION) { reply(f, 550, "Error, file is read-only."); goto exit_stor; } if ((pn->selected_filetype->format == ft_binary) && (f->data_type == TYPE_ASCII)) { reply(f, 550, "Error, binary file (type ascii)."); goto exit_stor; } /* ready to transfer */ reply(f, 150, "About to open data connection."); /* mark start time */ gettimeofday(&start_timestamp, NULL); /* open data path */ socket_fd = open_connection(f); if (socket_fd == -1) { goto exit_stor; } size_read = FullFileLength(PN(owq)) - OWQ_offset(owq) + 100; data_in = owmalloc(size_read); if (data_in == NULL) { reply(f, 550, "Out of memory."); goto exit_stor; } else { /* we're golden, read the file */ size_t size_actual ; int read_return = tcp_read(socket_fd, (BYTE *) data_in, size_read, &limit_time, &size_actual) ; if (read_return != 0 && read_return != -EAGAIN) { reply(f, 550, "Error reading from data connection; %s.", strerror(errno)); goto exit_stor; } if ( BAD( OWQ_allocate_write_buffer( data_in, size_actual, offset, owq )) ) { owfree(data_in) ; reply(f, 550, "Out of memory."); goto exit_stor; } owfree(data_in) ; } watchdog_defer_watched(f->watched); /* disconnect */ close(socket_fd); socket_fd = -1; /* hey, it worked, let the other side know */ reply(f, 226, "File transfer complete."); /* mark end time */ gettimeofday(&end_timestamp, NULL); /* calculate transfer rate */ timersub( &end_timestamp, &start_timestamp, &transfer_time ) ; { /* write to one-wire */ int one_wire_error = FS_write_postparse(owq); if (one_wire_error < 0) { reply(f, 550, "Error writing to file; %s.", strerror(-one_wire_error)); goto exit_stor; } } /* note the transfer */ LEVEL_DATA("%s stored \"%s\", %ld bytes in "TVformat, f->client_addr_str, pn->path, OWQ_size(owq), TVvar(&transfer_time) ); exit_stor: OWQ_destroy(owq); f->file_offset = 0; if (socket_fd != -1) { close(socket_fd); } if (file_fd != -1) { close(file_fd); } daemon_assert(invariant(f)); } static int open_connection(struct ftp_session_s *f) { int socket_fd; struct sockaddr_in addr; unsigned addr_len; daemon_assert((f->data_channel == DATA_PORT) || (f->data_channel == DATA_PASSIVE)); if (f->data_channel == DATA_PORT) { socket_fd = socket(SSFAM(&f->data_port), SOCK_STREAM, 0); if (socket_fd == -1) { reply(f, 425, "Error creating socket; %s.", strerror(errno)); return -1; } fcntl (socket_fd, F_SETFD, FD_CLOEXEC); // for safe forking if (connect(socket_fd, (struct sockaddr *) &f->data_port, sizeof(sockaddr_storage_t)) != 0) { reply(f, 425, "Error connecting; %s.", strerror(errno)); close(socket_fd); return -1; } } else { daemon_assert(f->data_channel == DATA_PASSIVE); addr_len = sizeof(struct sockaddr_in); socket_fd = accept(f->server_fd, (struct sockaddr *) &addr, &addr_len); if (socket_fd == -1) { reply(f, 425, "Error accepting connection; %s.", strerror(errno)); return -1; } #ifdef INET6 /* in IPv6, the client can connect to a channel using a different */ /* protocol - in that case, we'll just blindly let the connection */ /* through, otherwise verify addresses match */ if (SAFAM(addr) == SSFAM(&f->client_addr)) { if (memcmp(&SINADDR(&f->client_addr), &SINADDR(&addr), sizeof(SINADDR(&addr)))) { reply(f, 425, "Error accepting connection; connection from invalid IP."); close(socket_fd); return -1; } } #else if (memcmp(&f->client_addr.sin_addr, &addr.sin_addr, sizeof(struct in_addr))) { reply(f, 425, "Error accepting connection; connection from invalid IP."); close(socket_fd); return -1; } #endif } return socket_fd; } /* convert any '\n' to '\r\n' */ /* destination should be twice the size of the source for safety */ static int convert_newlines(char *dst, const char *src, int srclen) { int i; int dstlen; daemon_assert(dst != NULL); daemon_assert(src != NULL); dstlen = 0; for (i = 0; i < srclen; i++) { if (src[i] == '\n') { dst[dstlen++] = '\r'; } dst[dstlen++] = src[i]; } return dstlen; } static int write_fully(int file_descriptor, const char *buf, int buflen) { int amt_written; int write_ret; amt_written = 0; while (amt_written < buflen) { write_ret = write(file_descriptor, buf + amt_written, buflen - amt_written); if (write_ret <= 0) { return -1; } amt_written += write_ret; } return amt_written; } static void do_pwd(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); reply(f, 257, "\"%s\" is current directory.", f->dir); daemon_assert(invariant(f)); } static void both_list(struct ftp_session_s *f, const struct ftp_command_s *cmd, enum file_list_e fle) { struct file_parse_s fps; strcpy(fps.buffer, f->dir); fps.rest = NULL; fps.pse = parse_status_init; fps.fle = fle; fps.out = -1; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert((cmd->num_arg == 0) || (cmd->num_arg == 1)); /* figure out what parameters to use */ if (cmd->num_arg == 0) { fps.rest = strdup("*"); } else { daemon_assert(cmd->num_arg == 1); /* ignore attempts to send options to "ls" by silently dropping */ /* We don't use "ls" so can just pass on literal text */ fps.rest = strdup(cmd->arg[0].string); } /* ready to list */ reply(f, 150, "About to send name list."); /* open our data connection */ fps.out = open_connection(f); if (fps.out == -1) { goto exit_blst; } /* send any files */ FileLexParse(&fps); /* strange handshake for Netscape's benefit */ netscape_hack(fps.out); if (fps.ret == 0) { reply(f, 226, "Transfer complete."); } else { reply(f, 451, "Error sending name list. %s", strerror(-fps.ret)); } /* clean up and exit */ exit_blst: if (fps.out != -1) close(fps.out); daemon_assert(invariant(f)); } static void do_nlst(struct ftp_session_s *f, const struct ftp_command_s *cmd) { both_list(f, cmd, file_list_nlst); } static void do_list(struct ftp_session_s *f, const struct ftp_command_s *cmd) { both_list(f, cmd, file_list_list); } static void do_syst(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); reply(f, 215, "UNIX"); daemon_assert(invariant(f)); } static void do_noop(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 0); reply(f, 200, "Command okay."); daemon_assert(invariant(f)); } static void do_rest(struct ftp_session_s *f, const struct ftp_command_s *cmd) { daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); if (f->data_type != TYPE_IMAGE) { reply(f, 555, "Restart not possible in ASCII mode."); } else if (f->file_structure != STRU_FILE) { reply(f, 555, "Restart only possible with FILE structure."); } else { f->file_offset = cmd->arg[0].offset; f->file_offset_command_number = f->command_number; reply(f, 350, "Restart okay, awaiting file retrieval request."); } daemon_assert(invariant(f)); } static void do_size(struct ftp_session_s *f, const struct ftp_command_s *cmd) { off_t filesize; struct parsedname pn; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); if (f->data_type != TYPE_IMAGE) { reply(f, 550, "Size cannot be determined in ASCII mode."); } else if (f->file_structure != STRU_FILE) { reply(f, 550, "Size cannot be determined with FILE structure."); } else { /* get the file information */ if ( FS_ParsedNamePlus(f->dir, cmd->arg[0].string, &pn) != 0 ) { reply(f, 550, "Bad file specification"); } else { /* verify that the file is not a directory */ if (pn.selected_device == NO_DEVICE || pn.selected_filetype == NO_FILETYPE) { reply(f, 550, "File is a directory, SIZE command not valid."); } else { filesize = FullFileLength(&pn); /* output the size */ if (sizeof(off_t) == 8) { reply(f, 213, "%llu", filesize); } else { reply(f, 213, "%lu", filesize); } } FS_ParsedName_destroy(&pn); } } daemon_assert(invariant(f)); } /* if no gmtime_r() is available, provide one */ #ifndef HAVE_GMTIME_R struct tm *gmtime_r(const time_t * timep, struct tm *timeptr) { static pthread_mutex_t time_lock = PTHREAD_MUTEX_INITIALIZER; _MUTEX_LOCK(time_lock); *timeptr = *(gmtime(timep)); _MUTEX_UNLOCK(time_lock); return timeptr; } #endif /* HAVE_GMTIME_R */ static void do_mdtm(struct ftp_session_s *f, const struct ftp_command_s *cmd) { const char *file_name; char full_path[PATH_MAX + 1 + MAX_STRING_LEN]; struct stat stat_buf; struct tm mtime; char time_buf[16]; daemon_assert(invariant(f)); daemon_assert(cmd != NULL); daemon_assert(cmd->num_arg == 1); /* create an absolute name for our file */ file_name = cmd->arg[0].string; get_absolute_fname(full_path, sizeof(full_path), f->dir, file_name); /* get the file information */ if (FS_fstat(full_path, &stat_buf) < 0) { reply(f, 550, "Error getting file status; %s.", strerror(errno)); } else { gmtime_r(&stat_buf.st_mtime, &mtime); strftime(time_buf, sizeof(time_buf), "%Y%m%d%H%M%S", &mtime); reply(f, 213, time_buf); } daemon_assert(invariant(f)); } static void send_readme(const struct ftp_session_s *f, int code) { char code_str[8]; daemon_assert(invariant(f)); daemon_assert(code >= 100); daemon_assert(code <= 559); /* convert our code to a buffer */ daemon_assert(code >= 100); daemon_assert(code <= 999); sprintf(code_str, "%03d-", code); telnet_session_print(f->telnet_session, code_str); telnet_session_println(f->telnet_session, "owftpd 1-wire ftp server -- Paul H Alfille"); telnet_session_print(f->telnet_session, code_str); telnet_session_println(f->telnet_session, "Version: " VERSION " see http://www.owfs.org"); } /* hack which prevents Netscape error in file list */ static void netscape_hack(int file_descriptor) { fd_set readfds; struct timeval ns_timeout = {15, 0 } ; // 15 seconds int select_ret; char c; daemon_assert(file_descriptor >= 0); shutdown(file_descriptor, 1); FD_ZERO(&readfds); FD_SET(file_descriptor, &readfds); select_ret = select(file_descriptor + 1, &readfds, NULL, NULL, &ns_timeout); if (select_ret > 0) { ignore_result = read(file_descriptor, &c, 1); // ignore warning } } /* compare two addresses to see if they contain the same IP address */ //static int ip_equal(const sockaddr_storage_t *a, const sockaddr_storage_t *b) { static int ip_equal(const sockaddr_storage_t * a, const sockaddr_storage_t * b) { daemon_assert(a != NULL); daemon_assert(b != NULL); #ifdef AF_INET6 daemon_assert((cSSFAM(a) == AF_INET) || (cSSFAM(a) == AF_INET6)); daemon_assert((cSSFAM(b) == AF_INET) || (cSSFAM(b) == AF_INET6)); #else daemon_assert((cSSFAM(a) == AF_INET)); daemon_assert((cSSFAM(b) == AF_INET)); #endif if (cSSFAM(a) != cSSFAM(b)) return 0; if (memcmp(&cSINADDR(a), &cSINADDR(b), sizeof(cSINADDR(a))) != 0) return 0; return 1; } owfs-2.8p15/module/owftpd/src/c/daemon_assert.c0000664000175000017500000000044510750074137016412 00000000000000#include "owftpd.h" #ifndef NDEBUG void daemon_assert_fail(const char *assertion, const char *file, int line, const char *function) { syslog(LOG_CRIT, "%s:%d: %s: %s", file, line, function, assertion); fprintf(stderr, "%s:%d: %s: %s\n", file, line, function, assertion); exit(1); } #endif owfs-2.8p15/module/owftpd/Makefile.in0000664000175000017500000005125011756250027014457 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owftpd DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ AUTHORS COPYING ChangeLog NEWS TODO install-sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owftpd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owftpd/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owftpd/README0000664000175000017500000000417310110544544013265 00000000000000$Id: README,v 1.1 2004/08/18 03:13:40 alfille Exp $ Installation See the INSTALL file for directions on compiling and installing the binary. Short version (as root): # ./configure # make # make install This will install the oftpd daemon itself. To run the server via the standard Unix startup mechanism, you'll need to add it to your startup files. In most Linux systems, this means putting a shell script in the /etc/rc.d/init.d directory and linking to it from the directories for your various run levels. If you have a Red Hat 7.0 (or similiar) system, you can use the oftpd.redhat7 script for this purpose: # cp init/oftpd.redhat7 /etc/rc.d/init.d/oftpd # chkconfig --add oftpd Be sure to read the FAQ if you have any questions! Introduction oftpd is designed to be as secure as an anonymous FTP server can possibly be. It runs as non-root for most of the time, and uses the Unix chroot() command to hide most of the systems directories from external users - they cannot change into them even if the server is totally compromised! It contains its own directory change code, so that it can run efficiently as a threaded server, and its own directory listing code (many FTP servers execute the system "ls" command to list files). It is currently being code-reviewed for buffer overflows, and being load-tested. History I wrote oftpd to fill a need we had at my company. Our public FTP site was a mess, and in addition to reorganizing organizing the hierarchy and file layout I wanted to get the latest version of our FTP server software. It turns out that the version we had had had a number of security issues. So I decided to find an anonymous-only, secure FTP server. None of the ones I found were fully baked. Time to write my own. :) Portability oftpd currently runs on modern Linux systems, including Red Hat-derived (Mandrake, Trustix, etc.) and Debian systems. oftpd has been ported to FreeBSD and is in the FreeBSD ports collection. While I have given up development of oftpd, it's small and reliable. Don't hesitate to e-mail if you have questions or suggestions. Good luck! Shane Kerr shane@time-travellers.org owfs-2.8p15/module/owftpd/ChangeLog0000664000175000017500000002607210110544544014161 000000000000002004-08-07 Paul Alfille - Start of OWFS adaptation. 2004-03-25, Shane Kerr - Philippe Oechslin discovered a DoS vulnerability. As reported: "When the server receives a port command with a number that is higher than 255 the server crashes and has to be restarted manually. The port command can even be given before the user has given a username and a password." Yikes. In some ways this isn't *so* bad, as the chroot+setuid of oftpd means you are unlikely to have your server further compromised, but it does point to a flaw with using threaded C as the implementation language: if any connection has problems, your application is more-or-less hosed. Anyway, a one line fix. - Version 0.3.7 released. 2001-06-21, Shane Kerr - #ifdef wrap GLOB_ABORTED for really old gcc compilers (Slackware or older installations). - Add code to skip command line options that are intended for "ls". 2001-06-12, Shane Kerr - Disabled support for sendfile() on FreeBSD. It appears to me that there's a bug in the sendfile() user-level library. I would welcome advice from any FreeBSD developer wishing to set me straight. 2001-06-01, Shane Kerr - Changed SIZE command to return error for directories. 2001-05-28, Shane Kerr - Version 0.3.6 released. - Beat FreeBSD into submission. Now compiles (and runs!) on FreeBSD out of the box. 2001-05-11, Shane Kerr - Changed REST to only work for IMAGE (i.e. binary) mode. - Added the SIZE command. - Added the MDTM (modification time) command. 2001-04-20, Shane Kerr - Moved SIGPIPE ignore to run even in --nodetach mode. Needed to avoid unwanted signals on TCP disconnects. 2001-04-19, Shane Kerr - Added more logging: all client messages are logged with address and port, and all server responses are also logged. This occurs at DEBUG level, as it is probably not normally of interest. 2001-04-18, Shane Kerr - Version 0.3.5 released. - Changed resume code to reset offset to 0 after each file transfer. - Set accept() socket to NONBLOCK to insure the listener doesn't get stuck waiting for a connection. This is documented in the NOTES section for the accept() call in Linux. - Added sendfile() support on Linux systems. 2001-04-14, Shane Kerr - Fixed a bug caused by parsing EPRT commands. The server doesn't actually allow these commands, but it bravely attempts to parse them anyway. A special shout out to Anders Nordby for finding this. The error caused the server to terminate on an assert() fail, which is good because no server corruption happened, but it's bad because the server terminated without any indication. Therefore.... - Changed most assert() calls to daemon_assert() calls. These terminate the application as before, but log to syslog and STDERR. - Added ability to run as a non-daemon process. This will allow the server to be started from init, for instance. - Added support for SIGTERM and SIGINT. If one of these is received, then the server closes the port 21 socket - meaning that it will accept no further connections. When all existing connections have closed, then the server exits. A new server may be started before this occurs, to handle new connections. This allows very short downtimes: # killall oftpd; sleep 1; /etc/init.d/oftpd start This will result in a 1 second period of time where no new connections are accepted, with no existing connections closed. It's probably best to wait for this second, to allow the signal time to arrive. :) 2001-04-08, Shane Kerr - Changed check for '/' in path - was improperly allowing escaped '/' characters through the check! - Set TCP_NODELAY flag on socket - much reduced latency on control channel for high-speed connections. - New and improved init script from Eric Jensen. 2001-04-07, Anders Nordby - FreeBSD port. 2001-04-03, Shane Kerr - Version 0.3.4 released. - Changed FTP listener code to attempt to continue processing when formerly fatal errors occur. - Added man page. - Added Red Hat init script donated by Eric Jensen to release. 2001-03-28, Shane Kerr - Version 0.3.3 released. - Use IP address and port of the control connection port for default Data Transfer Port, as defined by RFC 959. Note that the default server process DTP is never used in oftpd, but that's not a problem as I read the RFC. - Use config.h 2001-03-27, Matthew Danish - configure.in and af_portability.h fixes to allow compilation on systems with both RFC 2553 and XNET formats 2001-03-27, Shane Kerr - Fixed bug where wrong server address was used on initalization of ftp_server class. Passive probably didn't work in the 0.3.x series for IPv4! 2001-03-26, Shane Kerr - Version 0.3.2 released. - Minor additions for better error reporting on error creating threads in listener, as well as checking success on setgid() and setuid(). I can't believe I wasn't!!! - Set syslog() to use FTP_DAEMON 2001-03-23, Shane Kerr - Fixed configure bug on Debian systems. Special thanks to Matthew Danish for helping me on this one. 2001-03-20, Matthew Danish - Clean up parsing of FTP address in ftp_listener.c - Added options to specify interface and maximum number of client connections at startup. - Added --long-style command-line options. 2001-03-21, Shane Kerr - The "Spring Fever" edition, version 0.3.1 released. Added workaround for the evil glob() denial-of-service attack. I chose the simple method of preventing file listing with both path separator and wildcards. Either is okay, but not both. I don't expect this to cause problems with legitimate use, but I could be wrong. It was much simpler than my other thought. :) Changed code so that ECONNABORTED and ECONNRESET errors don't increase the error count. This is to prevent a malicious client from taking a server down by sending a large number of connection requests that it then aborts. Integrated code from Matthew Danish that allows the user to specify the port to use from the command line. Thanks! Warnings from 0.3.0 still apply. Use with caution. Spring is in the air, after all. 2001-03-20, Shane Kerr - Version 0.3.0 released. This is almost guaranteed not to work, as I've not tested it with clients that support the new features. But I decided that after a year, I wasn't living up to the "release early, release often" motto of open source. In addition to working in the changes since the last release, I've done: o removed free list from ftp_listener; simple is better o use a random port rather than incrememting sequence; useful for preventing classes of data hijacking attacks There is a potential DOS attack against all versions, see the BUGS file. This will be fixed ASAP (hopefully tomorrow). 2001-02-22, Matthew Danish - Fix for missing check in configure.in 2000-12-13, Mauro Tortonesi - Added IPv6 support (EPRT & EPSV - RFC2428) - Added LPRT and LPSV support (RFC1639) 2000-08-25, Shane Kerr - Fixed telnet module to properly handle telnet escape sequences (since no clients actually use this, it wasn't really a problem) 2000-06-01, Shane Kerr - Beau Kuiper, author of muddleftpd, sent me a fix for the Netscape timing bug. Thanks!!! 2000-04-03, Shane Kerr - Version 0.2.0 released 2000-03-30, Shane Kerr - Changed README send to only send on directory change if you actually change to a different directory. That is, "CWD ." does not send a README file. The reason for this is that many clients perform a "CWD /" as soon as it connects, which cause the README to be sent twice - yuck! - Added missing check for closed file descriptor in write_fully(). - Converted use of FILE pointers to file descriptors. This wasn't done in the most efficient possible method (i.e. with buffers), but it does remove the maximum FILE limitation from the server. 2000-03-29, Shane Kerr - Added -D_REENTRANT flag to compile options. - Added an error data type to return details about errors that occur in module initialization. - Changed telnet module to never drop characters on outbound, even if we have a ton of DO and WILL commands from the other end. 2000-03-27, Shane Kerr - Fixed bug in telnet code when sending "" string. - Now sends README to client if file is in directory on connect or directory change. - Simplified watchdog a bit by adding pointer to watchdog in the watched structure. - Wrapped invariant() methods with #ifndef NDEBUG so they won't get compiled in non-debug code (in case there's ever a non-debug version) 2000-03-22, Shane Kerr - Changed NLST and LIST to silently drop a file specification that starts with a '-'. This will ignore attempts to pass an argument to "ls" that some clients try - it probably won't do what they expect, but at least they'll get a list of files. 2000-03-19, Shane Kerr - Set file descriptors 0, 1, and 2 to go to "/dev/null", so that any error messages sent by, say, the kernel don't accidentally go to a user. - Changed watchdog to have a single thread to watch all connections, rather than a thread per connection. This is considerably more complex, but effectively doubles the number of connections that can be supported (due to thread limits). 2000-03-16, Shane Kerr - Added support for REST command. (Note that this is *not* the REST exactly as described by RFC. The REST in the RFC only applies to block or compressed mode transfer, which oftpd does not currently support. However, it appears that Unix systems interpret the parameter to the REST command as the offset into the file to resume from. 2000-03-13, Shane Kerr - Version 0.1.3 released 2000-03-12, Shane Kerr - Fixed bug when connection limit reached - Fixed bug when attempt to bind() an already bound port 2000-03-12, Shane Kerr - Version 0.1.2 released 2000-03-11, Shane Kerr - Move configuration values into oftpd.h - Wrap source to 80 columns - Fix pthread_create() error check (code had incorrectly used errno rather than the return of pthread_create() to determine error) - Fix threads to run in detached mode (when appropriate) - Solaris port completed - Support for STOR added (reply with 553 error) - Added free list for per-thread information structures. owfs-2.8p15/module/owftpd/Makefile.am0000664000175000017500000000005710432627750014446 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owftpd/install-sh0000775000175000017500000001273610110544544014415 00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 owfs-2.8p15/module/owmon/0000775000175000017500000000000011756315511012323 500000000000000owfs-2.8p15/module/owmon/Makefile.in0000664000175000017500000003323611756250027014317 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.2 2007/08/28 19:48:55 d1mag Exp $ 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@ target_triplet = @target@ subdir = module/owmon DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = owmon.tcl 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 module/owmon/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owmon/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): 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-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-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 install: @INSTALL@ -d $(DESTDIR)$(bindir) @INSTALL@ -m 755 owmon.tcl $(DESTDIR)$(bindir)/owmon # 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: owfs-2.8p15/module/owmon/Makefile.am0000664000175000017500000000026410665076047014307 00000000000000# $Id: Makefile.am,v 1.2 2007/08/28 19:48:55 d1mag Exp $ EXTRA_DIST = owmon.tcl install: @INSTALL@ -d $(DESTDIR)$(bindir) @INSTALL@ -m 755 owmon.tcl $(DESTDIR)$(bindir)/owmon owfs-2.8p15/module/owmon/owmon.tcl0000664000175000017500000006672110715423476014126 00000000000000#!/bin/sh # the next line restarts using wish \ if [ -z `which wish` ] ; then exec tclsh "$0" -- "$@" ; else exec wish "$0" -- "$@" ; fi # $Id: owmon.tcl,v 1.30 2007/11/10 21:48:46 alfille Exp $ package require Tk # directories to monitor set PossiblePanels {system statistics structure settings interface} set SocketVars {string version type payload size sg offset tokenlength totallength paylength ping state id } # owserver message types set MessageTypes(READ) 2 set MessageTypes(DIR) 4 set MessageTypes(DIRALL) 7 set MessageTypes(PreferredDIR) $MessageTypes(DIRALL) set refresh_counter 0 # Global: window_exists => For object-oriented initialization # Global: serve => information on current transaction # serve(string) -- message to this point # serve(version size payload sg offset type tokenlength ) -- message parsed parts # Global: stats => statistical counts and flags for stats windows #Main procedure. We actually start it at the end, to allow Proc-s to be defined first. proc Main { } { ArgumentProcess global IsPanelVisible global PossiblePanels global DisplayLock global PanelDataField global SelectedBus global RefreshFrequency # wait till ready set DisplayLock 1 # Set panels to display at start foreach panel $PossiblePanels { #default set IsPanelVisible($panel) 0 # refresh rate set RefreshFrequency($panel) 0 } set IsPanelVisible(system) 1 set IsPanelVisible(statistics) 1 set IsPanelVisible(interface) 1 # Show screen SetupDisplay # bus list (and default) set SelectedBus "" SetBusList $PanelDataField(bus) selection set 0 0 # Show data for first time set DisplayLock 0 foreach panel $PossiblePanels { DirListValues $panel } # Start clock RefreshCounter } # Create the list of bus-es by doing recursive directory searches and selecting only bus.x entries # the list is put in DiscoveredBusList # No trailing "/" proc SetBusList { } { global DiscoveredBusList global PanelDataField # disable until data is complete $PanelDataField(bus) configure -state disabled set DiscoveredBusList "" BusListRecurser "" # enable now $PanelDataField(bus) configure -state normal } # path is searched and added. No trailing "/" proc BusListRecurser { path } { global DiscoveredBusList set value_from_owserver [OWSERVER_DirectoryRead "$path/"] if { [lindex $value_from_owserver 0] < 0 } { return } set busses [ lsearch -all -regexp -inline $value_from_owserver {/bus\.\d+$} ] foreach bus $busses { lappend DiscoveredBusList $bus BusListRecurser $bus } } proc SetDirList { bus type } { global data_array set path $bus/$type set data_array($bus.$type.path) {} set data_array($bus.$type.name) {} DirListRecurser $bus $path $type set data_array($bus.$type.path) [lrange $data_array($bus.$type.path) 1 end] set data_array($bus.$type.name) [lrange $data_array($bus.$type.name) 1 end] } proc DirListRecurser { bus path type } { global data_array lappend data_array($bus.$type.name) [regsub -all .*?/ [string range $path [string length $bus/$type] end] \t] set value_from_owserver [OWSERVER_DirectoryRead $path] if { [lindex $value_from_owserver 0] < 0 } { #puts "F $bus $path" lappend data_array($bus.$type.path) $path } else { #puts "D $bus $path" lappend data_array($bus.$type.path) NULL set dirlist [lsearch -all -regexp -inline -not [lrange $value_from_owserver 1 end] {\.ALL$|\.\d{3,}$} ] foreach dir $dirlist { DirListRecurser $bus $dir $type } } } # Get all the data values for a given bus/type proc DirListValues { type } { global IsPanelVisible global DisplayLock global SelectedBus global PanelDataField global data_array global MessageTypes # See if this is a displayed panel if { $IsPanelVisible($type) == 0 } { return } # prevent stacked refresh if { $DisplayLock } { return } set DisplayLock 1 if { ![info exists data_array($SelectedBus.$type.path)] } { $PanelDataField($type) delete 1.0 end $PanelDataField($type) insert end "First pass through $SelectedBus/$type\n ... getting parameter list...\n" #puts "bus=$bus type=$type" SetDirList $SelectedBus $type } $PanelDataField($type) delete 1.0 end foreach path $data_array($SelectedBus.$type.path) name $data_array($SelectedBus.$type.name) { if { $path != "NULL" } { set value_from_owserver [OWSERVER_Read $MessageTypes(READ) $path] set change_tag $type.black if {[lindex $value_from_owserver 0] < 0 } { set value_from_owserver "" } else { set value_from_owserver [lindex $value_from_owserver 1] } if { ![info exists data_array($SelectedBus.$type.$path)] } { set data_array($SelectedBus.$type.$path) $value_from_owserver } elseif { $data_array($SelectedBus.$type.$path) != $value_from_owserver } { set data_array($SelectedBus.$type.$path) $value_from_owserver set change_tag $type.red } elseif { $PanelDataField($type.diff) } { continue } $PanelDataField($type) insert end "[format {%12.12s} $value_from_owserver] $name\n" $change_tag } else { set value_from_owserver "" $PanelDataField($type) insert end " " $type.spacing "$name\n" $type.underline } } set DisplayLock 0 } proc OWSERVER_send_message { type path sock } { set length [string length $path] # add an entra char for null-termination string incr length # 262= f.i, busret and persist flags if { [catch {puts -nonewline $sock [binary format "IIIIIIa*a" 0 $length $type 262 1024 0 $path \0 ] }] } { return 1 } flush $sock return 0 } # Command line processing # looks at command line arguments # options "s" for the target ow_s_erver port # Can handle command lines like # -s 3001 # -s3001 # etc proc ArgumentProcess { } { global IPAddress # INADDR_ANY set IPAddress(ip) "0.0.0.0" # default port set IPAddress(port) "4304" foreach a $::argv { if { [regexp -- {^-s(.sock*)$} $a whole address] } { IPandPort $address } else { IPandPort $a } } MainTitle $IPAddress(ip):$IPAddress(port) } proc IPandPort { argument_string } { global IPAddress if { [regexp -- {^(.*?):(.*)$} $argument_string wholestring firstpart secondpart] } { if { $firstpart != "" } { set IPAddress(ip) $firstpart } if { $secondpart != "" } { set IPAddress(port) $secondpart } } else { if { $argument_string != "" } { set IPAddress(port) $argument_string } } } # open connection to owserver # return sock, or "" if unsuccessful proc OpenOwserver { } { global IPAddress # StatusMessage "Attempting to open connection to OWSERVER" 0 if {[catch {socket $IPAddress(ip) $IPAddress(port)} sock] } { return {} } else { return sock } } proc OWSERVER_DirectoryRead { path } { global MessageTypes set return_code [OWSERVER_Read $MessageTypes(PreferredDIR) $path] if { $return_code == -42 && $MessageTypes(PreferredDIR) == $dMessageTypes(DIRALL) } { set MessageTypes(PreferredDIR) $MessageTypes(DIR) set return_code [OWSERVER_Read $MessageTypes(PreferredDIR) $path] } return $return_code } #Main loop. Called whenever the server (listen) port accepts a connection. proc OWSERVER_Read { message_type path } { global serve # Start the State machine set serve(state) "Open server" set value_from_owserver {} set error_status 0 while {1} { #puts "State machine = $serve(state) message_type=$message_type path=$path" switch $serve(state) { "Open server" { global IPAddress StatusMessage "Attempting to open connection to OWSERVER" 0 if {[catch {socket $IPAddress(ip) $IPAddress(port)} sock] } { set serve(state) "Unopened server" } else { set serve(state) "Send to server" } } "Unopened server" { StatusMessage "OWSERVER error: $sock at $IPAddress(ip):$IPAddress(port)" set serve(state) "Server error" } "Send to server" { StatusMessage "Sending client request to OWSERVER" 0 set serve(sock) $sock fconfigure $sock -translation binary -buffering full -encoding binary -blocking 0 if { [OWSERVER_send_message $message_type $path $sock]==0 } { set serve(state) "Read from server" } elseif { [info exist serve(persist)] && $serve(persist)==1 } { CloseSock set serve(persist) 0 set serve(state) "Open server" } else { set serve(state) "Server wont listen" } } "Persistent server" { set sock $serve(sock) } "Read from server" { StatusMessage "Reading OWSERVER response" 0 TapSetup ResetSockTimer fileevent $sock readable [list OWSERVER_Process] vwait serve(state) } "Server wont listen" { StatusMessage "FAILURE sending to OWSERVER" 0 set serve(state) "Server error" } "Server early end" { StatusMessage "FAILURE reading OWSERVER response" 0 set serve(state) "Server error" } "Process server packet" { StatusMessage "Success reading OWSERVER response" 0 fileevent $sock readable {} set serve(state) "Packet complete" } "Packet complete" { ClearSockTimer # filter out the multi-response types and continue listening global MessageTypes if { $serve(ping) == 1 } { set serve(state) "Ping received" } elseif { $serve(type) < 0 } { # error -- return it (may help find non-DIRALL servers) set error_status $serve(type) set serve(state) "Done with server" } elseif { $message_type == $MessageTypes(DIRALL) } { set serve(state) "Dirall received" } elseif { $message_type == $MessageTypes(READ) } { set serve(state) "Read received" } else { set serve(state) "Dir element received" } } "Ping received" { set serve(state) "Read from server" } "Dir element received" { if { $serve(paylength)==0 } { # last (null) element set serve(state) "Done with server" } else { # add element to list lappend value_from_owserver [PayloadWithNULL] set serve(state) "Read from server" } } "Dirall received" { set value_from_owserver [split [PayloadWithNULL] ,] set serve(state) "Done with server" } "Read received" { lappend value_from_owserver [PayloadNoNULL] set serve(state) "Done with server" } "Server timeout" { ClearSockTimer StatusMessage "owserver read timeout" 1 set serve(state) "Server error" } "Server error" { set error_return 1 StatusMessage "Error code $error_return" 1 set serve(persist) 0 set serve(state) "Done with server" } "Done with server" { if { [info exist serve(persist)] && $serve(persist)==1 } { set serve(state) "Server persist" } else { set serve(state) "Server close" } } "Server persist" { ClearTap ClearSockTimer set serve(state) "Done with all" } "Server close" { CloseSock set serve(state) "Done with all" } "Done with all" { StatusMessage "Ready" 0 set serve(state) "Return" } "Return" { return [linsert $value_from_owserver 0 $error_status] } default { StatusMessage "Internal error -- bad state: $serve($sock.state)" 1 set serve(state) "Return" } } } } # Initialize array for client request proc TapSetup { } { global serve set serve(string) "" set serve(totallength) 0 } # Clear out client request array after a connection (frees memory) proc ClearTap { } { global serve global SocketVars foreach x $SocketVars { if { [info exist serve($x)] } { unset serve($x) } } } # close client request socket proc SockTimeout {} { global serve switch $serve(state) { "Read from server" { set serve(state) "Server timeout" } default { ErrorMessage "Strange timeout for state=$serve(state)" set serve(state) "Server timeout" } } StatusMessage "Network read timeout" 1 } # close client request socket proc CloseSock {} { global serve ClearSockTimer if { [info exists serve(sock)] } { close $serve(sock) unset serve(sock) } ClearTap } proc ClearSockTimer { } { global serve if { [info exist serve(id)] } { after cancel $serve(id) unset serve(id) } } proc ResetSockTimer { { msec 2000 } } { global serve ClearSockTimer set serve(id) [after $msec [list SockTimeout]] } # Process a oncomming owserver packet, adjusting size from header information proc ReadProcess {} { global serve set sock $serve(sock) # test eof if { [eof $sock] } { return 2 } # read what's waiting set new_string [read $sock] if { $new_string == {} } { return 0 } append serve(string) $new_string ResetSockTimer set len [string length $serve(string)] if { $len < 24 } { #do nothing -- reloop return 0 } elseif { $serve(totallength) == 0 } { # at least header is in HeaderParser $serve(string) } #already in payload (and token) portion if { $len < $serve(totallength) } { #do nothing -- reloop return 0 } # Fully parsed set new_length [string length $serve(string)] return 1 } # Wrapper for processing -- either change a vwait var, or just return waiting for more network traffic proc OWSERVER_Process { } { global serve set read_value [ReadProcess] #puts "Current length [string length $serve($relay.string)] return val=$read_value" switch $read_value { 3 - 2 { set serve(state) "Server early end"} 0 { return } 1 { set serve(state) "Process server packet" } } } # Debugging routine -- show all the packet info proc ShowMessage {} { global serve global SocketVars foreach x $SocketVars { if { [info exist serve($x)] } { puts "\t$x = $serve($x)" } } } # Selection from bus listbox (left panel) proc SelectionMade { widget y } { global PossiblePanels global PanelDataField global SelectedBus global data_array catch { unset data_array } set index [ $widget nearest $y ] if { $index >= 0 } { set bus [$widget get $index] set SelectedBus [expr { ($bus eq "") ? "" : $bus } ] foreach panel $PossiblePanels { DirListValues $panel } } } proc SetupDisplay {} { global IsPanelVisible global PossiblePanels global DiscoveredBusList global RefreshFrequency global PanelDataField panedwindow .main -orient horizontal # Bus list is a listbox set f_bus [frame .main.bus] set color [Color bus] set PanelDataField(bus) [ listbox $f_bus.lb \ -listvariable DiscoveredBusList \ -width 20 \ -yscrollcommand [list $f_bus.sb set] \ -selectmode browse \ -bg $color ] scrollbar $f_bus.sb -command [list $f_bus.lb yview] -troughcolor $color pack $f_bus.sb -side right -fill y pack $f_bus.lb -side left -fill both -expand true bind $PanelDataField(bus) {+ SelectionMade %W %y } bind $PanelDataField(bus) {+ SelectionMade %W } .main add .main.bus foreach dir $PossiblePanels { SetupPanel $dir } label .status -anchor w -relief sunken -height 1 -textvariable current_status -bg white pack .status -side bottom -fill x bind .status [list .main_menu.view invoke "Status messages"] pack .main -side top -fill both -expand true menu .main_menu -tearoff 0 . config -menu .main_menu # file menu menu .main_menu.file -tearoff 0 .main_menu add cascade -label File -menu .main_menu.file -underline 0 .main_menu.file add command -label "Log to File..." -underline 0 -command SaveLog -state disabled .main_menu.file add command -label "Stop logging" -underline 0 -command SaveAsLog -state disabled .main_menu.file add separator .main_menu.file add command -label "Restart" -underline 0 -command Restart .main_menu.file add separator .main_menu.file add command -label "Quit" -underline 0 -command exit menu .main_menu.view -tearoff 0 .main_menu add cascade -label View -menu .main_menu.view -underline 0 foreach dir $PossiblePanels { .main_menu.view add checkbutton -label $dir -indicatoron 1 -command [list PanelShow $dir] -variable IsPanelVisible($dir) } .main_menu.view add separator .main_menu.view add checkbutton -label "Status messages" -underline 0 -indicatoron 1 -command {StatusWindow} foreach panel $PossiblePanels { menu .main_menu.$panel -tearoff 0 .main_menu add cascade -label $panel -menu .main_menu.$panel -state [expr {$IsPanelVisible($panel)?"normal":"disabled"}] menu .main_menu.$panel.refresh -tearoff 0 .main_menu.$panel add cascade -menu .main_menu.$panel.refresh -label {Refresh rate} foreach {label value} {"Manual" 0 "20 seconds" 1 "1 minute" 3 "5 minutes" 15} { .main_menu.$panel.refresh add radiobutton -label $label -value $value -variable RefreshFrequency($panel) } .main_menu.$panel add checkbutton -label "Differences only" -underline 0 -variable PanelDataField($panel.diff) } # help menu menu .main_menu.help -tearoff 0 .main_menu add cascade -label Help -menu .main_menu.help -underline 0 .main_menu.help add command -label "About OWMON" -underline 0 -command About .main_menu.help add command -label "Command Line" -underline 0 -command CommandLine .main_menu.help add command -label "Version" -underline 0 -command Version } proc SetupPanel { panel } { global IsPanelVisible global PanelFrame global PanelDataField set color [Color $panel] if { $IsPanelVisible($panel) } { set f [frame .main.$panel] # top bar frame $f.top button $f.top.b -text $panel -command [list DirListValues $panel] -bg $color checkbutton $f.top.d -text "∆" -command [list DirListValues $panel] -variable PanelDataField($panel.diff) -bg $color button $f.top.x -text "X" -command [list .main_menu.view invoke $panel] -bg $color pack $f.top.x -side right pack $f.top.d -side right pack $f.top.b -side left -fill x -expand true # text and scroll bars set PanelDataField($panel) [ text $f.text \ -yscrollcommand [list $f.sby set] \ -xscrollcommand [list $f.sbx set] \ -tabs {12 right 15 20 25} \ -wrap none \ -width 40 \ -bg $color ] scrollbar $f.sby -command [list $f.text yview] -troughcolor $color scrollbar $f.sbx -command [list $f.text xview] -orient horizontal -troughcolor $color pack $f.top -side top -fill x pack $f.sby -side right -fill y pack $f.sbx -side bottom -fill x pack $f.text -side left -fill both -expand true set PanelFrame($panel) $f .main add $f -after .main.[PriorPanel $panel] $PanelDataField($panel) tag configure $panel.red -foreground red $PanelDataField($panel) tag configure $panel.black -foreground black $PanelDataField($panel) tag configure $panel.spacing -spacing1 5 -spacing3 3 $PanelDataField($panel) tag configure $panel.underline -underline 1 set PanelDataField($panel.diff) 0 } } proc PanelShow { panel } { global IsPanelVisible global PanelFrame if { $IsPanelVisible($panel) } { .main_menu entryconfigure $panel -state normal if { [info exist PanelFrame($panel)] } { .main add .main.$panel -after .main.[PriorPanel $panel] } else { SetupPanel $panel } DirListValues $panel } else { .main_menu entryconfigure $panel -state disabled .main forget $PanelFrame($panel) } } proc PriorPanel { dir } { global IsPanelVisible global PossiblePanels set prior bus foreach prior_dir $PossiblePanels { if { $prior_dir==$dir } { break } if { $IsPanelVisible($prior_dir) } { set prior $prior_dir } } return $prior } proc Color { dir } { switch $dir { bus { return #D6E2E0} system { return #DBF0FF} statistics { return #E2FFF1} alarm { return #FFC3C3} structure { return #F3DEFF} settings { return #FCFFDE} chain { return #DDDFC2} simultaneous { return #C3EEF9} interface { return #FFF6C8} default { return #C8C8C8} } } # error routine -- popup and exit proc ErrorMessage { msg } { StatusMessage "Fatal error -- $msg" tk_messageBox -title "Fatal error" -message $msg -type ok -icon error exit 1 } # status -- set status message # possibly store past messages # Use priority to test if should be stored proc StatusMessage { msg { priority 1 } } { global current_status set current_status $msg if { $priority > 0 } { global status_messages lappend status_messages $msg if { [llength $status_messages] > 50 } { set status_messages [lreplace $status_messages 0 0] } } } # Popup giving attribution proc About { } { tk_messageBox -type ok -title {About owmon} -message { Program: owmon Synopsis: owserver statistics inspector Description: owmon displays the internal statistics kept by owserver. The information can help diagnosing and predicting hardware problems. Author: Paul H Alfille Copyright: Aug 2007 GPL 2.0 license Website: http://www.owfs.org } } # Popup giving commandline proc CommandLine { } { tk_messageBox -type ok -title {owmon command line} -message { syntax: owmon.tcl -s serverport server port is the address of owserver owserver address can be in forms host:port :port port default is localhost:4304 } } # Popup giving version proc Version { } { regsub -all {[$:a-zA-Z]} {$Revision: 1.30 $} {} Version regsub -all {[$:a-zA-Z]} {$Date: 2007/11/10 21:48:46 $} {} Date tk_messageBox -type ok -title {owmon version} -message " Version $Version Date $Date " } # Show a table of Past status messages proc StatusWindow { } { set window_name .statuswindow set menu_name .main_menu.view set menu_index "Status messages" if { [ WindowAlreadyExists $window_name $menu_name $menu_index ] } { return } global status_messages # create status window scrollbar $window_name.xsb -orient horizontal -command [list $window_name.lb xview] pack $window_name.xsb -side bottom -fill x -expand 1 scrollbar $window_name.ysb -orient vertical -command [list $window_name.lb yview] pack $window_name.ysb -fill y -expand 1 -side right listbox $window_name.lb -listvar status_messages -bg white -yscrollcommand [list $window_name.ysb set] -xscrollcommand [list $window_name.xsb set] -width 80 pack $window_name.lb -fill both -expand 1 -side left } #proc window handler for statistics and status windows #return 1 if old, 0 if new proc WindowAlreadyExists { window_name menu_name menu_index } { global window_exists if { [ info exist window_exists($window_name) ] } { if { $window_exists($window_name) } { # hide window wm withdraw $window_name set window_exists($window_name) 0 } else { # show window wm deiconify $window_name set window_exists($window_name) 1 } return 1 } # create window toplevel $window_name wm title $window_name $menu_index # delete handler wm protocol $window_name WM_DELETE_WINDOW [list $menu_name invoke $menu_index] # now set flag set window_exists($window_name) 1 return 0 } #Parse header information and place in array # works for request or response (though type is "ret" in response) proc HeaderParser { string_value } { global serve set length [string length $string_value] foreach x {version payload type flags size offset} { set serve($x) "" } foreach x {paylength tokenlength totallength ping} { set serve($x) 0 } binary scan $string_value {IIIIII} serve(version) serve(payload) serve(type) serve(flags) serve(size) serve(offset) if { $length < 24 } { set serve(totallength) $length set serve(typetext) BadHeader return } if { $serve(payload) == -1 } { set serve(paylength) 0 set serve(ping) 1 } else { set serve(paylength) $serve(payload) } set version $serve(version) set flags $serve(flags) set tok [expr { $version & 0xFFFF}] set ver [expr { $version >> 16}] set serve(persist) [expr {($flags&0x04)?1:0}] set serve(tokenlength) [expr {$tok * 16} ] set serve(totallength) [expr {$serve(tokenlength)+$serve(paylength)+24}] } proc PayloadWithNULL {} { global serve # remove trailing null string range $serve(string) 24 [expr {$serve(paylength) + 24 - 2}] } proc PayloadNoNULL {} { global serve # remove trailing null string range $serve(string) 24 [expr {$serve(paylength) + 24 - 1}] } proc RefreshCounter { } { global refresh_counter global PossiblePanels global RefreshFrequency incr refresh_counter foreach panel $PossiblePanels { if { $RefreshFrequency($panel)==0 } { continue } if { [expr { $refresh_counter % $RefreshFrequency($panel) }]==0 } { DirListValues $panel } } # set timer again after 20000 RefreshCounter } proc Restart { } { # foreach ch [chan names] { close $ch } foreach channel [file channels] { if { [regexp -- {^std(out|in|err)$} $channel ] == 0 } { # change to non-blocking and close if { [ catch { fconfigure $channel -blocking 0 ; close $channel; } reason ] == 1 } { StatusMessage "Error closing channel $channel $reason" 1 } } } # exec [info nameofexecutable] $::argv0 "--" {*}$::argv & if { [info nameofexecutable] eq $::argv0 } { eval exec [list [info nameofexecutable]] "--" $::argv & } else { eval exec [list [info nameofexecutable]] [list $::argv0] "--" $::argv "&" } exit } proc MainTitle { server_address } { wm title . "OWMON owserver ($server_address) monitor" } #Finally, all the Proc-s have been defined, so run everything. Main owfs-2.8p15/module/owshell/0000775000175000017500000000000011756315507012646 500000000000000owfs-2.8p15/module/owshell/src/0000775000175000017500000000000011756315507013435 500000000000000owfs-2.8p15/module/owshell/src/Makefile.in0000664000175000017500000005120411756250030015411 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owshell/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include all: all-recursive .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 module/owshell/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owshell/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owshell/src/Makefile.am0000664000175000017500000000006610504774446015414 00000000000000SUBDIRS = c include clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owshell/src/include/0000775000175000017500000000000011756315507015060 500000000000000owfs-2.8p15/module/owshell/src/include/owshell.h0000644000175000017500000002057111716516317016627 00000000000000/* $Id: owshell.h,v 1.34 2012/02/14 17:41:35 alfille Exp $ Written 2006 Paul H Alfille MIT license */ #ifndef OWSHELL_H /* tedious wrapper */ #define OWSHELL_H #include "config.h" #include "owfs_config.h" // Define this to avoid some VALGRIND warnings... (just for testing) // Warning: This will partially remove the multithreaded support since ow_net.c // will wait for a thread to complete before executing a new one. //#define VALGRIND 1 #define _FILE_OFFSET_BITS 64 #ifdef HAVE_FEATURES_H #include #endif #ifdef HAVE_FEATURE_TESTS_H #include #endif #ifdef HAVE_SYS_STAT_H #include /* for stat */ #endif #ifdef HAVE_SYS_TYPES_H #include /* for stat */ #endif #include /* for times */ #include #include #include #include #include #include #include #ifdef HAVE_STDINT_H #include /* for bit twiddling */ #if OW_CYGWIN #define _MSL_STDINT_H #endif #endif #include #ifdef HAVE_GETOPT_H #ifdef __GNU_LIBRARY__ #include #else /* __GNU_LIBRARY__ */ #define __GNU_LIBRARY__ #include #undef __GNU_LIBRARY__ #endif /* __GNU_LIBRARY__ */ #endif /* HAVE_GETOPT_H */ #include #ifndef __USE_XOPEN #define __USE_XOPEN /* for strptime fuction */ #include #undef __USE_XOPEN /* for strptime fuction */ #else #include #endif #include #include #include #include #include /* for gettimeofday */ #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #include /* addrinfo */ /* Can't include search.h when compiling owperl on Fedora Core 1. */ #ifndef SKIP_SEARCH_H #ifndef __USE_GNU #define __USE_GNU #include #undef __USE_GNU #else /* __USE_GNU */ #include #endif /* __USE_GNU */ #endif /* SKIP_SEARCH_H */ #if OW_ZERO /* Zeroconf / Bonjour */ #include "ow_dl.h" #include "ow_dnssd.h" #endif /* Include some compatibility functions */ #include "compat.h" /* Debugging and error messages separated out for readability */ #include "ow_debug.h" /* Floating point */ /* I hate to do this, making everything a double */ /* The compiler complains mercilessly, however */ /* 1-wire really is low precision -- float is more than enough */ typedef double _FLOAT; typedef time_t _DATE; typedef unsigned char BYTE; typedef char ASCII; typedef unsigned int UINT; typedef int INT; /* OW -- One Wire Globals variables -- each invokation will have it's own data */ /* command line options */ /* These are the owlib-specific options */ #define OWLIB_OPT "m:c:f:p:s:hqu::d:t:CFRKVP:" extern const struct option owopts_long[]; void owopt(const int c, const char *arg); /* Several different structures: device -- one for each type of 1-wire device filetype -- one for each type of file parsedname -- translates a path into usable form */ /* --------------------------------------------------------- */ /* Filetypes -- directory entries for each 1-wire chip found */ /* Filetype is the most elaborate of the internal structures, though simple in concept. Actually a little misnamed. Each filetype corresponds to a device property, and to a file in the file system (though there are Filetype entries for some directory elements too) Filetypes belong to a particular device. (i.e. each device has it's list of filetypes) and have a name and pointers to processing functions. Filetypes also have a data format (integer, ascii,...) and a data length, and an indication of whether the property is static, changes only on command, or is volatile. Some properties occur are arrays (pages of memory, logs of temperature values). The "aggregate" structure holds to allowable size, and the method of access. -- Aggregate properties are either accessed all at once, then split, or accessed individually. The choice depends on the device hardware. There is even a further wrinkle: mixed. In cases where the handling can be either, mixed causes separate handling of individual items are querried, and combined if ALL are requested. This is useful for the DS2450 quad A/D where volt and PIO functions step on each other, but the conversion time for individual is rather costly. */ /* predeclare connection_in/out */ struct connection_in; /* Exposed connection info */ extern int count_inbound_connections; // Default owserver port (assigned by the IANA) #define OWSERVER_DEFAULT_PORT "4304" /* Maximum length of a file or directory name, and extension */ #define OW_NAME_MAX (32) #define OW_EXT_MAX (6) #define OW_FULLNAME_MAX (OW_NAME_MAX+OW_EXT_MAX) #define OW_DEFAULT_LENGTH (128) /* Unique token for owserver loop checks */ union antiloop { struct { pid_t pid; clock_t clock; } simple; BYTE uuid[16]; }; /* Globals information (for local control) */ struct global { int announce_off; // use zeroconf? ASCII *announce_name; ASCII *progname; union antiloop Token; int want_background; int now_background; int readonly; int max_clients; // for ftp int autoserver; int quiet ; /* Special parameter to trigger William Robison timings */ int timeout_network ; }; extern struct global Globals; /* device display format */ enum deviceformat { fdi, fi, fdidc, fdic, fidc, fic }; /* Gobal temperature scale */ enum temp_type { temp_celsius, temp_fahrenheit, temp_kelvin, temp_rankine, }; /* Global pressure scale up tp 8 */ enum pressure_type { pressure_mbar, pressure_atm, pressure_mmhg, pressure_inhg, pressure_psi, pressure_Pa, pressure_end_mark }; /* Server (Socket-based) interface */ enum msg_classification { msg_error, msg_nop, msg_read, msg_write, msg_dir, msg_size, // No longer used, leave here to compatibility msg_presence, msg_dirall, msg_get, msg_dirallslash, msg_getslash, }; /* message to owserver */ struct server_msg { int32_t version; int32_t payload; int32_t type; int32_t sg; int32_t size; int32_t offset; }; /* message to client */ struct client_msg { int32_t version; int32_t payload; int32_t ret; int32_t sg; int32_t size; int32_t offset; }; struct serverpackage { ASCII *path; BYTE *data; size_t datasize; BYTE *tokenstring; size_t tokens; }; #define Servermessage (((int32_t)1)<<16) #define isServermessage( version ) (((version)&Servermessage)!=0) #define Servertokens(version) ((version)&0xFFFF) /* large enough for arrays of 2048 elements of ~49 bytes each */ #define MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE 100050 /* -------------------------------------------- */ extern int hexflag ; // read/write in hex mode? extern int slashflag ; // directory with '/'? extern int size_of_data ; extern int offset_into_data ; extern int uncached ; extern int unaliased ; extern enum temp_type temperature_scale ; extern enum pressure_type pressure_scale ; extern enum deviceformat device_format ; ssize_t tcp_read(int file_descriptor, void *vptr, size_t n, const struct timeval *ptv); int ClientAddr(char *sname); int ClientConnect(void); void DefaultOwserver(void); void ARG_Net(const char *arg); void Setup(void); void ow_help(void); void OW_Browse(void); void Server_detect(void); int ServerRead(ASCII * path); int ServerWrite(ASCII * path, ASCII * data); int ServerDir(ASCII * path); int ServerDirall(ASCII * path); int ServerPresence(ASCII * path); #define SHOULD_RETURN_BUS_LIST ( (UINT) 0x00000002 ) #define ALIAS_REQUEST ( (UINT) 0x00000008 ) #define TEMPSCALE_MASK ( (UINT) 0x00FF0000 ) #define TEMPSCALE_BIT 16 #define PRESSURESCALE_BIT 18 #define DEVFORMAT_MASK ( (UINT) 0xFF000000 ) #define DEVFORMAT_BIT 24 #define UNCACHED ( (UINT) 0x00000020 ) #define OWNET ( (UINT) 0x00000100 ) #define PRINT_ERROR(...) while ( ! Globals.quiet ) { fprintf( stderr, __VA_ARGS__ ) ; break ; } #define PERROR(...) while ( ! Globals.quiet ) { perror( __VA_ARGS__ ) ; break ; } struct connection_in; struct device_search { int LastDiscrepancy; // for search int LastDevice; // for search BYTE sn[8]; BYTE search; }; struct connection_in { char *name; int file_descriptor; char *host; char *service; struct addrinfo *ai; struct addrinfo *ai_ok; }; extern struct connection_in s_owserver_connection; extern struct connection_in *owserver_connection; void Exit(int exit_code); #endif /* OWSHELL_H */ owfs-2.8p15/module/owshell/src/include/Makefile.in0000664000175000017500000003661511756250030017045 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owshell/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = owshell.h 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 module/owshell/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owshell/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owshell/src/include/Makefile.am0000664000175000017500000000007610524701566017033 00000000000000 noinst_HEADERS = owshell.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owshell/src/c/0000775000175000017500000000000011756315507013657 500000000000000owfs-2.8p15/module/owshell/src/c/owexist.c0000644000175000017500000000154411732207065015440 00000000000000/* $Id: owexist.c,v 1.1 2012/03/20 23:09:41 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { Setup(); /* process command line arguments */ while (1) { int c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); // Exit(1) if problem. Exit(0) ; } owfs-2.8p15/module/owshell/src/c/getopt.c0000664000175000017500000005434111716514244015247 00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * Modified for uClibc by Manuel Novoa III on 1/5/01. * Modified once again for uClibc by Erik Andersen 8/7/02 */ #include #include "owfs_config.h" #include "compat_getopt.h" #include "ow.h" // only for UINT #ifndef HAVE_GETOPT_LONG #include #include #include #include /* Treat '-W foo' the same as the long option '--foo', * disabled for the moment since it costs about 2k... */ #undef SPECIAL_TREATMENT_FOR_W /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ extern int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only); /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ static int __getopt_initialized; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; # include # define my_index strchr /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char *_getopt_initialize(int argc, char *const *argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize(argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp(argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == (UINT) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { PRINT_ERROR( "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen(nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (argv[optind - 1][1] == '-') { /* --option */ PRINT_ERROR( "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); } else { /* +option or -option */ PRINT_ERROR("%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen(nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { PRINT_ERROR("%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen(nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) { if (argv[optind][1] == '-') { /* --option */ PRINT_ERROR("%s: unrecognized option `--%s'\n", argv[0], nextchar); } else { /* +option or -option */ PRINT_ERROR("%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index(optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { /* 1003.2 specifies the format of this message. */ PRINT_ERROR("%s: illegal option -- %c\n", argv[0], c); optopt = c; return '?'; } #ifdef SPECIAL_TREATMENT_FOR_W /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { /* 1003.2 specifies the format of this message. */ PRINT_ERROR("%s: option requires an argument -- %c\n", argv[0], c); optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { PRINT_ERROR("%s: option `-W %s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen(nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { PRINT_ERROR("%s: option `-W %s' doesn't allow an argument\n", argv[0], pfound->name); nextchar += strlen(nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { PRINT_ERROR("%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen(nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } #endif if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { /* 1003.2 specifies the format of this message. */ PRINT_ERROR("%s: option requires an argument -- %c\n", argv[0], c); optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 1); } #endif /* HAVE_GETOPT_LONG */ #ifndef HAVE_GETOPT int getopt(int argc, char *const *argv, const char *optstring) { return _getopt_internal(argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* HAVE_GETOPT */ owfs-2.8p15/module/owshell/src/c/owwrite.c0000644000175000017500000000563611716516317015451 00000000000000/* $Id: owwrite.c,v 1.16 2012/02/14 17:41:35 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" static int HexVal( char c ) ; static char * HexConvert( char * input_string ) ; /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; int rc = -EINVAL; Setup(); /* process command line arguments */ while (1) { c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); if ( hexflag ) { char * hex_convert ; /* non-option arguments */ while (optind < argc - 1) { hex_convert = HexConvert(argv[optind + 1]) ; rc = ServerWrite(argv[optind], hex_convert); optind += 2; if ( hex_convert ) { free(hex_convert ) ; } } } else { /* non-option arguments */ while (optind < argc - 1) { rc = ServerWrite(argv[optind], argv[optind + 1]); optind += 2; } } if (optind < argc) { PRINT_ERROR("Unpaired entry: %s\n", argv[optind]); rc = -EINVAL; } if ( rc >= 0 ) { errno = 0 ; Exit(0) ; } else { errno = -rc ; Exit(1) ; } return 0; // never reached } static int HexVal( char c ) { switch ( c ) { case '0': return 0 ; case '1': return 1 ; case '2': return 2 ; case '3': return 3 ; case '4': return 4 ; case '5': return 5 ; case '6': return 6 ; case '7': return 7 ; case '8': return 8 ; case '9': return 9 ; case 'A': case 'a': return 10 ; case 'B': case 'b': return 11 ; case 'C': case 'c': return 12 ; case 'D': case 'd': return 13 ; case 'E': case 'e': return 14 ; case 'F': case 'f': return 15 ; default: PRINT_ERROR("Unrecognized hex character %c\n",c) ; Exit(1) ; } return -1 ; // never gets here } static char * HexConvert( char * input_string ) { int length = strlen( input_string ) ; int pad_first = ( (length/2)*2 != length ) ; char * return_string = malloc( (length + pad_first)/2 ) ; int hex_pointer = 0 ; int char_pointer = 0 ; if ( return_string == NULL ) { PRINT_ERROR("Out of memory.\n") ; errno = ENOMEM ; Exit(1) ; } if ( pad_first ) { return_string[0] = HexVal(input_string[0]) ; ++char_pointer ; ++hex_pointer ; } while ( hex_pointer < length ) { return_string[char_pointer] = HexVal(input_string[hex_pointer]) * 16 + HexVal(input_string[hex_pointer+1]) ; hex_pointer += 2 ; ++char_pointer ; } return return_string ; //freed in calling function } owfs-2.8p15/module/owshell/src/c/ow_opt.c0000644000175000017500000001050111732207065015236 00000000000000/* $Id: ow_opt.c,v 1.21 2012/03/20 23:09:41 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #include "owshell.h" // globals int hexflag = 0 ; int slashflag = 0 ; int size_of_data = -1 ; int offset_into_data = 0 ; int uncached = 0 ; int unaliased = 0 ; enum temp_type temperature_scale = temp_celsius ; enum pressure_type pressure_scale = pressure_mbar ; enum deviceformat device_format = fdi ; static void OW_parsevalue(int *var, const ASCII * str); const struct option owopts_long[] = { {"help", no_argument, NULL, 'h'}, {"quiet", no_argument, NULL, 'q'}, {"server", required_argument, NULL, 's'}, {"Celsius", no_argument, NULL, 'C'}, {"Fahrenheit", no_argument, NULL, 'F'}, {"Kelvin", no_argument, NULL, 'K'}, {"Rankine", no_argument, NULL, 'R'}, {"version", no_argument, NULL, 'V'}, {"format", required_argument, NULL, 'f'}, {"hex", no_argument, &hexflag, 1 }, {"HEX", no_argument, &hexflag, 1 }, {"hexidecimal", no_argument, &hexflag, 1 }, {"HEXIDECIMAL", no_argument, &hexflag, 1 }, {"dir", no_argument, &slashflag, 1 }, {"slash", no_argument, &slashflag, 1 }, {"SLASH", no_argument, &slashflag, 1 }, {"size", required_argument, NULL, 300 }, {"SIZE", required_argument, NULL, 300 }, {"BYTES", required_argument, NULL, 300 }, {"bytes", required_argument, NULL, 300 }, {"offset", required_argument, NULL, 301 }, {"OFFSET", required_argument, NULL, 301 }, {"start", required_argument, NULL, 301 }, {"START", required_argument, NULL, 301 }, {"timeout_network", required_argument, NULL, 307,}, // timeout -- tcp wait {"autoserver", no_argument, NULL, 275}, {"unaliased", no_argument, &unaliased, 1 }, {"aliased", no_argument, &unaliased, 0 }, {"uncached", no_argument, &uncached, 1 }, {"cached", no_argument, &uncached, 0 }, {0, 0, 0, 0}, }; /* Parses one argument */ void owopt(const int c, const char *arg) { //printf("Option %c (%d) Argument=%s\n",c,c,SAFESTRING(arg)) ; switch (c) { case 'h': ow_help(); Exit(0); case 'q': Globals.quiet = 1 ; // squash error messages break ; case 'C': temperature_scale = temp_celsius ; break; case 'F': temperature_scale = temp_fahrenheit ; break; case 'R': temperature_scale = temp_rankine ; break; case 'K': temperature_scale = temp_kelvin ; break; case 'V': printf("owshell version:\n\t" VERSION "\n"); Exit(0); case 's': ARG_Net(arg); break; case 'f': if (!strcasecmp(arg, "f.i")) device_format = fdi ; else if (!strcasecmp(arg, "fi")) device_format = fi ; else if (!strcasecmp(arg, "f.i.c")) device_format = fdidc ; else if (!strcasecmp(arg, "f.ic")) device_format = fdic ; else if (!strcasecmp(arg, "fi.c")) device_format = fidc ; else if (!strcasecmp(arg, "fic")) device_format = fic ; else { PRINT_ERROR("Unrecognized 1-wire slave format: %s\n", arg); Exit(1); } break; case 275: // autoserver #if OW_ZERO if (libdnssd == NULL) { PRINT_ERROR("Zeroconf/Bonjour is disabled since dnssd library isn't found.\n"); Exit(1); } else { OW_Browse(); } #else PRINT_ERROR("Zeroconf/Bonjour is disabled since it's compiled without support.\n"); Exit(1); #endif break; case 300: OW_parsevalue(&size_of_data, arg); if ( size_of_data < 0 || size_of_data > 64000 ) { PRINT_ERROR("Bad data size value. (%d).\n", size_of_data) ; Exit(1); } break ; case 301: OW_parsevalue(&offset_into_data, arg); if ( offset_into_data < 0 || offset_into_data > 64000 ) { PRINT_ERROR("Bad data offset value. (%d).\n", offset_into_data) ; Exit(1); } break ; case 307: OW_parsevalue(&Globals.timeout_network, arg); case 0: break; default: Exit(1); } } void ARG_Net(const char *arg) { ++count_inbound_connections; if (count_inbound_connections > 1) { PRINT_ERROR("Cannot link to more than one owserver. (%s and %s).\n", owserver_connection->name, arg); Exit(1); } owserver_connection->name = strdup(arg); } static void OW_parsevalue(int *var, const ASCII * str) { int I; errno = 0; I = strtol(str, NULL, 10); if (errno) { PRINT_ERROR("Bad configuration value %s\n", str); Exit(1); } var[0] = I; } owfs-2.8p15/module/owshell/src/c/owread.c0000664000175000017500000000205511070534674015223 00000000000000/* $Id: owread.c,v 1.13 2008/09/30 23:43:56 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; int rc = -1; Setup(); /* process command line arguments */ while (1) { c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); /* non-option arguments */ while (optind < argc) { rc = ServerRead(argv[optind]); ++optind; } if ( rc >= 0 ) { errno = 0 ; Exit(0) ; } else { errno = -rc ; Exit(1) ; } return 0; // never reached } owfs-2.8p15/module/owshell/src/c/ow_browse.c0000644000175000017500000000777511716516317015765 00000000000000/* $Id: ow_browse.c,v 1.13 2012/02/14 17:41:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include "owshell.h" #if OW_ZERO static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const char *t, void *c); static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context); static void HandleCall(DNSServiceRef sref); static void HandleCall(DNSServiceRef sref) { int file_descriptor; DNSServiceErrorType err = kDNSServiceErr_Unknown; //file_descriptor = DNSServiceRefSockFD(NULL) ; //PRINT_ERROR("HandleCall: file_descriptor=%d (just a test of function-call, should result -1)\n", file_descriptor); file_descriptor = DNSServiceRefSockFD(sref); //PRINT_ERROR("HandleCall: file_descriptor=%d\n", file_descriptor); if (file_descriptor >= 0) { while (1) { fd_set readfd; int rc; struct timeval tv = { 10, 0 }; FD_ZERO(&readfd); FD_SET(file_descriptor, &readfd); rc = select(file_descriptor + 1, &readfd, NULL, NULL, &tv); if (rc == -1) { if (errno == EINTR) { continue; } PERROR("Service Discovery select returned error\n"); } else if (rc > 0) { if (FD_ISSET(file_descriptor, &readfd)) { err = DNSServiceProcessResult(sref); } } else { PERROR("Service Discovery timed out\n"); } break; } } else { PRINT_ERROR("No Service Discovery socket\n"); } DNSServiceRefDeallocate(sref); if (err != kDNSServiceErr_NoError) { PRINT_ERROR("Service Discovery Process result error 0x%X\n", (int) err); Exit(1); } } static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const char *t, void *c) { ASCII name[121]; (void) tl; (void) t; (void) c; (void) n; (void) s; (void) f; (void) i; (void) e; //PRINT_ERROR("ResolveBack ref=%ld flags=%ld index=%ld, error=%d name=%s host=%s port=%d\n",(long int)s,(long int)f,(long int)i,(int)e,SAFESTRING(name),SAFESTRING(host),ntohs(port)) ; if (snprintf(name, 120, "%s:%d", SAFESTRING(host), ntohs(port)) < 0) { PERROR("Trouble with zeroconf resolve return\n"); } else if (count_inbound_connections < 1) { ++count_inbound_connections; owserver_connection->name = strdup(name); return; } Exit(1); } /* Sent back from Bounjour -- arbitrarily use it to set the Ref for Deallocation */ static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context) { (void) context; (void) i ; (void) s ; //PRINT_ERROR("BrowseBack ref=%ld flags=%ld index=%ld, error=%d name=%s type=%s domain=%s\n",(long int)s,(long int)f,(long int)i,(int)e,SAFESTRING(name),SAFESTRING(type),SAFESTRING(domain)) ; if (e == kDNSServiceErr_NoError) { if (f & kDNSServiceFlagsAdd) { // Add DNSServiceRef sr; if (DNSServiceResolve(&sr, 0, 0, name, type, domain, ResolveBack, NULL) == kDNSServiceErr_NoError) { HandleCall(sr); return; } else { PRINT_ERROR("Service Resolve error on %s\n", SAFESTRING(name)); } } else { PRINT_ERROR("OWSERVER %s is leaving\n", name); } } else { PRINT_ERROR("Browse callback error = %d\n", (int) e); } Exit(1); } void OW_Browse(void) { DNSServiceErrorType dnserr; DNSServiceRef sref; dnserr = DNSServiceBrowse(&sref, 0, 0, "_owserver._tcp", NULL, BrowseBack, NULL); if (dnserr == kDNSServiceErr_NoError) { HandleCall(sref); } else { PRINT_ERROR("DNSServiceBrowse error = %d\n", (int) dnserr); Exit(1); } } #else /* OW_ZERO */ void OW_Browse(void) { PRINT_ERROR("OWFS is compiled without Zeroconf/Bonjour support.\n"); } #endif /* OW_ZERO */ owfs-2.8p15/module/owshell/src/c/owdir.c0000664000175000017500000000255011070534674015066 00000000000000/* $Id: owdir.c,v 1.15 2008/09/30 23:43:56 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; int paths_found = 0; int rc = -1; int dirall = 1; Setup(); /* process command line arguments */ while (1) { c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); /* non-option arguments */ while (optind < argc) { ++paths_found; if (dirall) { rc = ServerDirall(argv[optind]); if (rc < 0) { dirall = 0; rc = ServerDir(argv[optind]); } } else { rc = ServerDir(argv[optind]); } ++optind; } // Was anything requested? if (paths_found == 0) { rc = ServerDirall("/"); if (rc < 0) rc = ServerDir("/"); } if ( rc >= 0 ) { errno = 0 ; Exit(0) ; } else { errno = -rc ; Exit(1) ; } return 0; // never reached } owfs-2.8p15/module/owshell/src/c/Makefile.in0000664000175000017500000006033311756250030015636 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.18 2012/03/13 00:06:35 alfille Exp $ 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@ target_triplet = @target@ bin_PROGRAMS = owget$(EXEEXT) owdir$(EXEEXT) owread$(EXEEXT) \ owwrite$(EXEEXT) owpresent$(EXEEXT) owexist$(EXEEXT) subdir = module/owshell/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = ow_opt.$(OBJEXT) ow_help.$(OBJEXT) ow_server.$(OBJEXT) \ ow_net.$(OBJEXT) ow_browse.$(OBJEXT) ow_dl.$(OBJEXT) \ ow_dnssd.$(OBJEXT) ow_tcp_read.$(OBJEXT) getaddrinfo.$(OBJEXT) \ getopt.$(OBJEXT) globals.$(OBJEXT) am_owdir_OBJECTS = $(am__objects_1) owdir.$(OBJEXT) owdir_OBJECTS = $(am_owdir_OBJECTS) owdir_LDADD = $(LDADD) am__DEPENDENCIES_1 = owdir_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_owexist_OBJECTS = $(am__objects_1) owexist.$(OBJEXT) owexist_OBJECTS = $(am_owexist_OBJECTS) owexist_LDADD = $(LDADD) owexist_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_owget_OBJECTS = $(am__objects_1) owget.$(OBJEXT) owget_OBJECTS = $(am_owget_OBJECTS) owget_LDADD = $(LDADD) owget_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_owpresent_OBJECTS = $(am__objects_1) owpresent.$(OBJEXT) owpresent_OBJECTS = $(am_owpresent_OBJECTS) owpresent_LDADD = $(LDADD) owpresent_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_owread_OBJECTS = $(am__objects_1) owread.$(OBJEXT) owread_OBJECTS = $(am_owread_OBJECTS) owread_LDADD = $(LDADD) owread_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_owwrite_OBJECTS = $(am__objects_1) owwrite.$(OBJEXT) owwrite_OBJECTS = $(am_owwrite_OBJECTS) owwrite_LDADD = $(LDADD) owwrite_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(owdir_SOURCES) $(owexist_SOURCES) $(owget_SOURCES) \ $(owpresent_SOURCES) $(owread_SOURCES) $(owwrite_SOURCES) DIST_SOURCES = $(owdir_SOURCES) $(owexist_SOURCES) $(owget_SOURCES) \ $(owpresent_SOURCES) $(owread_SOURCES) $(owwrite_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ COMMON_OWSHELL_SOURCE = ow_opt.c \ ow_help.c \ ow_server.c \ ow_net.c \ ow_browse.c \ ow_dl.c \ ow_dnssd.c \ ow_tcp_read.c\ getaddrinfo.c\ getopt.c \ globals.c owget_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owget.c owdir_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owdir.c owread_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owread.c owwrite_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owwrite.c owpresent_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owpresent.c owexist_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owexist.c AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} LDADD = ${LD_EXTRALIBS} ${OSLIBS} 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 module/owshell/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owshell/src/c/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-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_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 owdir$(EXEEXT): $(owdir_OBJECTS) $(owdir_DEPENDENCIES) $(EXTRA_owdir_DEPENDENCIES) @rm -f owdir$(EXEEXT) $(LINK) $(owdir_OBJECTS) $(owdir_LDADD) $(LIBS) owexist$(EXEEXT): $(owexist_OBJECTS) $(owexist_DEPENDENCIES) $(EXTRA_owexist_DEPENDENCIES) @rm -f owexist$(EXEEXT) $(LINK) $(owexist_OBJECTS) $(owexist_LDADD) $(LIBS) owget$(EXEEXT): $(owget_OBJECTS) $(owget_DEPENDENCIES) $(EXTRA_owget_DEPENDENCIES) @rm -f owget$(EXEEXT) $(LINK) $(owget_OBJECTS) $(owget_LDADD) $(LIBS) owpresent$(EXEEXT): $(owpresent_OBJECTS) $(owpresent_DEPENDENCIES) $(EXTRA_owpresent_DEPENDENCIES) @rm -f owpresent$(EXEEXT) $(LINK) $(owpresent_OBJECTS) $(owpresent_LDADD) $(LIBS) owread$(EXEEXT): $(owread_OBJECTS) $(owread_DEPENDENCIES) $(EXTRA_owread_DEPENDENCIES) @rm -f owread$(EXEEXT) $(LINK) $(owread_OBJECTS) $(owread_LDADD) $(LIBS) owwrite$(EXEEXT): $(owwrite_OBJECTS) $(owwrite_DEPENDENCIES) $(EXTRA_owwrite_DEPENDENCIES) @rm -f owwrite$(EXEEXT) $(LINK) $(owwrite_OBJECTS) $(owwrite_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_browse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dnssd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tcp_read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owexist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owpresent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owwrite.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic 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-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owshell/src/c/owpresent.c0000664000175000017500000000176711026222123015761 00000000000000/* $Id: owpresent.c,v 1.11 2008/06/18 15:05:55 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; int rc = -1; Setup(); /* process command line arguments */ while (1) { c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); /* non-option arguments */ while (optind < argc) { rc = ServerPresence(argv[optind]); ++optind; } Exit((rc >= 0 ? 0 : 1)); return 0; // never reached } owfs-2.8p15/module/owshell/src/c/ow_server.c0000644000175000017500000002343411732207065015753 00000000000000/* $Id: ow_server.c,v 1.34 2012/03/20 23:09:41 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "owshell.h" static int FromServer(int file_descriptor, struct client_msg *cm, char *msg, size_t size); static void *FromServerAlloc(int file_descriptor, struct client_msg *cm); static int ToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp); static uint32_t SetupSemi(void); static void Write( char * buffer, int length ) ; void Server_detect(void) { if (count_inbound_connections == 0) { PRINT_ERROR("No owserver_connection defined\n"); errno = ENOENT ; Exit(2); } if (owserver_connection->name == NULL || ClientAddr(owserver_connection->name)) { PRINT_ERROR("Could not connect with owserver %s\n", owserver_connection->name); errno = ENOENT ; Exit(2); } } int ServerRead(ASCII * path) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { path, NULL, 0, NULL, 0, }; int connectfd = ClientConnect(); int size = 65536; char buf[size + 1]; int ret = 0; if (connectfd < 0) { return -EIO; } //printf("Read <%s>\n",path); memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_read; sm.size = size; sm.offset = offset_into_data; if ( size_of_data >=0 && size_of_data <= 65536 ) { sm.size = size_of_data ; } if (ToServer(connectfd, &sm, &sp)) { PRINT_ERROR("ServerRead: Error sending request for %s\n", path); ret = -EIO; } else if (FromServer(connectfd, &cm, buf, size) < 0) { PRINT_ERROR("ServerRead: Error receiving data on %s\n", path); ret = -EIO; } else { ret = cm.ret; if (ret < 0 || ret > size ) { PRINT_ERROR("ServerRead: Data error on %s\n", path); } else { Write( buf, ret ) ; } } close(connectfd); return ret; } int ServerWrite(ASCII * path, ASCII * data) { struct server_msg sm; struct client_msg cm; int size = strlen(data); struct serverpackage sp = { path, (BYTE *) data, size, NULL, 0, }; int connectfd = ClientConnect(); int ret = 0; if (connectfd < 0) { return -EIO; } //printf("Write <%s> <%s>\n",path,data); memset(&sm, 0, sizeof(struct server_msg)); sm.type = msg_write; sm.size = size; sm.offset = offset_into_data; if (ToServer(connectfd, &sm, &sp)) { ret = -EIO; } else if (FromServer(connectfd, &cm, NULL, 0) < 0) { ret = -EIO; } else { ret = cm.ret; } close(connectfd); return ret; } int ServerDirall(ASCII * path) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { path, NULL, 0, NULL, 0, }; char *path2; int connectfd = ClientConnect(); if (connectfd < 0) { return -EIO; } //printf("DirALL <%s>\n",path ) ; memset(&sm, 0, sizeof(struct server_msg)); sm.type = slashflag ? msg_dirallslash : msg_dirall; if (ToServer(connectfd, &sm, &sp)) { cm.ret = -EIO; } else if ((path2 = FromServerAlloc(connectfd, &cm))) { char *p; path2[cm.payload - 1] = '\0'; /* Ensure trailing null */ for (p = path2; *p; ++p) if (*p == ',') *p = '\n'; printf("%s\n", path2); free(path2); } close(connectfd); return cm.ret; } int ServerDir(ASCII * path) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { path, NULL, 0, NULL, 0, }; int connectfd = ClientConnect(); if (connectfd < 0) { return -EIO; } //printf("Dir <%s>\n", path ) ; memset(&sm, 0, sizeof(struct server_msg)); sm.type = msg_dir; if (ToServer(connectfd, &sm, &sp)) { cm.ret = -EIO; } else { char *path2; while ((path2 = FromServerAlloc(connectfd, &cm))) { path2[cm.payload - 1] = '\0'; /* Ensure trailing null */ printf("%s\n", path2); free(path2); } } close(connectfd); return cm.ret; } int ServerPresence(ASCII * path) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { path, NULL, 0, NULL, 0, }; int connectfd = ClientConnect(); int ret = 0; if (connectfd < 0) { return -EIO; } //printf("Presence <%s>\n",path); memset(&sm, 0, sizeof(struct server_msg)); sm.type = msg_presence; if (ToServer(connectfd, &sm, &sp)) { ret = -EIO; } else if (FromServer(connectfd, &cm, NULL, 0) < 0) { ret = -EIO; } else { ret = cm.ret; } close(connectfd); printf((ret >= 0) ? "1" : "0"); return ret; } /* read from server, free return pointer if not Null */ static void *FromServerAlloc(int file_descriptor, struct client_msg *cm) { char *msg; int ret; struct timeval tv = { Globals.timeout_network + 1, 0, }; do { /* loop until non delay message (payload>=0) */ //printf("OW_SERVER loop1\n"); ret = tcp_read(file_descriptor, cm, sizeof(struct client_msg), &tv); if (ret != sizeof(struct client_msg)) { memset(cm, 0, sizeof(struct client_msg)); cm->ret = -EIO; return NULL; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->sg = ntohl(cm->sg); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); //printf("FromServerAlloc payload=%d size=%d ret=%d sg=%X offset=%d\n",cm->payload,cm->size,cm->ret,cm->sg,cm->offset); //printf(">%.4d|%.4d\n",cm->ret,cm->payload); if (cm->payload == 0) return NULL; if (cm->ret < 0) return NULL; if (cm->payload > MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE) { //printf("FromServerAlloc payload too large\n"); return NULL; } if ((msg = (char *) malloc((size_t) cm->payload))) { ret = tcp_read(file_descriptor, msg, (size_t) (cm->payload), &tv); if (ret != cm->payload) { //printf("FromServer couldn't read payload\n"); cm->payload = 0; cm->offset = 0; cm->ret = -EIO; free(msg); msg = NULL; } //printf("FromServer payload read ok\n"); } return msg; } /* Read from server -- return negative on error, return 0 or positive giving size of data element */ static int FromServer(int file_descriptor, struct client_msg *cm, char *msg, size_t size) { size_t rtry; size_t ret; struct timeval tv = { Globals.timeout_network + 1, 0, }; do { // read regular header, or delay (delay when payload<0) //printf("OW_SERVER loop2\n"); ret = tcp_read(file_descriptor, cm, sizeof(struct client_msg), &tv); if (ret != sizeof(struct client_msg)) { //printf("OW_SERVER loop2 bad\n"); cm->size = 0; cm->ret = -EIO; return -EIO; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->sg = ntohl(cm->sg); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); // flag to show a delay message //printf("OW_SERVER loop2 done\n"); //printf("FromServer payload=%d size=%d ret=%d sg=%d offset=%d\n",cm->payload,cm->size,cm->ret,cm->sg,cm->offset); //printf(">%.4d|%.4d\n",cm->ret,cm->payload); if (cm->payload == 0) return 0; // No payload, done. rtry = cm->payload < (ssize_t) size ? (size_t) cm->payload : size; ret = tcp_read(file_descriptor, msg, rtry, &tv); // read expected payload now. if (ret != rtry) { cm->ret = -EIO; return -EIO; } if (cm->payload > (ssize_t) size) { // Uh oh. payload bigger than expected. read it in and discard size_t d = cm->payload - size; char extra[d]; ret = tcp_read(file_descriptor, extra, d, &tv); if (ret != d) { cm->ret = -EIO; return -EIO; } return size; } return cm->payload; } // should be const char * data but iovec has problems with const arguments static int ToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp) { int payload = 0; int nio = 0; struct iovec io[5] = { {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, }; // Set up flags sm->sg = SetupSemi() ; // First block to send, the header io[nio].iov_base = sm; io[nio].iov_len = sizeof(struct server_msg); nio++; // Next block, the path if ((io[nio].iov_base = sp->path)) { // send path (if not null) io[nio].iov_len = payload = strlen(sp->path) + 1; nio++; //printf("ToServer path=%s\n", sp->path); } // next block, data (only for writes) if ((sp->datasize>0) && (io[nio].iov_base = sp->data)) { // send data only for writes (if datasize not zero) payload += (io[nio].iov_len = sp->datasize); nio++; //LEVEL_DEBUG("ToServer data=%s\n", sp->data); } sp->tokens = 0; sm->version = 0; // shouldn't this be MakeServerprotocol(OWSERVER_PROTOCOL_VERSION); //printf("ToServer payload=%d size=%d type=%d tempscale=%X offset=%d\n",payload,sm->size,sm->type,sm->sg,sm->offset); //printf("<%.4d|%.4d\n",sm->type,payload); // encode in network order (just the header) sm->version = htonl(sm->version); sm->payload = htonl(payload); sm->size = htonl(sm->size); sm->type = htonl(sm->type); sm->sg = htonl(sm->sg); sm->offset = htonl(sm->offset); //Debug_Writev(io, nio); return writev(file_descriptor, io, nio) != (ssize_t) (payload + sizeof(struct server_msg) + sp->tokens * sizeof(union antiloop)); } /* flag the sg for "virtual root" -- the remote bus was specifically requested */ /* Also ALIAS_REQUEST means that aliases will be applied */ static uint32_t SetupSemi(void) { uint32_t sg = SHOULD_RETURN_BUS_LIST ; // Device format sg |= (device_format) << DEVFORMAT_BIT ; // Pressure scale sg |= (pressure_scale) << PRESSURESCALE_BIT ; // Temperature scale sg |= (temperature_scale) << TEMPSCALE_BIT ; // Uncached sg |= uncached ? UNCACHED : 0 ; // Unaliased sg |= unaliased ? 0 : ALIAS_REQUEST ; // OWNet flag or Presence check sg |= OWNET ; return sg; } static void Write( char * buffer, int length) { int i ; char *fmt; /* * Write binary (raw) or hex-formatted ASCII depending on * the value of "hexflag" (set through the CLI argument * --hex). */ fmt = hexflag ? "%.2X" : "%c"; for ( i=0 ; i #include "owfs_config.h" #if OW_ZERO #include "ow.h" #include "ow_dl.h" #include "ow_dnssd.h" DLHANDLE libdnssd = NULL; #if OW_CYGWIN #ifdef HAVE_DLFCN_H #include #endif #endif _DNSServiceRefSockFD DNSServiceRefSockFD; _DNSServiceProcessResult DNSServiceProcessResult; _DNSServiceRefDeallocate DNSServiceRefDeallocate; _DNSServiceResolve DNSServiceResolve; _DNSServiceBrowse DNSServiceBrowse; _DNSServiceRegister DNSServiceRegister; _DNSServiceReconfirmRecord DNSServiceReconfirmRecord; _DNSServiceCreateConnection DNSServiceCreateConnection; _DNSServiceEnumerateDomains DNSServiceEnumerateDomains; int OW_Load_dnssd_library(void) { int i = 0; #if OW_CYGWIN char libdirs[3][80] = { //{ "/opt/owfs/lib/libdns_sd.dll" }, {"libdns_sd.dll"}, {""} }; while (*libdirs[i]) { /* Cygwin has dlopen and it seems to be ok to use it actually. */ if (!(libdnssd = DL_open(libdirs[i]))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); PRINT_ERROR("dlopen [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //PRINT_ERROR("DL_open [%s] success\n", libdirs[i]); break; } } #if 0 /* This file compiled with Microsoft Visual C doesn't work actually... */ if (!libdnssd) { char file[255]; strcpy(file, "dnssd.dll"); if (!(libdnssd = DL_open(file))) { /* Couldn't open that lib, but continue anyway */ } } #endif #elif OW_DARWIN // MacOSX have dnssd functions in libSystem char libdirs[2][80] = { {"libSystem.dylib"}, {""} }; while (*libdirs[i]) { if (!(libdnssd = DL_open(libdirs[i]))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); PRINT_ERROR("DL_open [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //PRINT_ERROR("DL_open [%s] success\n", libdirs[i]); break; } } #elif defined(HAVE_DLOPEN) char libdirs[3][80] = { {"/opt/owfs/lib/libdns_sd.so"}, {"libdns_sd.so"}, {""} }; while (*libdirs[i]) { if (!(libdnssd = DL_open(libdirs[i]))) { /* Couldn't open that lib, but continue anyway */ #if 0 char *derr; derr = DL_error(); PRINT_ERROR("DL_open [%s] failed [%s]\n", libdirs[i], derr); #endif i++; continue; } else { //PRINT_ERROR("DL_open [%s] success\n", libdirs[i]); break; } } #endif if (libdnssd == NULL) { //PRINT_ERROR("Zeroconf/Bonjour is disabled since dnssd library isn't found\n"); return -1; } DNSServiceRefSockFD = (_DNSServiceRefSockFD) DL_sym(libdnssd, "DNSServiceRefSockFD"); DNSServiceProcessResult = (_DNSServiceProcessResult) DL_sym(libdnssd, "DNSServiceProcessResult"); DNSServiceRefDeallocate = (_DNSServiceRefDeallocate) DL_sym(libdnssd, "DNSServiceRefDeallocate"); DNSServiceResolve = (_DNSServiceResolve) DL_sym(libdnssd, "DNSServiceResolve"); DNSServiceBrowse = (_DNSServiceBrowse) DL_sym(libdnssd, "DNSServiceBrowse"); DNSServiceRegister = (_DNSServiceRegister) DL_sym(libdnssd, "DNSServiceRegister"); DNSServiceReconfirmRecord = (_DNSServiceReconfirmRecord) DL_sym(libdnssd, "DNSServiceReconfirmRecord"); DNSServiceCreateConnection = (_DNSServiceCreateConnection) DL_sym(libdnssd, "DNSServiceCreateConnection"); DNSServiceEnumerateDomains = (_DNSServiceEnumerateDomains) DL_sym(libdnssd, "DNSServiceEnumerateDomains"); return 0; } void OW_Free_dnssd_library(void) { if (libdnssd) { DL_close(libdnssd); libdnssd = NULL; } } #endif /* OW_ZERO */ owfs-2.8p15/module/owshell/src/c/ow_dl.c0000664000175000017500000000201711427405365015044 00000000000000/* $Id: ow_dl.c,v 1.8 2010/08/08 01:40:05 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_dl.h" #if OW_ZERO DLHANDLE DL_open(const char *pathname) { #if OW_CYGWIN return LoadLibrary(pathname); #elif defined(HAVE_DLOPEN) return dlopen(pathname, RTLD_LAZY|RTLD_GLOBAL); #endif } void *DL_sym(DLHANDLE handle, const char *name) { #if OW_CYGWIN return (void *) GetProcAddress(handle, name); #elif defined(HAVE_DLOPEN) return dlsym(handle, name); #endif } int DL_close(DLHANDLE handle) { #if OW_CYGWIN if (FreeLibrary(handle)) return 0; return -1; #elif defined(HAVE_DLOPEN) return dlclose(handle); #endif } char *DL_error(void) { #if OW_CYGWIN return "Error in WIN32 DL"; #elif defined(HAVE_DLOPEN) return dlerror(); #endif } #endif owfs-2.8p15/module/owshell/src/c/getaddrinfo.c0000664000175000017500000007161211267053570016234 00000000000000/* $USAGI: getaddrinfo.c,v 1.16 2001/10/04 09:52:03 sekiya Exp $ */ /* The Inner Net License, Version 2.00 The author(s) grant permission for redistribution and use in source and binary forms, with or without modification, of the software and documentation provided that the following conditions are met: 0. If you receive a version of the software that is specifically labelled as not being for redistribution (check the version message and/or README), you are not permitted to redistribute that version of the software in any way or form. 1. All terms of the all other applicable copyrights and licenses must be followed. 2. Redistributions of source code must retain the authors' copyright notice(s), this list of conditions, and the following disclaimer. 3. Redistributions in binary form must reproduce the authors' copyright notice(s), this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 4. All advertising materials mentioning features or use of this software must display the following acknowledgement with the name(s) of the authors as specified in the copyright notice(s) substituted where indicated: This product includes software developed by , The Inner Net, and other contributors. 5. Neither the name(s) of the author(s) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If these license terms cause you a real problem, contact the author. */ /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ #include #include "owfs_config.h" #ifdef HAVE_PTHREAD #include #endif #ifndef HAVE_GETADDRINFO #define _GNU_SOURCE #define __FORCE_GLIBC #ifdef HAVE_FEATURES_H #include #endif #include #include #include #include "compat_netdb.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_RESOLV_H #include #endif #include "ow_debug.h" /* The following declarations and definitions have been removed from * the public header since we don't want people to use them. */ #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */ #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type. */ #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) #define GAIH_OKIFUNSPEC 0x0100 #define GAIH_EAI ~(GAIH_OKIFUNSPEC) struct gaih_service { const char *name; int num; }; struct gaih_servtuple { struct gaih_servtuple *next; int socktype; int protocol; int port; }; static const struct gaih_servtuple nullserv; struct gaih_addrtuple { struct gaih_addrtuple *next; int family; char addr[16]; uint32_t scopeid; }; struct gaih_typeproto { int socktype; int protocol; char name[4]; int protoflag; }; /* Values for `protoflag'. */ #define GAI_PROTO_NOSERVICE 1 #define GAI_PROTO_PROTOANY 2 static const struct gaih_typeproto gaih_inet_typeproto[] = { {0, 0, "", 0}, {SOCK_STREAM, IPPROTO_TCP, "tcp", 0}, {SOCK_DGRAM, IPPROTO_UDP, "udp", 0}, {SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY | GAI_PROTO_NOSERVICE}, {0, 0, "", 0} }; struct gaih { int family; int (*gaih) (const char *name, const struct gaih_service * service, const struct addrinfo * req, struct addrinfo ** pai); }; #if PF_UNSPEC == 0 static const struct addrinfo default_hints; #else static const struct addrinfo default_hints = { 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL }; #endif static int addrconfig(sa_family_t af) { int s; int ret; int saved_errno = errno; s = socket(af, SOCK_DGRAM, 0); if (s < 0) ret = (errno == EMFILE) ? 1 : 0; else { close(s); ret = 1; } __set_errno(saved_errno); return ret; } #if 0 #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 #endif /* Using Unix sockets this way is a security risk. */ static int gaih_local(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { struct utsname utsname; if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST)) return GAIH_OKIFUNSPEC | -EAI_NONAME; if ((name != NULL) || (req->ai_flags & AI_CANONNAME)) if (uname(&utsname) < 0) return -EAI_SYSTEM; if (name != NULL) { if (strcmp(name, "localhost") && strcmp(name, "local") && strcmp(name, "unix") && strcmp(name, utsname.nodename)) return GAIH_OKIFUNSPEC | -EAI_NONAME; } if (req->ai_protocol || req->ai_socktype) { const struct gaih_typeproto *tp = gaih_inet_typeproto + 1; while (tp->name[0] && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0 || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } *pai = malloc(sizeof(struct addrinfo) + sizeof(struct sockaddr_un) + ((req->ai_flags & AI_CANONNAME) ? (strlen(utsname.nodename) + 1) : 0)); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_next = NULL; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = AF_LOCAL; (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM; (*pai)->ai_protocol = req->ai_protocol; (*pai)->ai_addrlen = sizeof(struct sockaddr_un); (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len = sizeof(struct sockaddr_un); #endif /* HAVE_SA_LEN */ ((struct sockaddr_un *) (*pai)->ai_addr)->sun_family = AF_LOCAL; memset(((struct sockaddr_un *) (*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); if (service) { struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; if (strchr(service->name, '/') != NULL) { if (strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; strcpy(sunp->sun_path, service->name); } else { if (strlen(P_tmpdir "/") + 1 + strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; __stpcpy(__stpcpy(sunp->sun_path, P_tmpdir "/"), service->name); } } else { /* This is a dangerous use of the interface since there is a time window between the test for the file and the actual creation (done by the caller) in which a file with the same name could be created. */ char *buf = ((struct sockaddr_un *) (*pai)->ai_addr)->sun_path; if (__builtin_expect(__path_search(buf, L_tmpnam, NULL, NULL, 0), 0) != 0 || __builtin_expect(__gen_tempname(buf, __GT_NOCREATE), 0) != 0) return -EAI_SYSTEM; } if (req->ai_flags & AI_CANONNAME) (*pai)->ai_canonname = strcpy((char *) *pai + sizeof(struct addrinfo) + sizeof(struct sockaddr_un), utsname.nodename); else (*pai)->ai_canonname = NULL; return 0; } #endif /* 0 */ #ifndef HAVE_GETHOSTBYNAME_R struct hostent *gethostbyname_r(const char *name, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD pthread_mutex_lock(&gethostbyname_lock); #endif res = gethostbyname(name); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD pthread_mutex_unlock(&gethostbyname_lock); #endif return res; } #endif #ifndef HAVE_GETSERVBYNAME_R struct servent *getservbyname_r(const char *name, const char *proto, struct servent *result, char *buf, size_t buflen) { #ifdef HAVE_PTHREAD static pthread_mutex_t getservbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct servent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD pthread_mutex_lock(&getservbyname_lock); #endif res = getservbyname(name, proto); if (res) memcpy(result, res, sizeof(struct servent)); #ifdef HAVE_PTHREAD pthread_mutex_unlock(&getservbyname_lock); #endif return res; } #endif static int gaih_inet_serv(const char *servicename, const struct gaih_typeproto *tp, const struct addrinfo *req, struct gaih_servtuple *st) { struct servent *s; size_t tmpbuflen = 1024; struct servent ts; char *tmpbuf; int r; do { tmpbuf = alloca(tmpbuflen); #if 0 r = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen, &s); if (!s) r = errno; if (r != 0 || s == NULL) { if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } #else s = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen); if (s == NULL) { r = errno; if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } else { r = 0; } #endif } while (r); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = s->s_port; return 0; } #define gethosts(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = 0; \ h = gethostbyname_r (name, &th, tmpbuf, \ tmpbuflen, &herrno); \ if(!h) rc = errno; \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #ifndef HAVE_GETHOSTBYNAME2_R struct hostenv *gethostbyname2_r(const char *name, int af, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) { /* Don't support this if it doesn't exists... (eg. IPV6 will fail on cygwin for example) */ (void) name; (void) af; (void) ret; (void) buf; (void) buflen; (void) result; (void) h_errnop; return NULL; } #endif #if __HAS_IPV6__ #define gethosts2(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = gethostbyname2_r (name, _family, &th, tmpbuf, \ tmpbuflen, &h, &herrno); \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #endif #ifndef HAVE_GETHOSTBYADDR_R struct hostent *gethostbyaddr_r(const char *name, int len, int type, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyaddr_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD pthread_mutex_lock(&gethostbyaddr_lock); #endif res = gethostbyaddr(name, len, type); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD pthread_mutex_unlock(&gethostbyaddr_lock); #endif return res; } #endif static int gaih_inet(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { const struct gaih_typeproto *tp = gaih_inet_typeproto; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; struct gaih_addrtuple *at = NULL; int rc; int v4mapped = (req->ai_family == PF_UNSPEC #if __HAS_IPV6__ || req->ai_family == PF_INET6 #endif ) && (req->ai_flags & AI_V4MAPPED); if (req->ai_protocol || req->ai_socktype) { ++tp; while (tp->name[0] && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } if (service != NULL) { if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); if (service->num < 0) { if (tp->name[0]) { st = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, st))) return rc; } else { struct gaih_servtuple **pst = &st; for (tp++; tp->name[0]; tp++) { struct gaih_servtuple *newp; if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) continue; if (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) continue; if (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol) continue; newp = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, newp))) { if (rc & GAIH_OKIFUNSPEC) continue; return rc; } *pst = newp; pst = &(newp->next); } if (st == (struct gaih_servtuple *) &nullserv) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } else { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = htons(service->num); } } else if (req->ai_socktype || req->ai_protocol) { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = 0; } else { /* * Neither socket type nor protocol is set. Return all socket types * we know about. */ struct gaih_servtuple **lastp = &st; for (++tp; tp->name[0]; ++tp) { struct gaih_servtuple *newp; newp = alloca(sizeof(struct gaih_servtuple)); newp->next = NULL; newp->socktype = tp->socktype; newp->protocol = tp->protocol; newp->port = 0; *lastp = newp; lastp = &newp->next; } } if (name != NULL) { at = alloca(sizeof(struct gaih_addrtuple)); at->family = AF_UNSPEC; at->scopeid = 0; at->next = NULL; if (inet_pton(AF_INET, name, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET || v4mapped) at->family = AF_INET; else return -EAI_FAMILY; } #if __HAS_IPV6__ if (at->family == AF_UNSPEC) { char *namebuf = strdupa(name); char *scope_delim; scope_delim = strchr(namebuf, SCOPE_DELIMITER); if (scope_delim != NULL) *scope_delim = '\0'; if (inet_pton(AF_INET6, namebuf, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) at->family = AF_INET6; else return -EAI_FAMILY; if (scope_delim != NULL) { int try_numericscope = 0; if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) { at->scopeid = if_nametoindex(scope_delim + 1); if (at->scopeid == 0) try_numericscope = 1; } else try_numericscope = 1; if (try_numericscope != 0) { char *end; assert(sizeof(uint32_t) <= sizeof(unsigned long)); at->scopeid = (uint32_t) strtoul(scope_delim + 1, &end, 10); if (*end != '\0') return GAIH_OKIFUNSPEC | -EAI_NONAME; } } } } #endif if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0) { struct hostent *h; struct gaih_addrtuple **pat = &at; int no_data = 0; int no_inet6_data; /* * If we are looking for both IPv4 and IPv6 address we don't want * the lookup functions to automatically promote IPv4 addresses to * IPv6 addresses. */ #if __HAS_IPV6__ if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) gethosts(AF_INET6, struct in6_addr); #endif no_inet6_data = no_data; if (req->ai_family == AF_INET || (!v4mapped && req->ai_family == AF_UNSPEC) || (v4mapped && (no_inet6_data != 0 || (req->ai_flags & AI_ALL)))) #if __HAS_IPV6__ gethosts2(AF_INET, struct in_addr); #else gethosts(AF_INET, struct in_addr); #endif if (no_data != 0 && no_inet6_data != 0) { /* If both requests timed out report this. */ if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN) return -EAI_AGAIN; /* * We made requests but they turned out no data. * The name is known, though. */ return (GAIH_OKIFUNSPEC | -EAI_AGAIN); } } if (at->family == AF_UNSPEC) return (GAIH_OKIFUNSPEC | -EAI_NONAME); } else { struct gaih_addrtuple *atr; atr = at = alloca(sizeof(struct gaih_addrtuple)); memset(at, '\0', sizeof(struct gaih_addrtuple)); if (req->ai_family == 0) { at->next = alloca(sizeof(struct gaih_addrtuple)); memset(at->next, '\0', sizeof(struct gaih_addrtuple)); } #if __HAS_IPV6__ if (req->ai_family == 0 || req->ai_family == AF_INET6) { extern const struct in6_addr __in6addr_loopback; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) memcpy(at->addr, &__in6addr_loopback, sizeof(struct in6_addr)); atr = at->next; } #endif if (req->ai_family == 0 || req->ai_family == AF_INET) { atr->family = AF_INET; if ((req->ai_flags & AI_PASSIVE) == 0) *(uint32_t *) atr->addr = htonl(INADDR_LOOPBACK); } } if (pai == NULL) return 0; { const char *c = NULL; struct gaih_servtuple *st2; struct gaih_addrtuple *at2 = at; size_t socklen, namelen; sa_family_t family; /* * buffer is the size of an unformatted IPv6 address in * printable format. */ char buffer[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; while (at2 != NULL) { if (req->ai_flags & AI_CANONNAME) { struct hostent *h = NULL; int herrno; struct hostent th; size_t tmpbuflen = 512; char *tmpbuf; do { tmpbuflen *= 2; tmpbuf = alloca(tmpbuflen); if (tmpbuf == NULL) return -EAI_MEMORY; rc = 0; h = gethostbyaddr_r(at2->addr, #if __HAS_IPV6__ ((at2->family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr)), #else sizeof(struct in_addr), #endif at2->family, &th, tmpbuf, tmpbuflen, &herrno); if (!h) rc = errno; } while (rc == errno && herrno == NETDB_INTERNAL); if (rc != 0 && herrno == NETDB_INTERNAL) { __set_h_errno(herrno); return -EAI_SYSTEM; } if (h == NULL) c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer)); else c = h->h_name; if (c == NULL) return GAIH_OKIFUNSPEC | -EAI_NONAME; namelen = strlen(c) + 1; } else namelen = 0; #if __HAS_IPV6__ if (at2->family == AF_INET6 || v4mapped) { family = AF_INET6; socklen = sizeof(struct sockaddr_in6); } else #endif { family = AF_INET; socklen = sizeof(struct sockaddr_in); } for (st2 = st; st2 != NULL; st2 = st2->next) { *pai = malloc(sizeof(struct addrinfo) + socklen + namelen); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = family; (*pai)->ai_socktype = st2->socktype; (*pai)->ai_protocol = st2->protocol; (*pai)->ai_addrlen = socklen; (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN (*pai)->ai_addr->sa_len = socklen; #endif /* HAVE_SA_LEN */ (*pai)->ai_addr->sa_family = family; #if __HAS_IPV6__ if (family == AF_INET6) { struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *) (*pai)->ai_addr; sin6p->sin6_flowinfo = 0; if (at2->family == AF_INET6) { memcpy(&sin6p->sin6_addr, at2->addr, sizeof(struct in6_addr)); } else { sin6p->sin6_addr.s6_addr32[0] = 0; sin6p->sin6_addr.s6_addr32[1] = 0; sin6p->sin6_addr.s6_addr32[2] = htonl(0x0000ffff); memcpy(&sin6p->sin6_addr.s6_addr32[3], at2->addr, sizeof(sin6p->sin6_addr.s6_addr32[3])); } sin6p->sin6_port = st2->port; sin6p->sin6_scope_id = at2->scopeid; } else #endif { struct sockaddr_in *sinp = (struct sockaddr_in *) (*pai)->ai_addr; memcpy(&sinp->sin_addr, at2->addr, sizeof(struct in_addr)); sinp->sin_port = st2->port; memset(sinp->sin_zero, '\0', sizeof(sinp->sin_zero)); } if (c) { (*pai)->ai_canonname = ((void *) (*pai) + sizeof(struct addrinfo) + socklen); strcpy((*pai)->ai_canonname, c); } else (*pai)->ai_canonname = NULL; (*pai)->ai_next = NULL; pai = &((*pai)->ai_next); } at2 = at2->next; } } return 0; } static struct gaih gaih[] = { #if __HAS_IPV6__ {PF_INET6, gaih_inet}, #endif {PF_INET, gaih_inet}, #if 0 {PF_LOCAL, gaih_local}, #endif {PF_UNSPEC, NULL} }; int getaddrinfo(const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) { int i = 0, j = 0, last_i = 0; struct addrinfo *p = NULL, **end; struct gaih *g = gaih, *pg = NULL; struct gaih_service gaih_service, *pservice; if (name != NULL && name[0] == '*' && name[1] == 0) name = NULL; if (service != NULL && service[0] == '*' && service[1] == 0) service = NULL; if (name == NULL && service == NULL) return EAI_NONAME; if (hints == NULL) hints = &default_hints; if (hints->ai_flags & ~(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG | AI_V4MAPPED | AI_ALL)) return EAI_BADFLAGS; if ((hints->ai_flags & AI_CANONNAME) && name == NULL) return EAI_BADFLAGS; if (service && service[0]) { char *c; gaih_service.name = service; gaih_service.num = strtoul(gaih_service.name, &c, 10); if (*c) gaih_service.num = -1; else /* * Can't specify a numerical socket unless a protocol * family was given. */ if (hints->ai_socktype == 0 && hints->ai_protocol == 0) return EAI_SERVICE; pservice = &gaih_service; } else pservice = NULL; if (pai) end = &p; else end = NULL; while (g->gaih) { if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC) { if ((hints->ai_flags & AI_ADDRCONFIG) && !addrconfig(g->family)) continue; j++; if (pg == NULL || pg->gaih != g->gaih) { pg = g; i = g->gaih(name, pservice, hints, end); if (i != 0) { last_i = i; if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC)) continue; if (p) freeaddrinfo(p); return -(i & GAIH_EAI); } if (end) while (*end) end = &((*end)->ai_next); } } ++g; } if (j == 0) return EAI_FAMILY; if (p) { *pai = p; return 0; } if (pai == NULL && last_i == 0) return 0; if (p) freeaddrinfo(p); return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *p; while (ai != NULL) { p = ai; ai = ai->ai_next; free(p); } } #define N_(x) x static struct { int code; const char *msg; } values[] = { { EAI_ADDRFAMILY, N_("Address family for hostname not supported")}, { EAI_AGAIN, N_("Temporary failure in name resolution")}, { EAI_BADFLAGS, N_("Bad value for ai_flags")}, { EAI_FAIL, N_("Non-recoverable failure in name resolution")}, { EAI_FAMILY, N_("ai_family not supported")}, { EAI_MEMORY, N_("Memory allocation failure")}, { EAI_NODATA, N_("No address associated with hostname")}, { EAI_NONAME, N_("Name or service not known")}, { EAI_SERVICE, N_("Servname not supported for ai_socktype")}, { EAI_SOCKTYPE, N_("ai_socktype not supported")}, { EAI_SYSTEM, N_("System error")}, { EAI_INPROGRESS, N_("Processing request in progress")}, { EAI_CANCELED, N_("Request canceled")}, { EAI_NOTCANCELED, N_("Request not canceled")}, { EAI_ALLDONE, N_("All requests done")}, { EAI_INTR, N_("Interrupted by a signal")} }; const char *gai_strerror(int code) { size_t i; for (i = 0; i < sizeof(values) / sizeof(values[0]); ++i) if (values[i].code == code) return (values[i].msg); return ("Unknown error"); } #endif /* HAVE_GETADDRINFO */ #ifndef HAVE_INET_NTOP /* char * * inet_ntop4(src, dst, size) * format an IPv4 address * return: * `dst' (as a const) * notes: * (1) uses no statics * (2) takes a u_char* not an in_addr as input * author: * Paul Vixie, 1996. */ static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size) { char tmp[sizeof("255.255.255.255") + 1] = "\0"; int octet; int i; i = 0; for (octet = 0; octet <= 3; octet++) { if (src[octet] > 255) { __set_errno(ENOSPC); return (NULL); } tmp[i++] = '0' + src[octet] / 100; if (tmp[i - 1] == '0') { tmp[i - 1] = '0' + (src[octet] / 10 % 10); if (tmp[i - 1] == '0') i--; } else { tmp[i++] = '0' + (src[octet] / 10 % 10); } tmp[i++] = '0' + src[octet] % 10; tmp[i++] = '.'; } tmp[i - 1] = '\0'; if (strlen(tmp) > size) { __set_errno(ENOSPC); return (NULL); } return strcpy(dst, tmp); } /* char * * inet_ntop(af, src, dst, size) * convert a network format address to presentation format. * return: * pointer to presentation format address (`dst'), or NULL (see errno). * author: * Paul Vixie, 1996. */ const char *inet_ntop(af, src, dst, size) int af; const void *src; char *dst; socklen_t size; { switch (af) { case AF_INET: return (inet_ntop4(src, dst, size)); #if __HAS_IPV6__ case AF_INET6: return (inet_ntop6(src, dst, size)); #endif default: __set_errno(EAFNOSUPPORT); return (NULL); } /* NOTREACHED */ } #endif /* HAVE_INET_NTOP */ #ifndef HAVE_INET_PTON /* int * inet_pton4(src, dst) * like inet_aton() but without all the hexadecimal and shorthand. * return: * 1 if `src' is a valid dotted quad, else 0. * notice: * does not touch `dst' unless it's returning 1. * author: * Paul Vixie, 1996. */ static int inet_pton4(const char *src, unsigned char *dst) { int saw_digit, octets, ch; unsigned char tmp[4], *tp; saw_digit = 0; octets = 0; *(tp = tmp) = 0; while ((ch = *src++) != '\0') { if (ch >= '0' && ch <= '9') { unsigned int new = *tp * 10 + (ch - '0'); if (new > 255) return (0); *tp = new; if (!saw_digit) { if (++octets > 4) return (0); saw_digit = 1; } } else if (ch == '.' && saw_digit) { if (octets == 4) return (0); *++tp = 0; saw_digit = 0; } else return (0); } if (octets < 4) return (0); memcpy(dst, tmp, 4); return (1); } /* int * inet_pton(af, src, dst) * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * return: * 1 if the address was valid for the specified address family * 0 if the address wasn't valid (`dst' is untouched in this case) * -1 if some other error occurred (`dst' is untouched in this case, too) * author: * Paul Vixie, 1996. */ int inet_pton(af, src, dst) int af; const char *src; void *dst; { switch (af) { case AF_INET: return (inet_pton4(src, dst)); #if __HAS_IPV6__ case AF_INET6: return (inet_pton6(src, dst)); #endif default: __set_errno(EAFNOSUPPORT); return (-1); } /* NOTREACHED */ } #endif /* HAVE_INET_PTON */ owfs-2.8p15/module/owshell/src/c/owget.c0000664000175000017500000000276511070534674015077 00000000000000/* $Id: owget.c,v 1.1 2008/09/30 23:43:56 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include "owshell.h" /* ---------------------------------------------- */ /* Command line parsing and result generation */ /* ---------------------------------------------- */ int main(int argc, char *argv[]) { int c; int paths_found = 0; int rc = -1; int dirall = 1; Setup(); /* process command line arguments */ while (1) { c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL); if (c == -1) { break; } owopt(c, optarg); } DefaultOwserver(); Server_detect(); /* non-option arguments */ while (optind < argc) { ++paths_found; if (dirall) { rc = ServerDirall(argv[optind]); if ( rc == -ENOTDIR ) { rc = ServerRead(argv[optind]); } else if (rc < 0) { dirall = 0; rc = ServerDir(argv[optind]); } } else { rc = ServerDir(argv[optind]); if ( rc == -ENOTDIR ) { rc = ServerRead(argv[optind]); } } ++optind; } // Was anything requested? if (paths_found == 0) { rc = ServerDirall("/"); if (rc < 0) { rc = ServerDir("/"); } } if ( rc >= 0 ) { errno = 0 ; Exit(0) ; } else { errno = -rc ; Exit(1) ; } return 0; // never reached } owfs-2.8p15/module/owshell/src/c/ow_help.c0000644000175000017500000000421311716516317015374 00000000000000/* $Id: ow_help.c,v 1.9 2012/02/14 17:41:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #include "owshell.h" void ow_help(void) { printf("\n1-wire access programs\n" "By Paul H Alfille and others. See http://www.owfs.org\n" "\n" "Command line access to owserver process\n" "\n" "Syntax: owdir [Options] -s Server DirPath\n" "Syntax: owread [Options] -s Server ReadPath\n" "Syntax: owwrite [Options] -s Server WritePath WriteVal\n" "Syntax: owpresent [Options] -s Server Path\n" "\n" "Server is an owserver net address (port number or ipaddress:port)\n" "\n" "Path is in OWFS format e.g. 10.2301A3008000/temperature\n" " more than one path (or path/value pair for owwrite) can be given\n" " each is processed in turn\n" "\n" "Options include:\n" " --autoserver |Use Bonjour (zeroconf) to find owserver\n" " -C --Celsius |Celsius(default) temperature scale\n" " -F --Fahrenheit |Fahrenheit temperature scale\n" " -K --Kelvin |Kelvin temperature scale\n" " -R --Rankine |Rankine temperature scale\n" " -f --format |format for 1-wire unique serial IDs display\n" " | f[.]i[[.]c] f-amily i-d c-rc (all in hex)\n" " --hex |data in hexidecimal format\n" " --size |size of data in bytes\n" " --offset |start of read/write in field\n" " --dir |add a trailing '/' for directories\n" " -V --version |Program version\n" " -q --quiet |suppress error messages\n" " -h --help |Basic help page\n" ); } owfs-2.8p15/module/owshell/src/c/globals.c0000664000175000017500000000217511546746362015377 00000000000000/* $Id: globals.c,v 1.12 2011/04/06 02:16:18 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include "owshell.h" /* Globals for port and bus communication */ /* connections globals stored in ow_connect.c */ /* i.e. connection_in * owserver_connection ... */ struct global Globals; /* Globals */ int count_inbound_connections = 0; struct connection_in s_owserver_connection; struct connection_in *owserver_connection = &s_owserver_connection; /* All ow library setup */ void Setup(void) { #if OW_ZERO OW_Load_dnssd_library(); #endif memset(owserver_connection, 0, sizeof(s_owserver_connection)); // global structure of configuration parameters memset(&Globals, 0, sizeof(struct global)); Globals.timeout_network = 1; errno = 0; /* set error level none */ } static void Cleanup(void) { #if OW_ZERO OW_Free_dnssd_library(); #endif } void Exit(int exit_code) { Cleanup(); exit(exit_code); } owfs-2.8p15/module/owshell/src/c/Makefile.am0000644000175000017500000000221511731463644015630 00000000000000# $Id: Makefile.am,v 1.18 2012/03/13 00:06:35 alfille Exp $ COMMON_OWSHELL_SOURCE = ow_opt.c \ ow_help.c \ ow_server.c \ ow_net.c \ ow_browse.c \ ow_dl.c \ ow_dnssd.c \ ow_tcp_read.c\ getaddrinfo.c\ getopt.c \ globals.c bin_PROGRAMS = owget owdir owread owwrite owpresent owexist owget_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owget.c owdir_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owdir.c owread_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owread.c owwrite_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owwrite.c owpresent_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owpresent.c owexist_SOURCES = ${COMMON_OWSHELL_SOURCE} \ owexist.c AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} LDADD = ${LD_EXTRALIBS} ${OSLIBS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owshell/src/c/ow_tcp_read.c0000664000175000017500000000420610750074151016221 00000000000000/* $Id: ow_tcp_read.c,v 1.7 2008/01/30 13:15:21 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include "owshell.h" /* Read "n" bytes from a descriptor. */ /* Stolen from Unix Network Programming by Stevens, Fenner, Rudoff p89 */ ssize_t tcp_read(int file_descriptor, void *vptr, size_t n, const struct timeval *ptv) { size_t nleft; ssize_t nread; char *ptr; //printf("NetRead attempt %d bytes Time:(%ld,%ld)\n",n,ptv->tv_sec,ptv->tv_usec ) ; ptr = vptr; nleft = n; while (nleft > 0) { int rc; fd_set readset; struct timeval tv = { ptv->tv_sec, ptv->tv_usec, }; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); /* Read if it doesn't timeout first */ rc = select(file_descriptor + 1, &readset, NULL, NULL, &tv); if (rc > 0) { /* Is there something to read? */ if (FD_ISSET(file_descriptor, &readset) == 0) { return -EIO; /* error */ } //update_max_delay(pn); if ((nread = read(file_descriptor, ptr, nleft)) < 0) { if (errno == EINTR) { errno = 0; // clear errno. We never use it anyway. nread = 0; /* and call read() again */ } else { //ERROR_DATA("Network data read error\n"); return (-1); } } else if (nread == 0) { break; /* EOF */ } //{ int i ; for ( i=0 ; i= 0 */ } owfs-2.8p15/module/owshell/src/c/ow_net.c0000664000175000017500000000674411236022666015243 00000000000000/* $Id: ow_net.c,v 1.12 2009/08/04 12:12:38 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include "owshell.h" void DefaultOwserver(void) { #if OW_ZERO if (count_inbound_connections == 0) { // OW_Browse() ; } #endif /* OW_ZERO */ if (count_inbound_connections == 0) { ARG_Net(OWSERVER_DEFAULT_PORT); } } int ClientAddr(char *sname) { struct addrinfo hint; char *p; int ret; if (sname == NULL || sname[0] == '\0') { /* probably not a good idea to set localhost:DEFAULT_PORT * The user have probably typed wrong address */ owserver_connection->host = NULL; owserver_connection->service = strdup(OWSERVER_DEFAULT_PORT); } else if ((p = strrchr(sname, ':')) == NULL) { /* : NOT exist */ if (strchr(sname, '.') || isalpha(sname[0])) { //probably an address owserver_connection->host = strdup(sname); owserver_connection->service = strdup(OWSERVER_DEFAULT_PORT); } else { // assume a port owserver_connection->host = NULL; owserver_connection->service = strdup(sname); } } else { p[0] = '\0'; /* Separate tokens in the string */ owserver_connection->host = strdup(sname); p[0] = ':'; /* restore name string */ owserver_connection->service = strdup(&p[1]); } memset(&hint, 0, sizeof(struct addrinfo)); hint.ai_socktype = SOCK_STREAM; #if OW_CYGWIN hint.ai_family = AF_INET; if(owserver_connection->host == NULL) { /* getaddrinfo doesn't work with host=NULL for cygwin */ owserver_connection->host = strdup("127.0.0.1"); } #else hint.ai_family = AF_UNSPEC; #endif //printf("ClientAddr: [%s] [%s]\n", owserver_connection->host, owserver_connection->service); if ((ret = getaddrinfo(owserver_connection->host, owserver_connection->service, &hint, &owserver_connection->ai))) { //LEVEL_CONNECT("GetAddrInfo error %s\n",gai_strerror(ret)); return -1; } return 0; } /* Usually called with BUS locked, to protect ai settings */ int ClientConnect(void) { int file_descriptor; struct addrinfo *ai; if (owserver_connection->ai == NULL) { //LEVEL_DEBUG("Client address not yet parsed\n"); return -1; } /* Can't change ai_ok without locking the in-device. * First try the last working address info, if it fails lock * the in-device and loop through the list until it works. * Not a perfect solution, but it should work at least. */ ai = owserver_connection->ai_ok; if (ai) { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (file_descriptor >= 0) { if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) return file_descriptor; close(file_descriptor); } } ai = owserver_connection->ai; // loop from first address info since it failed. do { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (file_descriptor >= 0) { if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) { owserver_connection->ai_ok = ai; return file_descriptor; } close(file_descriptor); } } while ((ai = ai->ai_next)); owserver_connection->ai_ok = NULL; //ERROR_CONNECT("ClientConnect: Socket problem\n") ; return -1; } owfs-2.8p15/module/owshell/Makefile.in0000664000175000017500000005116211756250030014625 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owshell DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owshell/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owshell/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owshell/Makefile.am0000664000175000017500000000005710504773621014617 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/Makefile.in0000664000175000017500000005307311756250026013160 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = owshell ownet owlib owhttpd owserver owfs owftpd owcapi \ owtap owmon swig owtcl DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @ENABLE_OWSHELL_TRUE@MODULE_SUBDIR_OWSHELL = owshell @ENABLE_OWLIB_TRUE@MODULE_SUBDIR_OWLIB = owlib @ENABLE_OWHTTPD_TRUE@MODULE_SUBDIR_OWHTTPD = owhttpd @ENABLE_OWEXTERNAL_TRUE@MODULE_SUBDIR_OWSERVER = owserver @ENABLE_OWSERVER_TRUE@MODULE_SUBDIR_OWSERVER = owserver @ENABLE_OWFS_TRUE@MODULE_SUBDIR_OWFS = owfs @ENABLE_OWFTPD_TRUE@MODULE_SUBDIR_OWFTPD = owftpd @ENABLE_OWCAPI_TRUE@MODULE_SUBDIR_OWCAPI = owcapi @ENABLE_OWNET_TRUE@MODULE_SUBDIR_OWNET = ownet @ENABLE_OWTAP_TRUE@MODULE_SUBDIR_OWTAP = owtap @ENABLE_OWMON_TRUE@MODULE_SUBDIR_OWMON = owmon @ENABLE_SWIG_TRUE@MODULE_SUBDIR_SWIG = swig @ENABLE_OWTCL_TRUE@MODULE_SUBDIR_OWTCL = owtcl SUBDIRS = $(MODULE_SUBDIR_OWSHELL) $(MODULE_SUBDIR_OWNET) $(MODULE_SUBDIR_OWLIB) $(MODULE_SUBDIR_OWHTTPD) $(MODULE_SUBDIR_OWSERVER) $(MODULE_SUBDIR_OWFS) $(MODULE_SUBDIR_OWFTPD) $(MODULE_SUBDIR_OWCAPI) $(MODULE_SUBDIR_OWTAP) $(MODULE_SUBDIR_OWMON) $(MODULE_SUBDIR_SWIG) $(MODULE_SUBDIR_OWTCL) all: all-recursive .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 module/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owcapi/0000775000175000017500000000000011756315511012446 500000000000000owfs-2.8p15/module/owcapi/src/0000775000175000017500000000000011756315511013235 500000000000000owfs-2.8p15/module/owcapi/src/example++/0000775000175000017500000000000011756315511015016 500000000000000owfs-2.8p15/module/owcapi/src/example++/Makefile0000664000175000017500000000132711756250044016400 00000000000000# Makefile for owcapi example program -- invoked separately from this directory # $Id: Makefile.in,v 1.2 2009/03/24 17:20:09 alfille Exp $ CXXFLAGS = -g -I/opt/owfs/include -Wno-deprecated OBJS = owcapiexample.o all: owcapiexample ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L/opt/owfs/lib -lowcapi -low -L/usr/lib/x86_64-linux-gnu -lusb owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lowcapi owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lstdc++ endif #%.o: %.cpp # g++ $(CXXFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ Makefile owfs-2.8p15/module/owcapi/src/example++/owcapiexample.cpp0000664000175000017500000000736711206734612020312 00000000000000#include #include #include #include #include const char DEFAULT_ARGV[] = "--fake 28 --fake 10"; const char DEFAULT_PATH[] = "/"; /* Takes a path and filename and prints the 1-wire value */ /* makes sure the bridging "/" in the path is correct */ /* watches for total length and free allocated space */ void GetValue( const char * path, const char * name ) { char fullpath[PATH_MAX+1] ; int length_left = PATH_MAX ; char * get_buffer ; ssize_t get_return; size_t get_length ; /* Check arguments and lengths */ if ( path==NULL || strlen(path)==0) { path = "/" ; } if ( name==NULL ) { name = "" ; } fullpath[PATH_MAX] = '\0' ; // make sure final 0 byte strncpy(fullpath, path, length_left) ; length_left -= strlen(fullpath) ; if ( length_left > 0 ) { if ( fullpath[PATH_MAX-length_left-1] != '/' ) { strcat(fullpath, "/" ) ; --length_left ; } } if ( name[0] == '/' ) { ++name ; } strncpy(&fullpath[PATH_MAX-length_left], name, length_left) ; get_return = OW_get( fullpath, &get_buffer, &get_length ) ; if ( get_return < 0 ) { printf("ERROR (%d) reading %s (%s)\n",errno,fullpath,strerror(errno)) ; } else { printf("%s has value %s (%d bytes)\n",fullpath,get_buffer,(int)get_length); free(get_buffer); } } int main(int argc, char **argv) { const char *path = DEFAULT_PATH; ssize_t dir_return ; char *dir_buffer = NULL; char *dir_buffer_copy = NULL; size_t dir_length ; char ** d_buffer ; char * dir_member ; cout << "C++ example" << endl; /* ------------- INITIALIZATIOB ------------------ */ /* steal first argument and treat it as a path (if not beginning with '-') */ if ((argc > 1) && (argv[1][0] != '-')) { path = argv[1]; argv = &argv[1]; argc--; } if (argc < 2) { printf("Starting with extra parameter \"%s\" as default\n", DEFAULT_ARGV); if ( OW_init(DEFAULT_ARGV) < 0) { printf("OW_init error = %d (%s)\n",errno,strerror(errno)) ; goto cleanup; } } else { if ( OW_init_args(argc, argv) < 0) { printf("OW_init error = %d (%s)\n",errno,strerror(errno)) ; goto cleanup; } } /* ------------- DIRECTORY PATH ------------------ */ dir_return = OW_get( path, &dir_buffer, &dir_length ) ; if ( dir_return < 0 ) { printf("DIRECTORY ERROR (%d) reading %s (%s)\n",errno,path,strerror(errno)) ; goto cleanup; } else { printf("Directory %s has members %s (%d bytes)\n",path, dir_buffer, (int)dir_length); } printf("\n"); /* ------------- GO THROUGH DIR ------------------ */ d_buffer = &dir_buffer ; dir_buffer_copy = dir_buffer; while ( (dir_member=strsep(d_buffer,","))!=NULL ) { switch ( dir_member[0] ) { case '1': if ( dir_member[1] == '0' ) { // DS18S20 (family code 10) GetValue(dir_member, "temperature") ; } //fall through case '0': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': { GetValue(dir_member, "type") ; } break ; default: break ; } } /* ------------- STATIC PATHS ------------------ */ GetValue("system/process", "pid" ); GetValue("badPath", "badName" ) ; cleanup: /* ------------- DONE -- CLEANUP ----------------- */ OW_finish(); if (dir_buffer_copy) { free(dir_buffer_copy); dir_buffer_copy = NULL; } return 0 ; } owfs-2.8p15/module/owcapi/src/example++/Makefile.example0000664000175000017500000000130011024217533020013 00000000000000# Makefile for owcapi example program -- invoked separately from this directory # $Id: Makefile.example,v 1.1 2008/06/12 13:06:35 d1mag Exp $ CXXFLAGS = -g -I/opt/owfs/include -Wno-deprecated OBJS = owcapiexample.o all: owcapiexample ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L/opt/owfs/lib -lowcapi -low -L/usr/lib -lusb owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lowcapi owcapiexample: $(OBJS) g++ $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lstdc++ endif #%.o: %.cpp # g++ $(CXXFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ owfs-2.8p15/module/owcapi/src/example++/Makefile.in0000664000175000017500000000127711162213111016772 00000000000000# Makefile for owcapi example program -- invoked separately from this directory # $Id: Makefile.in,v 1.2 2009/03/24 17:20:09 alfille Exp $ CXXFLAGS = -g -I@prefix@/include -Wno-deprecated OBJS = owcapiexample.o all: owcapiexample ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L@prefix@/lib -lowcapi -low @LIBUSB_LIBS@ owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L@prefix@/lib -Wl,--rpath -Wl,@prefix@/lib -lowcapi owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lstdc++ endif #%.o: %.cpp # g++ $(CXXFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ Makefile owfs-2.8p15/module/owcapi/src/Makefile.in0000664000175000017500000005160411756250026015227 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owcapi/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include # don't want to add the example as a subdirectory right now... EXTRA_DIST = example++/owcapiexample.cpp example++/Makefile.example example++/Makefile example++/Makefile.in example/owcapiexample.c example/Makefile.example example/Makefile example/Makefile.in all: all-recursive .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 module/owcapi/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owcapi/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owcapi/src/example/0000775000175000017500000000000011756315511014670 500000000000000owfs-2.8p15/module/owcapi/src/example/Makefile0000664000175000017500000000126711756250044016255 00000000000000# Makefile for owcapi example program -- invoked separately from this directory # $Id: Makefile.in,v 1.11 2009/03/24 17:20:08 alfille Exp $ CFLAGS = -g -I/opt/owfs/include OBJS = owcapiexample.o all: owcapiexample ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L/opt/owfs/lib -lowcapi -low -L/usr/lib/x86_64-linux-gnu -lusb owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lowcapi owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) endif %.o: %.c gcc $(CFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ Makefile owfs-2.8p15/module/owcapi/src/example/Makefile.example0000664000175000017500000000043510535253372017704 00000000000000 LDFLAGS = -L/opt/owfs/lib -Wl,--rpath -Wl,/opt/owfs/lib -lowcapi CFLAGS = -g -I/opt/owfs/include OBJS = owcapiexample.o all: owcapiexample owcapiexample: $(OBJS) gcc $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) %.o: %.c gcc $(CFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ owfs-2.8p15/module/owcapi/src/example/owcapiexample.c0000664000175000017500000000642511206734611017615 00000000000000#include #include #include #include #include #include const char DEFAULT_ARGV[] = "--fake 28 --fake 10"; const char DEFAULT_PATH[] = "/"; /* Takes a path and filename and prints the 1-wire value */ /* makes sure the bridging "/" in the path is correct */ /* watches for total length and free allocated space */ void GetValue(const char *path, const char *name) { char fullpath[PATH_MAX + 1]; int length_left = PATH_MAX; char *get_buffer; ssize_t get_return; size_t get_length; /* Check arguments and lengths */ if (path == NULL || strlen(path) == 0) { path = "/"; } if (name == NULL) { name = ""; } fullpath[PATH_MAX] = '\0'; // make sure final 0 byte strncpy(fullpath, path, length_left); length_left -= strlen(fullpath); if (length_left > 0) { if (fullpath[PATH_MAX - length_left - 1] != '/') { strcat(fullpath, "/"); --length_left; } } if (name[0] == '/') { ++name; } strncpy(&fullpath[PATH_MAX - length_left], name, length_left); get_return = OW_get(fullpath, &get_buffer, &get_length); if (get_return < 0) { printf("ERROR (%d) reading %s (%s)\n", errno, fullpath, strerror(errno)); } else { printf("%s has value %s (%d bytes)\n", fullpath, get_buffer, (int) get_length); free(get_buffer); } } int main(int argc, char **argv) { const char *path = DEFAULT_PATH; ssize_t dir_return; char *dir_buffer = NULL; char *dir_buffer_copy = NULL; size_t dir_length; char **d_buffer; char *dir_member; /* ------------- INITIALIZATIOB ------------------ */ /* steal first argument and treat it as a path (if not beginning with '-') */ if ((argc > 1) && (argv[1][0] != '-')) { path = argv[1]; argv = &argv[1]; argc--; } if (argc < 2) { printf("Starting with extra parameter \"%s\" as default\n", DEFAULT_ARGV); if (OW_init(DEFAULT_ARGV) < 0) { printf("OW_init error = %d (%s)\n", errno, strerror(errno)); goto cleanup; } } else { if (OW_init_args(argc, argv) < 0) { printf("OW_init error = %d (%s)\n", errno, strerror(errno)); goto cleanup; } } /* ------------- DIRECTORY PATH ------------------ */ dir_return = OW_get(path, &dir_buffer, &dir_length); if (dir_return < 0) { printf("DIRECTORY ERROR (%d) reading %s (%s)\n", errno, path, strerror(errno)); goto cleanup; } else { printf("Directory %s has members %s (%d bytes)\n", path, dir_buffer, (int) dir_length); } printf("\n"); /* ------------- GO THROUGH DIR ------------------ */ d_buffer = &dir_buffer; dir_buffer_copy = dir_buffer; while ((dir_member = strsep(d_buffer, ",")) != NULL) { switch (dir_member[0]) { case '1': if (dir_member[1] == '0') { // DS18S20 (family code 10) GetValue(dir_member, "temperature"); } //fall through case '0': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': { GetValue(dir_member, "type"); } break; default: break; } } /* ------------- STATIC PATHS ------------------ */ GetValue("system/process", "pid"); GetValue("badPath", "badName"); cleanup: /* ------------- DONE -- CLEANUP ----------------- */ OW_finish(); if (dir_buffer_copy) { free(dir_buffer_copy); dir_buffer_copy = NULL; } return 0; } owfs-2.8p15/module/owcapi/src/example/Makefile.in0000664000175000017500000000124011162213110016631 00000000000000# Makefile for owcapi example program -- invoked separately from this directory # $Id: Makefile.in,v 1.11 2009/03/24 17:20:08 alfille Exp $ CFLAGS = -g -I@prefix@/include OBJS = owcapiexample.o all: owcapiexample ifeq "$(shell uname)" "Darwin" # Compile-flags for MacOSX DARWINLDFLAGS = -L@prefix@/lib -lowcapi -low @LIBUSB_LIBS@ owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(DARWINLDFLAGS) else # Compile-flags for Linux and Cygwin LDFLAGS = -L@prefix@/lib -Wl,--rpath -Wl,@prefix@/lib -lowcapi owcapiexample: $(OBJS) gcc $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) endif %.o: %.c @CC@ $(CFLAGS) -c -o $@ $< clean: $(RM) -f owcapiexample *.o *~ .~ Makefile owfs-2.8p15/module/owcapi/src/Makefile.am0000664000175000017500000000047111024230636015203 00000000000000SUBDIRS = c include # don't want to add the example as a subdirectory right now... EXTRA_DIST = example++/owcapiexample.cpp example++/Makefile.example example++/Makefile example++/Makefile.in example/owcapiexample.c example/Makefile.example example/Makefile example/Makefile.in clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owcapi/src/include/0000775000175000017500000000000011756315511014660 500000000000000owfs-2.8p15/module/owcapi/src/include/owcapi.h0000664000175000017500000000736611131152075016236 00000000000000/* $Id: owcapi.h,v 1.14 2009/01/07 16:11:41 d1mag Exp $ OWFS (owfs, owhttpd, owserver, owperl, owtcl, owphp, owpython, owcapi) one-wire file system and related programs By Paul H Alfille {c} 2003-5 GPL palfille@earthlink.net */ /* OWCAPI - specific header */ /* OWCAPI is the simple C library for OWFS */ /* Commands OW_init, OW_get, OW_put, OW_finish */ #ifndef OWCAPI_H #define OWCAPI_H #include #include #ifdef __cplusplus extern "C" { #endif /* initialization, required before any other calls. Should be paired with a finish OW_init -- simplest, just a device name /dev/ttyS0 for serial u or u# for USB #### for TCP/IP port (owserver) OW_init_string -- looks just like the command line to owfs or owhttpd OW_init_args -- char** array usually from the main() call return value = 0 good < 0 error No need to call OW_finish if an error */ ssize_t OW_init(const char *params); ssize_t OW_init_args(int argc, char **args); void OW_set_error_level(const char *params); void OW_set_error_print(const char *params); /* OW_get -- data read or directory read path is OWFS style name, "" or "/" for root directory "01.23456708ABDE" for device directory "10.468ACE13579B/temperature for a specific device property buffer is a char buffer that is allocated by OW_get. buffer MUST BE "free"ed after use. buffer_length, if not NULL, will be assigned the length of the returned data If path is NULL, it is assumed to be "/" the root directory If path is not a valid C string, the results are unpredictable. If buffer is NULL, an error is returned If buffer_length is NULL it is ignored return value >=0 ok, length of information returned (in bytes) <0 error */ ssize_t OW_get(const char *path, char **buffer, size_t * buffer_length); /* OW_present -- check if path is present path is OWFS style name, "" or "/" for root directory "01.23456708ABDE" for device directory "10.468ACE13579B/temperature for a specific device property return value = 0 ok < 0 error */ int OW_present(const char *path); /* OW_put -- data write path is OWFS style name, "05.468ACE13579B/PIO.A for a specific device property buffer holds the value ascii, possibly comma delimitted Note NULL path or buffer will return an error. Note: path must be null-terminated Note: buffer_length will be used for length, there is no requirement that buffer be null-terminated return value = 0 ok < 0 error */ ssize_t OW_put(const char *path, const char *buffer, size_t buffer_length); /* OW_lread -- read data with offset path is OWFS style name, "05.468ACE13579B/PIO.A for a specific device property buffer holds the value ascii, possibly comma delimitted buffer must be size long offset is from start of value only ascii and binary data appropriate */ ssize_t OW_lread(const char *path, char *buf, const size_t size, const off_t offset); /* OW_lwrite -- write data with offset path is OWFS style name, "05.468ACE13579B/PIO.A for a specific device property buffer holds the value ascii, possibly comma delimitted buffer must be size long offset is from start of value only ascii and binary data appropriate */ ssize_t OW_lwrite(const char *path, const char *buf, const size_t size, const off_t offset); /* cleanup Clears internal buffer, frees file descriptors Normal process cleanup will work if program ends before OW_finish is called But not calling OW_init more than once without an intervening OW_finish will cause a memory leak No error return */ void OW_finish(void); #ifdef __cplusplus } #endif #endif /* OWCAPI_H */ owfs-2.8p15/module/owcapi/src/include/Makefile.in0000664000175000017500000003735411756250027016661 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owcapi/src/include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(headerdir)" DATA = $(header_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ headerdir = ${prefix}/include header_DATA = owcapi.h EXTRA_DIST = ${header_DATA} 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 module/owcapi/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owcapi/src/include/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-headerDATA: $(header_DATA) @$(NORMAL_INSTALL) test -z "$(headerdir)" || $(MKDIR_P) "$(DESTDIR)$(headerdir)" @list='$(header_DATA)'; test -n "$(headerdir)" || 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)$(headerdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(headerdir)" || exit $$?; \ done uninstall-headerDATA: @$(NORMAL_UNINSTALL) @list='$(header_DATA)'; test -n "$(headerdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(headerdir)'; $(am__uninstall_files_from_dir) 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 $(DATA) installdirs: for dir in "$(DESTDIR)$(headerdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-headerDATA 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: uninstall-headerDATA .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-headerDATA 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 uninstall-headerDATA clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owcapi/src/include/Makefile.am0000664000175000017500000000016310432627750016635 00000000000000headerdir = ${prefix}/include header_DATA = owcapi.h EXTRA_DIST = ${header_DATA} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owcapi/src/c/0000775000175000017500000000000011756315511013457 500000000000000owfs-2.8p15/module/owcapi/src/c/Makefile.in0000664000175000017500000005301411756250026015446 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.19 2011/05/31 14:04:49 alfille Exp $ 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@ target_triplet = @target@ subdir = module/owcapi/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libowcapi_la_LIBADD = am_libowcapi_la_OBJECTS = owcapi.lo libowcapi_la_OBJECTS = $(am_libowcapi_la_OBJECTS) libowcapi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libowcapi_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libowcapi_la_SOURCES) DIST_SOURCES = $(libowcapi_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ libowcapi_la_DEPENDENCIES = ../../../owlib/src/c/libow.la lib_LTLIBRARIES = libowcapi.la libowcapi_la_SOURCES = owcapi.c @HAVE_CYGWIN_FALSE@@HAVE_DEBIAN_FALSE@libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS} -shared -shrext .so # Debian patch @HAVE_CYGWIN_FALSE@@HAVE_DEBIAN_TRUE@libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so @HAVE_CYGWIN_TRUE@libowcapi_la_LDFLAGS = -low ${LD_EXTRALIBS} -shared -no-undefined AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} \ ${PIC_FLAGS} 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 module/owcapi/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owcapi/src/c/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 libowcapi.la: $(libowcapi_la_OBJECTS) $(libowcapi_la_DEPENDENCIES) $(EXTRA_libowcapi_la_DEPENDENCIES) $(libowcapi_la_LINK) -rpath $(libdir) $(libowcapi_la_OBJECTS) $(libowcapi_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owcapi.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-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-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-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-libLTLIBRARIES clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owcapi/src/c/Makefile.am0000664000175000017500000000176111571172601015434 00000000000000# $Id: Makefile.am,v 1.19 2011/05/31 14:04:49 alfille Exp $ libowcapi_la_DEPENDENCIES = ../../../owlib/src/c/libow.la lib_LTLIBRARIES = libowcapi.la libowcapi_la_SOURCES = owcapi.c if HAVE_CYGWIN libowcapi_la_LDFLAGS = -low ${LD_EXTRALIBS} -shared -no-undefined else if HAVE_DEBIAN # Debian patch libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so else libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS} -shared -shrext .so endif endif AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} \ ${PIC_FLAGS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owcapi/src/c/owcapi.c0000644000175000017500000001033111673511272015021 00000000000000/* $Id: owcapi.c,v 1.54 2011/12/19 01:26:18 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions COM - serial port functions DS2480 -- DS9097 serial connector Written 2003 Paul H Alfille */ #include #include "owfs_config.h" #include "ow.h" #include "owcapi.h" #include #define MAX_ARGS 20 static ssize_t ReturnAndErrno(ssize_t ret) { if (ret < 0) { errno = -ret; return -1; } else { errno = 0; return ret; } } void OW_set_error_print(const char *params) { API_set_error_print(params); } void OW_set_error_level(const char *params) { API_set_error_level(params); } ssize_t OW_init(const char *params) { /* Set up owlib */ API_setup(program_type_clibrary); /* Proceed with init while lock held */ /* grab our executable name */ Globals.progname = owstrdup("OWCAPI"); if ( BAD( API_init(params) ) ) { API_finish(); return ReturnAndErrno(-EINVAL) ; } return ReturnAndErrno(0); } ssize_t OW_init_args(int argc, char **argv) { /* Set up owlib */ API_setup(program_type_clibrary); /* grab our executable name */ if (argc > 0) { Globals.progname = owstrdup(argv[0]); } // process the command line flags do { int c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL) ; if ( c == -1 ) { break ; } if ( BAD( owopt(c, optarg) ) ) { // clean up and exit API_finish() ; return ReturnAndErrno( -EINVAL ) ; } } while ( 1 ) ; /* non-option arguments */ while (optind < argc) { if ( BAD( ARG_Generic(argv[optind]) ) ) { // clean up and exit API_finish() ; return ReturnAndErrno( -EINVAL ) ; } ++optind; } if ( BAD( API_init(NULL) ) ) { // clean up and exit API_finish() ; return ReturnAndErrno( -EINVAL ) ; } return ReturnAndErrno(0); } /* Get a value, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ /* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ ssize_t OW_get(const char *path, char **return_buffer, size_t * buffer_length) { SIZE_OR_ERROR size_or_error = -EACCES ; /* current buffer string length */ if (API_access_start() == 0) { /* Check for prior init */ size_or_error = FS_get( path, return_buffer, buffer_length ); API_access_end(); } return ReturnAndErrno(size_or_error); } int OW_present(const char *path) { ssize_t ret = -ENOENT; /* current buffer string length */ if (API_access_start() == 0) { /* Check for prior init */ struct parsedname s_pn ; if (FS_ParsedName(path, &s_pn) != 0) { /* Can we parse the path string */ ret = -ENOENT; } else { FS_ParsedName_destroy(&s_pn); } API_access_end(); } return ReturnAndErrno(ret); } ssize_t OW_lread(const char *path, char *buffer, const size_t size, const off_t offset) { ssize_t ret = -EACCES; /* current buffer string length */ /* Check the parameters */ if (buffer == NULL || path == NULL) { return ReturnAndErrno(-EINVAL); } if (API_access_start() == 0) { ret = FS_read(path, buffer, size, offset); API_access_end(); } return ReturnAndErrno(ret); } ssize_t OW_lwrite(const char *path, const char *buffer, const size_t size, const off_t offset) { ssize_t ret = -EACCES; /* current buffer string length */ /* Check the parameters */ if (buffer == NULL || path == NULL) { return ReturnAndErrno(-EINVAL); } if (API_access_start() == 0) { ret = FS_write(path, buffer, size, offset); API_access_end(); } return ReturnAndErrno(ret); } ssize_t OW_put(const char *path, const char *buffer, size_t buffer_length) { ssize_t ret = -EACCES; /* Check the parameters */ if (buffer == NULL || path == NULL) { return ReturnAndErrno(-EINVAL); } /* Check that we have done init, and that we can access */ if (API_access_start() == 0) { ret = FS_write(path, buffer, buffer_length, 0); API_access_end(); } return ReturnAndErrno(ret); } void OW_finish(void) { SAFEFREE(Globals.progname); API_finish(); } owfs-2.8p15/module/owcapi/Makefile.in0000664000175000017500000005115711756250026014443 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owcapi DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owcapi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owcapi/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owcapi/Makefile.am0000664000175000017500000000005710432627750014425 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owserver/0000775000175000017500000000000011756315510013037 500000000000000owfs-2.8p15/module/owserver/src/0000775000175000017500000000000011756315510013626 500000000000000owfs-2.8p15/module/owserver/src/Makefile.in0000664000175000017500000005120711756250030015613 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owserver/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include c all: all-recursive .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 module/owserver/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owserver/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owserver/src/Makefile.am0000664000175000017500000000006510504776327015612 00000000000000SUBDIRS = include c clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owserver/src/include/0000775000175000017500000000000011756315510015251 500000000000000owfs-2.8p15/module/owserver/src/include/owserver.h0000644000175000017500000000507511734375043017226 00000000000000/* $Id: owserver.h,v 1.32 2012/03/27 17:34:27 alfille Exp $ OWFS and OWHTTPD one-wire file system and one-wire web server By Paul H Alfille {c} 2003 GPL palfille@earthlink.net */ /* OWSERVER - specific header */ #ifndef OWSERVER_H #define OWSERVER_H #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" pthread_mutex_t persistence_mutex ; #define PERSISTENCELOCK _MUTEX_LOCK( persistence_mutex ) ; #define PERSISTENCEUNLOCK _MUTEX_UNLOCK( persistence_mutex ) ; #define TOCLIENTLOCK(hd) _MUTEX_LOCK( (hd)->to_client ) #define TOCLIENTUNLOCK(hd) _MUTEX_UNLOCK( (hd)->to_client ) enum toclient_state { toclient_postping , // also initial state toclient_postmessage, // only for interme4diate messages like DIR entries toclient_complete, // final payload has been sent } ; // this structure holds the data needed for the handler function called in a separate thread by the ping wrapper struct handlerdata { int file_descriptor; int persistent; pthread_mutex_t to_client; int ping_pipe[2] ; enum toclient_state toclient ; struct timeval tv; struct server_msg sm; struct serverpackage sp; }; /* read from client, free return pointer if not Null */ int FromClient(struct handlerdata *hd); /* Send fully configured message back to client */ int ToClient(int file_descriptor, struct client_msg *cm, char *data); /* Read from 1-wire bus and return file contents */ void *ReadHandler(struct handlerdata *hd, struct client_msg *cm, struct one_wire_query *owq); /* write a new value ot a 1-wire device */ void WriteHandler(struct handlerdata *hd, struct client_msg *cm, struct one_wire_query *owq); /* Clasic directory -- one value at a time */ void DirHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn); /* Newer directory-at-once */ void *DirallHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn); /* Newer directory-at-once with directory '/' */ void *DirallslashHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn); /* Handle the actual request -- pings handled higher up */ void *DataHandler(void *v); /* Handle a client request, including timeout pings */ void Handler(FILE_DESCRIPTOR_OR_ERROR file_descriptor); /* Send a response to client of an error */ void ErrorToClient(struct handlerdata *hd, struct client_msg * cm ) ; #if OW_MT /* Send a timeout ping */ void PingClient(struct handlerdata *hd); /* Loop waiting for finish sending pings */ void PingLoop(struct handlerdata *hd) ; #endif /* OW_MT */ #endif /* OWSERVER_H */ owfs-2.8p15/module/owserver/src/include/Makefile.in0000664000175000017500000003662111756250030017241 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owserver/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = owserver.h 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 module/owserver/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owserver/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owserver/src/include/Makefile.am0000644000175000017500000000007611734230002017212 00000000000000noinst_HEADERS = owserver.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owserver/src/c/0000775000175000017500000000000011756315510014050 500000000000000owfs-2.8p15/module/owserver/src/c/ping.c0000644000175000017500000000353111734233470015071 00000000000000/* $Id: ping.c,v 1.3 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" #if OW_MT // Handler for multithreaded approach -- with ping /* * Routine for handling a single request returns 0 if ok, else non-zero for error */ struct client_msg ping_cm = { .version = 0 , .payload = -1 , .ret = 0 , .control_flags = 0 , .size = 0 , .offset = 0 , }; void PingClient(struct handlerdata *hd) { ToClient(hd->file_descriptor, &ping_cm, NULL); // send the ping } #endif /* OW_MT */ owfs-2.8p15/module/owserver/src/c/data.c0000644000175000017500000001555211734233470015053 00000000000000/* $Id: data.c,v 1.51 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* * lower level routine for actually handling a request * deals with data (ping is handled higher) */ void *DataHandler(void *v) { struct handlerdata *hd = v; char *retbuffer = NULL; struct client_msg cm; // the return message #if OW_CYGWIN /* Random generator seem to need initialization for each new thread * If not, seed will be reset and rand() will return 0 the first call. */ { struct timeval tv; gettimeofday(&tv, NULL); srand((unsigned int) tv.tv_usec); } #endif memset(&cm, 0, sizeof(struct client_msg)); cm.version = MakeServerprotocol(OWSERVER_PROTOCOL_VERSION); cm.control_flags = hd->sm.control_flags; // default flag return -- includes persistence state /* Pre-handling for special testing mode to exclude certain messages */ switch ((enum msg_classification) hd->sm.type) { case msg_dirall: case msg_dirallslash: if (Globals.no_dirall) { LEVEL_DEBUG("DIRALL message rejected.") ; hd->sm.type = msg_error; } break; case msg_get: case msg_getslash: if (Globals.no_get) { LEVEL_DEBUG("GET message rejected.") ; hd->sm.type = msg_error; } break; default: break; } /* Now Check message types and only parse valid messages */ switch ((enum msg_classification) hd->sm.type) { // outer switch case msg_read: // good message case msg_write: // good message case msg_dir: // good message case msg_presence: // good message case msg_dirall: // good message case msg_dirallslash: // good message case msg_get: // good message case msg_getslash: // good message if (hd->sm.payload == 0) { /* Bad query -- no data after header */ LEVEL_DEBUG("No payload -- ignore.") ; cm.ret = -EBADMSG; } else { struct parsedname *pn; OWQ_allocate_struct_and_pointer(owq); pn = PN(owq); /* Parse the path string and crete query object */ LEVEL_CALL("DataHandler: parse path=%s", hd->sp.path); cm.ret = BAD( OWQ_create(hd->sp.path, owq) ) ? -1 : 0 ; if ( cm.ret != 0 ) { LEVEL_DEBUG("DataHandler: OWQ_create failed cm.ret=%d", cm.ret); break; } /* Use client persistent settings (temp scale, display mode ...) */ pn->control_flags = hd->sm.control_flags; /* Override some settings from control flags */ if ( (pn->control_flags & UNCACHED) != 0 ) { // client wants uncached pn->state |= ePS_uncached; } if ( (pn->control_flags & ALIAS_REQUEST) == 0 ) { // client wants unaliased pn->state |= ePS_unaliased; } /* Antilooping tags */ pn->tokens = hd->sp.tokens; pn->tokenstring = hd->sp.tokenstring; //printf("Handler: sm.sg=%X pn.state=%X\n", sm.sg, pn.state); //printf("Scale=%s\n", TemperatureScaleName(SGTemperatureScale(sm.sg))); switch ((enum msg_classification) hd->sm.type) { case msg_presence: LEVEL_CALL("Presence message for %s", SAFESTRING(pn->path)); // Basically, if we were able to ParsedName it's here! cm.size = 0; retbuffer = owmalloc( SERIAL_NUMBER_SIZE ) ; if ( retbuffer ) { memcpy( retbuffer, pn->sn, SERIAL_NUMBER_SIZE ) ; cm.payload = SERIAL_NUMBER_SIZE ; } else { cm.payload = 0 ; } cm.ret = 0; // good answer break; case msg_read: LEVEL_CALL("Read message"); retbuffer = ReadHandler(hd, &cm, owq); LEVEL_DEBUG("Read message done value=%p", retbuffer); break; case msg_write: LEVEL_CALL("Write message"); if ( (int) hd->sp.datasize < hd->sm.size ) { cm.ret = -EMSGSIZE; } else { /* set buffer (size already set) */ OWQ_assign_write_buffer( (ASCII *) hd->sp.data, hd->sm.size, hd->sm.offset, owq) ; WriteHandler(hd, &cm, owq); } break; case msg_dir: LEVEL_CALL("Directory message (one at a time)"); DirHandler(hd, &cm, pn); break; case msg_dirall: LEVEL_CALL("Directory message (all at once)"); retbuffer = DirallHandler(hd, &cm, pn); break; case msg_dirallslash: LEVEL_CALL("Directory message (all at once, with directory /)"); retbuffer = DirallslashHandler(hd, &cm, pn); break; case msg_get: if (IsDir(pn)) { LEVEL_CALL("Get -> Directory message (all at once)"); retbuffer = DirallHandler(hd, &cm, pn); } else { LEVEL_CALL("Get -> Read message"); retbuffer = ReadHandler(hd, &cm, owq); } break; case msg_getslash: if (IsDir(pn)) { LEVEL_CALL("Get -> Directory message (all at once)"); retbuffer = DirallslashHandler(hd, &cm, pn); } else { LEVEL_CALL("Get -> Read message"); retbuffer = ReadHandler(hd, &cm, owq); } break; default: // never reached LEVEL_CALL("Error: unknown message %d", (int) hd->sm.type); break; } OWQ_destroy(owq); LEVEL_DEBUG("DataHandler: FS_ParsedName_destroy done"); } break; case msg_nop: // "bad" message LEVEL_CALL("NOP message"); cm.ret = 0; break; case msg_size: // no longer used case msg_error: default: // "bad" message cm.ret = -ENOMSG; LEVEL_CALL("No message"); break; } LEVEL_DEBUG("DataHandler: cm.ret=%d", cm.ret); TOCLIENTLOCK(hd); if (cm.ret != -EIO) { ToClient(hd->file_descriptor, &cm, retbuffer); } else { ErrorToClient(hd, &cm) ; } #if OW_MT // Signal to PingLoop that we're done. hd->toclient = toclient_complete ; if ( hd->ping_pipe[fd_pipe_write] != FILE_DESCRIPTOR_BAD ) { ignore_result = write( hd->ping_pipe[fd_pipe_write],"X",1) ; //dummy payload } #endif /* OW_MT */ TOCLIENTUNLOCK(hd); if (retbuffer) { owfree(retbuffer); } LEVEL_DEBUG("Finished with client request"); return VOID_RETURN; } owfs-2.8p15/module/owserver/src/c/loop.c0000644000175000017500000001162111734233470015104 00000000000000/* $Id: loop.c,v 1.17 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" #if OW_MT // Handler for multithreaded approach -- with ping static void LoopCleanup(struct handlerdata *hd); static enum toclient_state Ping_or_Send( enum toclient_state last_toclient, struct handlerdata * hd ); static GOOD_OR_BAD LoopSetup(struct handlerdata *hd) ; static GOOD_OR_BAD LoopSetup(struct handlerdata *hd) { _MUTEX_INIT(hd->to_client); if ( pipe(hd->ping_pipe) != 0 ) { ERROR_DEBUG("Cannot create pipe pair for keep-alive pulses") ; return gbBAD ; } fcntl (hd->ping_pipe[fd_pipe_read], F_SETFD, FD_CLOEXEC); // for safe forking fcntl (hd->ping_pipe[fd_pipe_write], F_SETFD, FD_CLOEXEC); // for safe forking hd->toclient = toclient_postping ; return gbGOOD ; } static void LoopCleanup(struct handlerdata *hd) { _MUTEX_DESTROY(hd->to_client); if (hd->ping_pipe[fd_pipe_read] > -1 ) { close(hd->ping_pipe[fd_pipe_read]) ; } if (hd->ping_pipe[fd_pipe_write] > -1 ) { close(hd->ping_pipe[fd_pipe_write]) ; } } struct timeval tv_long = { 1 , 000000 } ; // 1 second struct timeval tv_short = { 0 , 500000 } ; // 1/2 second static enum toclient_state Ping_or_Send( enum toclient_state last_toclient, struct handlerdata * hd ) { struct timeval tv ; fd_set read_set ; int select_value ; enum toclient_state next_toclient ; FD_ZERO( &read_set ) ; FD_SET( hd->ping_pipe[fd_pipe_read], &read_set ) ; switch ( last_toclient ) { case toclient_postmessage: tv = tv_short ; break ; case toclient_complete: return toclient_complete ; case toclient_postping: tv = tv_long ; break ; } select_value = select( hd->ping_pipe[fd_pipe_read]+1, &read_set, NULL, NULL, &tv ) ; TOCLIENTLOCK(hd); next_toclient = hd->toclient ; switch ( select_value ) { case 1: // message from other thread that we're done // some architectures (like MIPS) want this check inside the lock next_toclient = toclient_complete ; break ; case 0: // timeout -- time for ping? switch ( next_toclient ) { case toclient_complete: // crossed paths, we're really done break ; case toclient_postmessage: LEVEL_DEBUG("Ping forestalled by a directory element"); hd->toclient = toclient_postping ; break ; case toclient_postping: LEVEL_DEBUG("Taking too long, send a keep-alive pulse"); PingClient(hd); // send the ping next_toclient = toclient_postping ; break ; } break ; default: // select error LEVEL_DEBUG("Select problem in keep-alive pulsing"); switch ( next_toclient ) { case toclient_complete: // fortunately we're done break ; case toclient_postmessage: case toclient_postping: // not done. Send a ping and resync the process PingClient(hd); // send the ping next_toclient = toclient_postping ; hd->toclient = toclient_postping ; break ; } break ; } TOCLIENTUNLOCK(hd); return next_toclient ; } void PingLoop(struct handlerdata *hd) { enum toclient_state current_toclient = toclient_postping ; if ( GOOD( LoopSetup(hd) ) ) { pthread_t thread ; // Create DataHandler if (pthread_create(&thread, DEFAULT_THREAD_ATTR, DataHandler, hd) != 0) { LEVEL_DEBUG("OWSERVER:handler() can't create new thread"); DataHandler(hd); // do it without pings } else { // ping vs data loop do { current_toclient = Ping_or_Send( current_toclient, hd ) ; } while ( current_toclient != toclient_complete ) ; if (pthread_join(thread, NULL) != 0) { LEVEL_DEBUG("Error waiting for finish of data thread"); } } LoopCleanup(hd); } } #endif /* OW_MT */ owfs-2.8p15/module/owserver/src/c/dirallslash.c0000644000175000017500000000606611734233470016444 00000000000000/* $Id: dirallslash.c,v 1.4 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Dirallslash, called from Handler with the following caveats: */ /* path is path, already parsed, and null terminated */ /* sm has been read, cm has been zeroed */ /* pn is configured */ /* Dir, will return: */ /* cm fully constructed for error message or null marker (end of directory elements */ /* cm.ret is also set to an error or 0 */ static void DirallslashHandlerCallback(void *v, const struct parsedname *pn_entry) { struct charblob *cb = v; CharblobAdd(pn_entry->path, strlen(pn_entry->path), cb); if (IsDir(pn_entry)) { CharblobAddChar('/',cb); } } void *DirallslashHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn) { uint32_t flags = 0; struct charblob cb; char *ret = NULL; (void) hd; CharblobInit(&cb); // Now generate the directory (using the embedded callback function above for each element LEVEL_DEBUG("OWSERVER Dir-All SpecifiedBus=%d path = %s", SpecifiedBus(pn), SAFESTRING(pn->path)); if (hd->sm.payload >= PATH_MAX) { cm->ret = -EMSGSIZE; } else { // Now generate the directory using the callback function above for each element cm->ret = FS_dir_remote(DirallslashHandlerCallback, &cb, pn, &flags); } if (cm->ret < 0) { // error cm->size = cm->payload = 0; } else if (CharblobData(&cb) == NO_CHARBLOB) { // empty cm->size = cm->payload = 0; } else if ((ret = owstrdup(CharblobData(&cb))) != NULL) { // try to copy cm->payload = CharblobLength(&cb) + 1; cm->size = CharblobLength(&cb); } else { // couldn't copy cm->ret = -ENOMEM; cm->size = cm->payload = 0; } cm->offset = flags; /* send the flags in the offset slot */ CharblobClear(&cb); return ret; } owfs-2.8p15/module/owserver/src/c/read.c0000644000175000017500000000760511734233470015055 00000000000000/* $Id: read.c,v 1.31 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Read, called from Handler with the following caveates: */ /* path is path, already parsed, and null terminated */ /* sm has been read, cm has been zeroed */ /* pn is configured */ /* Read, will return: */ /* cm fully constructed */ /* a malloc'ed string, that must be free'd by Handler */ /* The length of string is cm.payload */ /* If cm.payload is 0, then a NULL string is returned */ /* cm.ret is also set to an error <0 or the read length */ void *ReadHandler(struct handlerdata *hd, struct client_msg *cm, struct one_wire_query *owq) { BYTE * retbuffer = NULL ; SIZE_OR_ERROR read_or_error; LEVEL_DEBUG("ReadHandler start"); if (hd == NULL || owq == NULL || cm == NULL) { LEVEL_DEBUG("ReadHandler: illegal null inputs hd==%p owq==%p cm==%p", hd, owq, cm); return NULL; // only sane response for bad inputs } LEVEL_DEBUG("ReadHandler: From Client sm->payload=%d sm->size=%d sm->offset=%d", hd->sm.payload, hd->sm.size, hd->sm.offset); if (hd->sm.payload >= PATH_MAX) { cm->ret = -EMSGSIZE; } else if ((hd->sm.size <= 0) || (hd->sm.size > MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE)) { cm->ret = -EMSGSIZE; LEVEL_DEBUG("ReadHandler: error hd->sm.size == %d", hd->sm.size); } else if ( BAD( OWQ_allocate_read_buffer(owq)) ) { // allocate read buffer LEVEL_DEBUG("ReadHandler: can't allocate memory"); cm->ret = -ENOBUFS; } else { struct parsedname *pn = PN(owq); if ( OWQ_size(owq) > (size_t) hd->sm.size ) { OWQ_size(owq) = hd->sm.size ; } OWQ_offset(owq) = hd->sm.offset ; LEVEL_DEBUG("ReadHandler: call FS_read_postparse on %s", pn->path); read_or_error = FS_read_postparse(owq); LEVEL_DEBUG("ReadHandler: FS_read_postparse read on %s return = %d", pn->path, read_or_error); Debug_OWQ(owq); if (read_or_error <= 0) { LEVEL_DEBUG("ReadHandler: FS_read_postparse error %d", read_or_error); cm->ret = read_or_error; } else { LEVEL_DEBUG("ReadHandler: FS_read_postparse ok size=%d", read_or_error); // make return size smaller (just large enough) cm->payload = read_or_error; cm->offset = hd->sm.offset; cm->size = read_or_error; cm->ret = read_or_error; /* Move this pointer, and let owfree remove it instead of OWQ_destroy() */ retbuffer = (BYTE *)OWQ_buffer(owq); OWQ_buffer(owq) = NULL; } } LEVEL_DEBUG("ReadHandler: To Client cm->payload=%d cm->size=%d cm->offset=%d", cm->payload, cm->size, cm->offset); if ((cm->size > 0)) { Debug_Bytes("Data returned to client",(BYTE *) OWQ_buffer(owq),cm->size) ; } return retbuffer; } owfs-2.8p15/module/owserver/src/c/dirall.c0000644000175000017500000000574111734233470015410 00000000000000/* $Id: dirall.c,v 1.22 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Dirall, called from Handler with the following caveats: */ /* path is path, already parsed, and null terminated */ /* sm has been read, cm has been zeroed */ /* pn is configured */ /* Dir, will return: */ /* cm fully constructed for error message or null marker (end of directory elements */ /* cm.ret is also set to an error or 0 */ void DirallHandlerCallback(void *v, const struct parsedname *pn_entry) { struct charblob *cb = v; CharblobAdd(pn_entry->path, strlen(pn_entry->path), cb); } void *DirallHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn) { uint32_t flags = 0; struct charblob cb; char *ret = NULL; (void) hd; CharblobInit(&cb); // Now generate the directory (using the embedded callback function above for each element LEVEL_DEBUG("OWSERVER Dir-All SpecifiedBus=%d path = %s", SpecifiedBus(pn), SAFESTRING(pn->path)); if (hd->sm.payload >= PATH_MAX) { cm->ret = -EMSGSIZE; } else { // Now generate the directory using the callback function above for each element cm->ret = FS_dir_remote(DirallHandlerCallback, &cb, pn, &flags); } if (cm->ret < 0) { // error cm->size = cm->payload = 0; } else if (CharblobData(&cb) == NO_CHARBLOB) { // empty cm->size = cm->payload = 0; } else if ((ret = owstrdup(CharblobData(&cb))) != NULL) { // try to copy cm->payload = CharblobLength(&cb) + 1; cm->size = CharblobLength(&cb); } else { // couldn't copy cm->ret = -ENOMEM; cm->size = cm->payload = 0; } cm->offset = flags; /* send the flags in the offset slot */ CharblobClear(&cb); return ret; } owfs-2.8p15/module/owserver/src/c/handler.c0000644000175000017500000001143211734375043015553 00000000000000/* $Id: handler.c,v 1.42 2012/03/27 17:34:27 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Counters for persistent connections */ int persistent_connections = 0; int handler_count = 0 ; #if OW_MT // Handler for multithreaded approach -- with ping static void SingleHandler(struct handlerdata *hd); /* * Main routine for actually handling a request * deals with a connection */ void Handler(FILE_DESCRIPTOR_OR_ERROR file_descriptor) { struct handlerdata hd; struct timeval tv_low = { Globals.timeout_persistent_low, 0, }; struct timeval tv_high = { Globals.timeout_persistent_high, 0, }; int persistent = 0; hd.file_descriptor = file_descriptor; _MUTEX_INIT(hd.to_client); timersub(&tv_high, &tv_low, &tv_high); // just the delta while (FromClient(&hd) == 0) { // Was persistence requested? int loop_persistent = ((hd.sm.control_flags & PERSISTENT_MASK) != 0); /* Persistence suppression? */ if (Globals.no_persistence) { loop_persistent = 0; } /* Persistence logic */ if (loop_persistent) { /* Requested persistence */ LEVEL_DEBUG("Persistence requested"); if (persistent) { /* already had persistence granted */ hd.persistent = 1; /* so keep it */ } else { /* See if available */ PERSISTENCELOCK; if (persistent_connections < Globals.clients_persistent_high) { /* ok */ ++persistent_connections; /* global count */ persistent = 1; /* connection toggle */ hd.persistent = 1; /* for responses */ } else { loop_persistent = 0; /* denied! */ hd.persistent = 0; /* for responses */ } PERSISTENCEUNLOCK; } } else { /* No persistence requested this time */ hd.persistent = 0; /* for responses */ } /* now set the sg flag because it usually is copied back to the client */ if (loop_persistent) { hd.sm.control_flags |= PERSISTENT_MASK; } else { hd.sm.control_flags &= ~PERSISTENT_MASK; } /* Do the real work */ SingleHandler(&hd); /* Now see if we should reloop */ if (loop_persistent == 0) { break; /* easiest one */ } /* Shorter wait */ if ( BAD(tcp_wait(file_descriptor, &tv_low)) ) { // timed out /* test if below threshold for longer wait */ PERSISTENCELOCK; /* store the test because the mutex locks the variable */ loop_persistent = (persistent_connections < Globals.clients_persistent_low); PERSISTENCEUNLOCK; if (loop_persistent == 0) { break; /* too many connections and we're slow */ } /* longer wait */ if ( BAD(tcp_wait(file_descriptor, &tv_high)) ) { break; } } LEVEL_DEBUG("OWSERVER tcp connection persistence -- reusing connection now."); } LEVEL_DEBUG("OWSERVER handler done"); _MUTEX_DESTROY(hd.to_client); // restore the persistent count if (persistent) { PERSISTENCELOCK; --persistent_connections; PERSISTENCEUNLOCK; } } static void SingleHandler(struct handlerdata *hd) { timerclear(&hd->tv); LEVEL_DEBUG("START handler %s",hd->sp.path) ; gettimeofday(&(hd->tv), NULL); if (Globals.pingcrazy) { // extra pings PingClient(hd); // send the ping LEVEL_DEBUG("Extra ping (pingcrazy mode)"); } PingLoop( hd ) ; if (hd->sp.path) { owfree(hd->sp.path); hd->sp.path = NULL; } } #else /* no OW_MT */ void Handler(FILE_DESCRIPTOR_OR_ERROR file_descriptor) { struct handlerdata hd; hd.file_descriptor = file_descriptor; if (FromClient(&hd) == 0) { DataHandler(&hd); } if (hd.sp.path) { owfree(hd.sp.path); hd.sp.path = NULL; } } #endif /* OW_MT */ owfs-2.8p15/module/owserver/src/c/Makefile.in0000664000175000017500000005517511756250030016045 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.33 2012/05/06 15:15:45 alfille Exp $ 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@ target_triplet = @target@ bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) subdir = module/owserver/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_OWSERVER_TRUE@am__EXEEXT_1 = owserver$(EXEEXT) @ENABLE_OWEXTERNAL_TRUE@am__EXEEXT_2 = owexternal$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = owserver.$(OBJEXT) from_client.$(OBJEXT) \ to_client.$(OBJEXT) read.$(OBJEXT) write.$(OBJEXT) \ dir.$(OBJEXT) dirall.$(OBJEXT) dirallslash.$(OBJEXT) \ data.$(OBJEXT) error.$(OBJEXT) handler.$(OBJEXT) \ loop.$(OBJEXT) ping.$(OBJEXT) am_owexternal_OBJECTS = $(am__objects_1) owexternal_OBJECTS = $(am_owexternal_OBJECTS) owexternal_LDADD = $(LDADD) am__DEPENDENCIES_1 = am_owserver_OBJECTS = owserver.$(OBJEXT) from_client.$(OBJEXT) \ to_client.$(OBJEXT) read.$(OBJEXT) write.$(OBJEXT) \ dir.$(OBJEXT) dirall.$(OBJEXT) dirallslash.$(OBJEXT) \ data.$(OBJEXT) error.$(OBJEXT) handler.$(OBJEXT) \ loop.$(OBJEXT) ping.$(OBJEXT) owserver_OBJECTS = $(am_owserver_OBJECTS) owserver_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(owexternal_SOURCES) $(owserver_SOURCES) DIST_SOURCES = $(owexternal_SOURCES) $(owserver_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @ENABLE_OWSERVER_TRUE@MODULE_OWSERVER = owserver @ENABLE_OWEXTERNAL_TRUE@MODULE_OWEXTERNAL = owexternal owserver_SOURCES = owserver.c \ from_client.c \ to_client.c \ read.c \ write.c \ dir.c \ dirall.c \ dirallslash.c \ data.c \ error.c \ handler.c \ loop.c \ ping.c owserver_DEPENDENCIES = ../../../owlib/src/c/libow.la owexternal_SOURCES = $(owserver_SOURCES) owexternal_DEPENDENCIES = $(owserver_DEPENDENCIES) AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} 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 module/owserver/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owserver/src/c/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-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_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 owexternal$(EXEEXT): $(owexternal_OBJECTS) $(owexternal_DEPENDENCIES) $(EXTRA_owexternal_DEPENDENCIES) @rm -f owexternal$(EXEEXT) $(LINK) $(owexternal_OBJECTS) $(owexternal_LDADD) $(LIBS) owserver$(EXEEXT): $(owserver_OBJECTS) $(owserver_DEPENDENCIES) $(EXTRA_owserver_DEPENDENCIES) @rm -f owserver$(EXEEXT) $(LINK) $(owserver_OBJECTS) $(owserver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirall.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirallslash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/from_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ping.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/to_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic 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-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owserver/src/c/dir.c0000644000175000017500000000633311734233470014715 00000000000000/* $Id: dir.c,v 1.27 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Dir, called from Handler with the following caveats: */ /* path is path, already parsed, and null terminated */ /* sm has been read, cm has been zeroed */ /* pn is configured */ /* Dir, will return: */ /* cm fully constructed for error message or null marker (end of directory elements */ /* cm.ret is also set to an error or 0 */ struct dirhandlerstruct { struct handlerdata *hd; struct client_msg *cm; }; static void DirHandlerCallback(void *v, const struct parsedname *pn_entry) { struct dirhandlerstruct *dhs = (struct dirhandlerstruct *) v; char *path = pn_entry->path; LEVEL_DEBUG("owserver Calling dir=%s", SAFESTRING(path)); dhs->cm->size = strlen(path); dhs->cm->payload = dhs->cm->size + 1; dhs->cm->ret = 0; TOCLIENTLOCK(dhs->hd); ToClient(dhs->hd->file_descriptor, dhs->cm, path); // send this directory element dhs->hd->toclient = toclient_postmessage ; TOCLIENTUNLOCK(dhs->hd); } void DirHandler(struct handlerdata *hd, struct client_msg *cm, const struct parsedname *pn) { uint32_t flags = 0; struct dirhandlerstruct dhs = { hd, cm, }; LEVEL_CALL("DirHandler: pn->path=%s", pn->path); // Settings for all directory elements cm->payload = strlen(pn->path) + 1 + OW_FULLNAME_MAX + 2; LEVEL_DEBUG("OWSERVER SpecifiedBus=%d path=%s", SpecifiedBus(pn), SAFESTRING(pn->path)); if (hd->sm.payload >= PATH_MAX) { cm->ret = -EMSGSIZE; } else { // Now generate the directory using the callback function above for each element cm->ret = FS_dir_remote(DirHandlerCallback, &dhs, pn, &flags); } // Finished -- send some flags and set up for a null element to tell client we're done cm->offset = flags; /* send the flags in the offset slot */ /* Now null entry to show end of directory listing */ cm->payload = cm->size = 0; //printf("DirHandler: DIR done ret=%d flags=%d\n", cm->ret, flags); } owfs-2.8p15/module/owserver/src/c/write.c0000644000175000017500000000445211734233470015271 00000000000000/* $Id: write.c,v 1.14 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Write, called from Handler with the following caveates: */ /* path is path, already parsed, and null terminated */ /* sm has been read, cm has been zeroed */ /* pn is configured */ /* data is what will be written, of sm->size length */ /* cm fully constructed */ /* cm.ret is also set to an error <0 or the written length */ void WriteHandler(struct handlerdata *hd, struct client_msg *cm, struct one_wire_query *owq) { int ret; LEVEL_DEBUG("WriteHandler: hd->sm.payload=%d hd->sm.size=%d hd->sm.offset=%d OWQ_size=%d OWQ_offset=%d", hd->sm.payload, hd->sm.size, hd->sm.offset, OWQ_size(owq), OWQ_offset(owq)); ret = FS_write_postparse(owq); //printf("Handler: WRITE done\n"); if (ret < 0) { cm->size = 0; cm->ret = ret; } else { cm->size = ret; cm->ret = 0; cm->control_flags = OWQ_pn(owq).control_flags; if (hd->persistent) cm->control_flags |= PERSISTENT_MASK; } } owfs-2.8p15/module/owserver/src/c/error.c0000644000175000017500000000314711734233470015270 00000000000000/* $Id: error.c,v 1.3 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" void ErrorToClient(struct handlerdata *hd, struct client_msg * cm ) { cm->payload = 0 ; cm->size = 0 ; cm->offset = 0 ; ToClient(hd->file_descriptor, cm, NULL); // send the ping } owfs-2.8p15/module/owserver/src/c/from_client.c0000644000175000017500000001057711734233470016445 00000000000000/* $Id: from_client.c,v 1.23 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* read from client, free return pointer if not Null */ int FromClient(struct handlerdata *hd) { BYTE *msg; ssize_t trueload; size_t actual_read ; struct timeval tv = { Globals.timeout_server, 0, }; //printf("FromClient\n"); /* Clear return structure */ memset(&hd->sp, 0, sizeof(struct serverpackage)); /* read header */ tcp_read(hd->file_descriptor, (BYTE *) &hd->sm, sizeof(struct server_msg), &tv, &actual_read) ; if (actual_read != sizeof(struct server_msg)) { hd->sm.type = msg_error; return -EIO; } /* translate endian state */ hd->sm.version = ntohl(hd->sm.version); hd->sm.payload = ntohl(hd->sm.payload); hd->sm.type = ntohl(hd->sm.type); hd->sm.control_flags = ntohl(hd->sm.control_flags); hd->sm.size = ntohl(hd->sm.size); hd->sm.offset = ntohl(hd->sm.offset); LEVEL_DEBUG("FromClient payload=%d size=%d type=%d sg=0x%X offset=%d", hd->sm.payload, hd->sm.size, hd->sm.type, hd->sm.control_flags, hd->sm.offset); /* figure out length of rest of message: payload plus tokens */ trueload = hd->sm.payload; if (isServermessage(hd->sm.version)) { trueload += sizeof(union antiloop) * Servertokens(hd->sm.version); LEVEL_DEBUG("FromClient (servermessage) payload=%d nrtokens=%d trueload=%d size=%d type=%d controlflags=0x%X offset=%d", hd->sm.payload, Servertokens(hd->sm.version), trueload, hd->sm.size, hd->sm.type, hd->sm.control_flags, hd->sm.offset); } else { LEVEL_DEBUG("FromClient (no servermessage) payload=%d size=%d type=%d controlflags=0x%X offset=%d", hd->sm.payload, hd->sm.size, hd->sm.type, hd->sm.control_flags, hd->sm.offset); } if (trueload == 0) { return 0; } /* valid size? */ if ((hd->sm.payload < 0) || (trueload > MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE)) { hd->sm.type = msg_error; return -EMSGSIZE; } /* Can allocate space? */ if ((msg = owmalloc(trueload)) == NULL) { /* create a buffer */ hd->sm.type = msg_error; return -ENOMEM; } /* read in data */ tcp_read(hd->file_descriptor, msg, trueload, &tv, &actual_read) ; if ((ssize_t)actual_read != trueload) { /* read in the expected data */ hd->sm.type = msg_error; owfree(msg); return -EIO; } /* path has null termination? */ if (hd->sm.payload) { int pathlen; if (memchr(msg, 0, (size_t) hd->sm.payload) == NULL) { hd->sm.type = msg_error; owfree(msg); return -EINVAL; } pathlen = strlen( (char *) msg) + 1; hd->sp.data = & msg[pathlen]; hd->sp.datasize = hd->sm.payload - pathlen; } else { hd->sp.data = NULL; hd->sp.datasize = 0; } if (isServermessage(hd->sm.version)) { /* make sure no loop */ size_t i; BYTE *p = &msg[hd->sm.payload]; // end of normal buffer hd->sp.tokenstring = p; hd->sp.tokens = Servertokens(hd->sm.version); for (i = 0; i < hd->sp.tokens; ++i, p += sizeof(union antiloop)) { if (memcmp(p, &(Globals.Token), sizeof(union antiloop)) == 0) { owfree(msg); hd->sm.type = msg_error; LEVEL_CALL("owserver loop suppression"); return -ELOOP; } } } hd->sp.path = (char *) msg; return 0; } owfs-2.8p15/module/owserver/src/c/Makefile.am0000644000175000017500000000233011751512641016017 00000000000000# $Id: Makefile.am,v 1.33 2012/05/06 15:15:45 alfille Exp $ if ENABLE_OWSERVER MODULE_OWSERVER = owserver endif if ENABLE_OWEXTERNAL MODULE_OWEXTERNAL = owexternal endif bin_PROGRAMS = $(MODULE_OWSERVER) $(MODULE_OWEXTERNAL) owserver_SOURCES = owserver.c \ from_client.c \ to_client.c \ read.c \ write.c \ dir.c \ dirall.c \ dirallslash.c \ data.c \ error.c \ handler.c \ loop.c \ ping.c owserver_DEPENDENCIES = ../../../owlib/src/c/libow.la owexternal_SOURCES = $(owserver_SOURCES) owexternal_DEPENDENCIES = $(owserver_DEPENDENCIES) AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owserver/src/c/owserver.c0000644000175000017500000000557511751565563016034 00000000000000/* $Id: owserver.c,v 1.130 2012/05/06 21:21:55 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* --- Prototypes ------------ */ static void SetupAntiloop(void); int main(int argc, char **argv) { int c; /* Set up owlib */ LibSetup(program_type_server); /* grab our executable name */ if (argc > 0) { Globals.progname = owstrdup(argv[0]); if ( strcasecmp( Globals.progname, "owexternal" ) == 0 ) { Globals.allow_external = 1 ; // only if program named "owexternal" } } while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; default: break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* non-option arguments */ while (optind < argc) { ARG_Generic(argv[optind]); ++optind; } if (Outbound_Control.active == 0) { ARG_Server(NULL); // make the default assignment } /* become a daemon if not told otherwise */ if ( BAD(EnterBackground()) ) { ow_exit(1); } /* Set up adapters */ if ( BAD(LibStart()) ) { ow_exit(1); } set_exit_signal_handlers(exit_handler); set_signal_handlers(NULL); #if OW_MT _MUTEX_INIT(persistence_mutex); #endif /* Set up "Antiloop" -- a unique token */ SetupAntiloop(); ServerProcess( Handler ); LEVEL_DEBUG("ServerProcess done"); #if OW_MT _MUTEX_DESTROY(persistence_mutex); #endif ow_exit(0); return 0; } static void SetupAntiloop(void) { struct tms t; Globals.Token.simple.pid = getpid(); Globals.Token.simple.clock = times(&t); } owfs-2.8p15/module/owserver/src/c/to_client.c0000644000175000017500000000616411734233470016121 00000000000000/* $Id: to_client.c,v 1.22 2012/03/27 03:42:48 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2004 Paul H Alfille * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* owserver -- responds to requests over a network socket, and processes them on the 1-wire bus/ Basic idea: control the 1-wire bus and answer queries over a network socket Clients can be owperl, owfs, owhttpd, etc... Clients can be local or remote Eventually will also allow bounce servers. syntax: owserver -u (usb) -d /dev/ttyS1 (serial) -p tcp port e.g. 3001 or 10.183.180.101:3001 or /tmp/1wire */ #include "owserver.h" /* Send fully configured message back to client. data is optional and length depends on "payload" */ int ToClient(int file_descriptor, struct client_msg *machine_order_cm, char *data) { struct client_msg s_cm; struct client_msg *network_order_cm = &s_cm; // note data should be (const char *) but iovec complains about const arguments int nio = 1; struct iovec io[] = { {network_order_cm, sizeof(struct client_msg),}, {data, machine_order_cm->payload,}, }; LEVEL_DEBUG("payload=%d size=%d, ret=%d, sg=0x%X offset=%d ", machine_order_cm->payload, machine_order_cm->size, machine_order_cm->ret, machine_order_cm->control_flags, machine_order_cm->offset); /* If payload==0, no extra data If payload <0, flag to show a delay message, again no data */ if(machine_order_cm->payload < 0) { io[1].iov_len = 0; LEVEL_DEBUG("Send delay message"); } else if ( machine_order_cm->payload == 0 ) { io[1].iov_len = 0; } else if ( data == NULL ) { LEVEL_DEBUG("Bad data pointer -- NULL") ; io[1].iov_len = 0; } else { ++nio; } network_order_cm->version = htonl( machine_order_cm->version ); network_order_cm->payload = htonl( machine_order_cm->payload ); network_order_cm->ret = htonl( machine_order_cm->ret ); network_order_cm->control_flags = htonl( machine_order_cm->control_flags ); network_order_cm->size = htonl( machine_order_cm->size ); network_order_cm->offset = htonl( machine_order_cm->offset ); if(machine_order_cm->payload >= 0) { TrafficOutFD("to server data",io[1].iov_base,io[1].iov_len,file_descriptor); } return writev(file_descriptor, io, nio) != (ssize_t) (io[0].iov_len + io[1].iov_len); } owfs-2.8p15/module/owserver/Makefile.in0000664000175000017500000005116511756250030015027 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owserver DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owserver/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owserver/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owserver/Makefile.am0000664000175000017500000000005710432627752015021 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owtcl/0000775000175000017500000000000011756315511012314 500000000000000owfs-2.8p15/module/owtcl/ow.c0000664000175000017500000003376211446543274013045 00000000000000// -*- C++ -*- // File: ow.c // // Created: Mon Jan 10 22:34:41 2005 // // $Id: ow.c,v 1.5 2010/09/23 03:17:16 alfille Exp $ // // Some Ugly code to keep command line #define from being over_written by #define SAVE_FOR_NOW_PACKAGE_NAME PACKAGE_NAME #undef PACKAGE_NAME #define SAVE_FOR_NOW_PACKAGE_STRING PACKAGE_STRING #undef PACKAGE_STRING #define SAVE_FOR_NOW_PACKAGE_TARNAME PACKAGE_TARNAME #undef PACKAGE_TARNAME #define SAVE_FOR_NOW_PACKAGE_VERSION PACKAGE_VERSION #undef PACKAGE_VERSION #include // Now restore #undef PACKAGE_NAME #define PACKAGE_NAME SAVE_FOR_NOW_PACKAGE_NAME #undef PACKAGE_STRING #define PACKAGE_STRING SAVE_FOR_NOW_PACKAGE_STRING #undef PACKAGE_TARNAME #define PACKAGE_TARNAME SAVE_FOR_NOW_PACKAGE_TARNAME #undef PACKAGE_VERSION #define PACKAGE_VERSION SAVE_FOR_NOW_PACKAGE_VERSION #include "owfs_config.h" #ifdef HAVE_VASPRINTF #define _GNU_SOURCE #endif #include #include "ow.h" #include "owcapi.h" #include "version.h" #include /* Shorthand macros for some cumbersome definitions. */ #define owtcl_ObjCmdProc(name) \ int name (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj **objv) #define owtcl_ArgObjIncr \ int objix; \ for (objix=0; objixused) { owtcl_Error(interp, "OWTCL", "CONNECTED", "owtcl already connected"); tcl_return = TCL_ERROR; goto common_exit; } /* Actually connect to onewire host(s). */ arg = Tcl_GetStringFromObj(objv[1], &con_len); r = OW_init(arg); if (r != 0) { owtcl_ErrorOWlib(interp); tcl_return = TCL_ERROR; goto common_exit; } /* Remember connected state. */ OwtclStatePtr->used = 1; common_exit: owtcl_ArgObjDecr; return tcl_return; } owtcl_ObjCmdProc(Owtcl_isConnect) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; Tcl_Obj *resultPtr; owtcl_ArgObjIncr; resultPtr = Tcl_GetObjResult(interp); if (OwtclStatePtr->used) Tcl_SetIntObj(resultPtr, 1); else Tcl_SetIntObj(resultPtr, 0); owtcl_ArgObjDecr; return TCL_OK; } /* * Disconnect from onewire host(s). */ owtcl_ObjCmdProc(Owtcl_Delete) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; (void) interp; // suppress compiler warning (void) objc; // suppress compiler warning (void) objv; // suppress compiler warning /* Disconnect if connected, otherwise ignore. */ if (OwtclStatePtr->used) OW_finish(); /* Remember disconnected state. */ OwtclStatePtr->used = 0; return TCL_OK; } /* * Set error_level */ owtcl_ObjCmdProc(Owtcl_Set_error_level) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *arg; int arg_len; owtcl_ArgObjIncr; (void) interp; // suppress compiler warning (void) objc; // suppress compiler warning (void) objv; // suppress compiler warning if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?value?"); owtcl_ArgObjDecr; return TCL_ERROR; } if (!OwtclStatePtr->used) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); owtcl_ArgObjDecr; return TCL_ERROR; } arg = Tcl_GetStringFromObj(objv[1], &arg_len); OW_set_error_level(arg); return TCL_OK; } /* * Set error_level */ owtcl_ObjCmdProc(Owtcl_Set_error_print) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *arg; int arg_len; owtcl_ArgObjIncr; (void) interp; // suppress compiler warning (void) objc; // suppress compiler warning (void) objv; // suppress compiler warning if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?value?"); owtcl_ArgObjDecr; return TCL_ERROR; } if (!OwtclStatePtr->used) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); owtcl_ArgObjDecr; return TCL_ERROR; } arg = Tcl_GetStringFromObj(objv[1], &arg_len); OW_set_error_print(arg); return TCL_OK; } /* * Change a owfs node's value. */ owtcl_ObjCmdProc(Owtcl_Put) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *path, *value; int path_len, value_len, r; int tcl_return = TCL_OK; owtcl_ArgObjIncr; /* Check for arguments to the commmand. */ if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "path ?value?"); tcl_return = TCL_ERROR; goto common_exit; } if (objc == 3) value = Tcl_GetStringFromObj(objv[2], &value_len); else { value = "\n"; value_len = 1; } /* Check we are connected to onewire host(s). */ if (OwtclStatePtr->used == 0) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); tcl_return = TCL_ERROR; goto common_exit; } /* Change the owfs node's value. */ path = Tcl_GetStringFromObj(objv[1], &path_len); if ((r = OW_put(path, value, (size_t) value_len)) < 0) { owtcl_ErrorOWlib(interp); tcl_return = TCL_ERROR; goto common_exit; } common_exit: owtcl_ArgObjDecr; return tcl_return; } /* * Get a owfs node's value. (for directories a directory listing) */ owtcl_ObjCmdProc(Owtcl_Get) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *arg, *path, *buf = NULL, *d, *p; int tcl_return = TCL_OK, r, s, lst; size_t ss; Tcl_Obj *resultPtr; owtcl_ArgObjIncr; /* Check for arguments and options to the commmand. */ path = ""; lst = 0; for (objix = 1; objix < objc; objix++) { arg = Tcl_GetStringFromObj(objv[objix], &s); if (!strncasecmp(arg, "-", 1)) { if (!strncasecmp(arg, "-list", 5)) { lst = 1; } else { owtcl_Error(interp, "NONE", NULL, "bad switch \"%s\": should be -list", arg); tcl_return = TCL_ERROR; goto common_exit; } } else { path = Tcl_GetStringFromObj(objv[objix], &s); } } /* Check we are connected to onewire host(s). */ if (OwtclStatePtr->used == 0) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); tcl_return = TCL_ERROR; goto common_exit; } /* Get the owfs node's value. */ r = OW_get(path, &buf, &ss); s = ss; // to get around OW_get uses size_t if (r < 0) { owtcl_ErrorOWlib(interp); if (buf != NULL) { free(buf); } tcl_return = TCL_ERROR; goto common_exit; } /* Arrange the value to form a proper tcl result. */ if (buf == NULL) { tcl_return = TCL_OK; goto common_exit; } buf[s] = 0; if (lst) { if (strchr(buf, ',')) { resultPtr = Tcl_NewListObj(0, NULL); p = buf; while ((d = strchr(p, ',')) != NULL) { Tcl_ListObjAppendElement(interp, resultPtr, Tcl_NewStringObj(p, d - p)); d++; p = d; } Tcl_ListObjAppendElement(interp, resultPtr, Tcl_NewStringObj(p, -1)); } else { resultPtr = Tcl_NewStringObj(buf, -1); } } else { resultPtr = Tcl_NewStringObj(buf, -1); } Tcl_SetObjResult(interp, resultPtr); free(buf); common_exit: owtcl_ArgObjDecr; return tcl_return; } /* * Get version info for owtcl and used owlib. */ owtcl_ObjCmdProc(Owtcl_Version) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char buf[128], *arg; Tcl_Obj *resultPtr; int tcl_return = TCL_OK, s, lst; owtcl_ArgObjIncr; (void) OwtclStatePtr; // suppress compiler warning (void) objc; // suppress compiler warning (void) objv; // suppress compiler warning lst = 0; for (objix = 1; objix < objc; objix++) { arg = Tcl_GetStringFromObj(objv[objix], &s); if (!strncasecmp(arg, "-list", 5)) { lst = 1; } else if (s > 0) { owtcl_Error(interp, "NONE", NULL, "bad switch \"%s\": should be -list", arg); tcl_return = TCL_ERROR; goto common_exit; } } if (lst) { resultPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, resultPtr, Tcl_NewStringObj(OWTCL_VERSION, -1)); Tcl_ListObjAppendElement(interp, resultPtr, Tcl_NewStringObj(VERSION, -1)); } else { sprintf(buf, "owtcl:\t%s\nlibow:\t%s", OWTCL_VERSION, VERSION); resultPtr = Tcl_NewStringObj(buf, -1); } Tcl_SetObjResult(interp, resultPtr); common_exit: owtcl_ArgObjDecr; return tcl_return; } /* * Check if a owfs node exists. */ owtcl_ObjCmdProc(Owtcl_Exists) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *path; int s, r; struct parsedname pn; int tcl_return = TCL_OK; Tcl_Obj *resultPtr; owtcl_ArgObjIncr; /* Check for arguments to the commmand. */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "path"); tcl_return = TCL_ERROR; goto common_exit; } /* Check we are connected to onewire host(s). */ if (OwtclStatePtr->used == 0) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); tcl_return = TCL_ERROR; goto common_exit; } resultPtr = Tcl_GetObjResult(interp); /* Get the owfs node. */ path = Tcl_GetStringFromObj(objv[1], &s); if ((r = FS_ParsedName(path, &pn))) Tcl_SetIntObj(resultPtr, 0); else Tcl_SetIntObj(resultPtr, 1); common_exit: owtcl_ArgObjDecr; return tcl_return; } /* * Check if a owfs node is a directory. */ owtcl_ObjCmdProc(Owtcl_IsDir) { OwtclStateType *OwtclStatePtr = (OwtclStateType *) clientData; char *path; int s, r; struct parsedname pn; int tcl_return = TCL_OK; Tcl_Obj *resultPtr; owtcl_ArgObjIncr; /* Check for arguments to the commmand. */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "path"); tcl_return = TCL_ERROR; goto common_exit; } /* Check we are connected to onewire host(s). */ if (OwtclStatePtr->used == 0) { owtcl_Error(interp, "OWTCL", "DISCONNECTED", "owtcl disconnected"); tcl_return = TCL_ERROR; goto common_exit; } /* Get the owfs node. */ path = Tcl_GetStringFromObj(objv[1], &s); if ((r = FS_ParsedName(path, &pn))) { Tcl_SetErrno(ENOENT); /* No such file or directory */ owtcl_ErrorOWlib(interp); tcl_return = TCL_ERROR; goto common_exit; } /* Check if directory or file. */ resultPtr = Tcl_GetObjResult(interp); if (pn.selected_device == NO_DEVICE || pn.selected_filetype == NO_FILETYPE || pn.subdir) /* A directory of some kind */ Tcl_SetIntObj(resultPtr, 1); else Tcl_SetIntObj(resultPtr, 0); common_exit: owtcl_ArgObjDecr; return tcl_return; } /* *---------------------------------------------------------------------- * Ow_Init -- * perform all initialization for the owlib - Tcl interface. * * a call to Owtcl_Init should exist in Tcl_CreateInterp or * Tcl_CreateExtendedInterp. *---------------------------------------------------------------------- */ struct CmdListType { char *name; void *func; } OwtclCmdList[] = { { "::OW::_init", Owtcl_Connect}, { "::OW::isconnect", Owtcl_isConnect}, { "::OW::put", Owtcl_Put}, { "::OW::get", Owtcl_Get}, { "::OW::set_error_level", Owtcl_Set_error_level}, { "::OW::set_error_print", Owtcl_Set_error_print}, { "::OW::version", Owtcl_Version}, { "::OW::finish", Owtcl_Delete}, { "::OW::isdirectory", Owtcl_IsDir}, { "::OW::isdir", Owtcl_IsDir}, { "::OW::exists", Owtcl_Exists}, { NULL, NULL} }; int Ow_Init(Tcl_Interp * interp) { int i; /* This defines the static chars tkTable(Safe)InitScript */ #include "owtclInitScript.h" if ( #ifdef USE_TCL_STUBS Tcl_InitStubs(interp, "8.1", 0) #else Tcl_PkgRequire(interp, "Tcl", "8.1", 0) #endif == NULL) return TCL_ERROR; OwtclState.used = 0; /* Initialize the new Tcl commands */ i = 0; while (OwtclCmdList[i].name != NULL) { Tcl_CreateObjCommand(interp, OwtclCmdList[i].name, (Tcl_ObjCmdProc *) OwtclCmdList[i].func, (ClientData) & OwtclState, (Tcl_CmdDeleteProc *) NULL); i++; } /* Callback - clean up procs left open on interpreter deletetion. */ Tcl_CallWhenDeleted(interp, (Tcl_InterpDeleteProc *) Owtcl_Delete, (ClientData) & OwtclState); /* Announce successful package loading to "package require". */ if (Tcl_PkgProvide(interp, "ow", OWTCL_VERSION) != TCL_OK) return TCL_ERROR; /* * The init script can't make certain calls in a safe interpreter, * so we always have to use the embedded runtime for it */ return Tcl_Eval(interp, Tcl_IsSafe(interp) ? owtclSafeInitScript : owtclInitScript); } /* *---------------------------------------------------------------------- * Owtcl_SafeInit -- * call the standard init point. *---------------------------------------------------------------------- */ int Ow_SafeInit(Tcl_Interp * interp) { int result; result = Ow_Init(interp); return (result); } owfs-2.8p15/module/owtcl/ow.tcl0000664000175000017500000000732211605541402013362 00000000000000# -*- Tcl -*- # File: ow.tcl # # Created: Tue Jan 11 20:34:11 2005 # # $Id: ow.tcl,v 1.3 2011/07/08 08:42:42 oskin Exp $ # namespace eval ::OW { proc ::OW { args } { return [eval ::OW::init $args] } proc ::ow { args } { return [eval ::OW::ow $args] } } proc ::OW::init {args} { array set oldopts { -format -f -celsius -C -fahenheit -F -kelvin -K -rankine -R -readonly -r -cache -t } set sargs "" foreach arg $args { if {[info exists oldopts($arg)]} { append sargs $oldopts($arg) { } } else { append sargs $arg { } } } set sargs [string trim $sargs] return [::OW::_init $sargs] } proc ::OW::ow {opt args} { switch -exact $opt { open { return [eval ::OW::init $args] } close { return [eval ::OW::finish $args] } version { return [eval ::OW::version $args] } error { return [eval ::OW::set_error $args] } opened { return [eval ::OW::isconnect $args] } get { return [eval ::OW::get $args] } put { return [eval ::OW::put $args] } isdir { return [eval ::OW::isdir $args] } isdirectory { return [eval ::OW::isdir $args] } set { return [eval ::OW::_set $args] } default { error "bad option \"$opt\": must be open, close, version, error, opened, get, put, set, isdir or isdirectory" } } } proc ::OW::_join {args} { foreach a $args { append res {/} [string trim $a {/}] } regsub -all {//} $res {/} res return $res } proc ::OW::_set {path} { set path "/[string trim $path {/}]" if {[exists $path]} { set id_set 0 while {[info commands [set nid "::OW::owcmd$id_set"]] != ""} { incr id_set } set evalstr [format {proc %s {args} {return [eval ::OW::device %s $args]}} $nid $path] eval $evalstr return $nid } else { error "node \"$path\" not exists" } } proc ::OW::device {base opt args} { set path $base switch -exact $opt { get { set lst {} if {[set x [lsearch -exact $args {-list}]] >= 0} { set lst {-list} set args [lreplace $args $x $x] } set path [_join $base [lindex $args 0]] return [eval ::OW::get $path $lst] } put { if {[llength $args] > 1} { set path [_join $base [lindex $args 0]] set args [lreplace $args 0 0] } return [eval ::OW::put $path $args] } isdir { return [eval ::OW::isdir [_join $base [lindex $args 0]]] } isdirectory { return [eval ::OW::isdir [_join $base [lindex $args 0]]] } set { return [eval ::OW::_set [_join $base [lindex $args 0]]] } path { return $path } default { error "bad option \"$opt\": must be get, put, set, path, isdir or isdirectory" } } } proc ::OW::set_error {opt args} { switch -exact $opt { level { if {$args == ""} { error "wrong # args: should be \"ow error level ?val?\"" } eval ::OW::set_error_level $args } print { if {$args == ""} { error "wrong # args: should be \"ow error print ?val?\"" } eval ::OW::set_error_print $args } default { error "bad option \"$opt\": must be level or print" } } } owfs-2.8p15/module/owtcl/tcl.m40000664000175000017500000023232211222527724013263 00000000000000#------------------------------------------------------------------------ # SC_PATH_TCLCONFIG -- # # Locate the tclConfig.sh file and perform a sanity check on # the Tcl compile flags # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the directory containing # the tclConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_TCLCONFIG], [AC_PREREQ(2.57)dnl # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d ${libdir} 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib${LIBPOSTFIX} 2>/dev/null` \ ../../tcl \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr /usr/lib${LIBPOSTFIX}/tcl[[8-9]].[[0-9]]* 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -dr /usr/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr /usr/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi ]) if test x"${ac_cv_c_tclconfig}" = x ; then # TCL_BIN_DIR="# no Tcl configs found" TCL_BIN_DIR="" AC_MSG_WARN(Can't find Tcl configuration definitions) # exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) fi fi ]) #------------------------------------------------------------------------ # SC_PATH_TKCONFIG -- # # Locate the tkConfig.sh file # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tk=... # # Defines the following vars: # TK_BIN_DIR Full path to the directory containing # the tkConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_TKCONFIG], [AC_PREREQ(2.57)dnl # # Ok, lets find the tk configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval}) AC_MSG_CHECKING([for Tk configuration]) AC_CACHE_VAL(ac_cv_c_tkconfig,[ # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then if test -f "${with_tkconfig}/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` else AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) fi fi # then check for a private Tk library if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tk \ `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tk \ `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi ]) if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" AC_MSG_WARN(Can't find Tk configuration definitions) exit 0 else no_tk= TK_BIN_DIR=${ac_cv_c_tkconfig} AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh) fi fi ]) #------------------------------------------------------------------------ # SC_LOAD_TCLCONFIG -- # # Load the tclConfig.sh file # # Arguments: # # Requires the following vars to be set: # TCL_BIN_DIR # # Results: # # Subst the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then AC_MSG_RESULT([loading]) . $TCL_BIN_DIR/tclConfig.sh else AC_MSG_RESULT([file not found]) fi # # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. # if test -f $TCL_BIN_DIR/Makefile ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) ]) #------------------------------------------------------------------------ # SC_LOAD_TKCONFIG -- # # Load the tkConfig.sh file # # Arguments: # # Requires the following vars to be set: # TK_BIN_DIR # # Results: # # Sets the following vars that should be in tkConfig.sh: # TK_BIN_DIR #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TKCONFIG], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) if test -f "$TK_BIN_DIR/tkConfig.sh" ; then AC_MSG_RESULT([loading]) . $TK_BIN_DIR/tkConfig.sh else AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) fi AC_SUBST(TK_VERSION) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_LIB_FILE) ]) #------------------------------------------------------------------------ # SC_ENABLE_SHARED -- # # Allows the building of shared libraries # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-shared=yes|no # # Defines the following vars: # STATIC_BUILD Used for building import/export libraries # on Windows. # # Sets the following vars: # SHARED_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SHARED], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, [ --enable-shared build and link with shared libraries [--enable-shared]], [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD) fi ]) #------------------------------------------------------------------------ # SC_ENABLE_FRAMEWORK -- # # Allows the building of shared libraries into frameworks # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-framework=yes|no # # Sets the following vars: # FRAMEWORK_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_FRAMEWORK], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([how to package libraries]) AC_ARG_ENABLE(framework, [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]], [tcl_ok=$enableval], [tcl_ok=no]) if test "${enable_framework+set}" = set; then enableval="$enable_framework" tcl_ok=$enableval else tcl_ok=no fi if test "$tcl_ok" = "yes" ; then AC_MSG_RESULT([framework]) FRAMEWORK_BUILD=1 if test "${SHARED_BUILD}" = "0" ; then AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes") FRAMEWORK_BUILD=0 fi else AC_MSG_RESULT([standard shared library]) FRAMEWORK_BUILD=0 fi ]) #------------------------------------------------------------------------ # SC_ENABLE_THREADS -- # # Specify if thread support should be enabled. TCL_THREADS is # checked so that if you are compiling an extension against a # threaded core, your extension must be compiled threaded as well. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-threads # # Sets the following vars: # THREADS_LIBS Thread library(s) # # Defines the following vars: # TCL_THREADS # _REENTRANT # _THREAD_SAFE # #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_THREADS], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING(for building with threads) AC_ARG_ENABLE(threads, [ --enable-threads build with threads], [tcl_ok=$enableval], [tcl_ok=no]) if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then if test "${TCL_THREADS}" = 1; then AC_MSG_RESULT([yes (threaded core)]) else AC_MSG_RESULT([yes]) fi TCL_THREADS=1 AC_DEFINE(TCL_THREADS) # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention AC_DEFINE(USE_THREAD_ALLOC) AC_DEFINE(_REENTRANT) if test "`uname -s`" = "SunOS" ; then AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) fi AC_DEFINE(_THREAD_SAFE) AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then # Check a little harder for __pthread_mutex_init in the same # library, as some systems hide it there until pthread.h is # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no) fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else TCL_THREADS=0 AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") fi fi fi fi # Does the pthread-implementation provide # 'pthread_attr_setstacksize' ? ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" AC_CHECK_FUNCS(pthread_attr_setstacksize) AC_CHECK_FUNCS(pthread_atfork) LIBS=$ac_saved_libs AC_CHECK_FUNCS(readdir_r) if test "x$ac_cv_func_readdir_r" = "xyes"; then AC_MSG_CHECKING([how many args readdir_r takes]) # IRIX 5.3 has a 2 arg version of readdir_r # while other systems have a 3 arg version. AC_CACHE_VAL(tcl_cv_two_arg_readdir_r, AC_TRY_COMPILE([#include #include #ifdef NO_DIRENT_H # include /* logic from tcl/compat/dirent.h * # define dirent direct * */ #else # include #endif ], [readdir_r(NULL, NULL);], tcl_cv_two_arg_readdir_r=yes, tcl_cv_two_arg_readdir_r=no)) AC_CACHE_VAL(tcl_cv_three_arg_readdir_r, AC_TRY_COMPILE([#include #include #ifdef NO_DIRENT_H # include /* logic from tcl/compat/dirent.h * # define dirent direct * */ #else # include #endif ], [readdir_r(NULL, NULL, NULL);], tcl_cv_three_arg_readdir_r=yes, tcl_cv_three_arg_readdir_r=no)) if test "x$tcl_cv_two_arg_readdir_r" = "xyes" ; then AC_MSG_RESULT([2]) AC_DEFINE(HAVE_TWO_ARG_READDIR_R) elif test "x$tcl_cv_three_arg_readdir_r" = "xyes" ; then AC_MSG_RESULT([3]) AC_DEFINE(HAVE_THREE_ARG_READDIR_R) else AC_MSG_ERROR([unknown number of args for readdir_r]) fi fi else TCL_THREADS=0 AC_MSG_RESULT([no (default)]) fi AC_SUBST(TCL_THREADS) ]) #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # # Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging # can also be enabled. # # Arguments: # none # # Requires the following vars to be set in the Makefile: # CFLAGS_DEBUG # CFLAGS_OPTIMIZE # LDFLAGS_DEBUG # LDFLAGS_OPTIMIZE # # Results: # # Adds the following arguments to configure: # --enable-symbols # # Defines the following vars: # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true # Sets to $(CFLAGS_OPTIMIZE) if false # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true # Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Debug library extension # #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SYMBOLS], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' DBGX="" AC_MSG_RESULT([no]) else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' DBGX=g if test "$tcl_ok" = "yes"; then AC_MSG_RESULT([yes (standard debugging)]) fi fi AC_SUBST(CFLAGS_DEFAULT) AC_SUBST(LDFLAGS_DEFAULT) if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then AC_DEFINE(TCL_MEM_DEBUG) fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then AC_DEFINE(TCL_COMPILE_DEBUG) AC_DEFINE(TCL_COMPILE_STATS) fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then AC_MSG_RESULT([enabled symbols mem compile debugging]) else AC_MSG_RESULT([enabled $tcl_ok debugging]) fi fi ]) #------------------------------------------------------------------------ # SC_ENABLE_LANGINFO -- # # Allows use of modern nl_langinfo check for better l10n. # This is only relevant for Unix. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-langinfo=yes|no (default is yes) # # Defines the following vars: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. # #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_LANGINFO], [AC_PREREQ(2.57)dnl AC_ARG_ENABLE(langinfo, [ --enable-langinfo use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic], [langinfo_ok=$enableval], [langinfo_ok=yes]) HAVE_LANGINFO=0 if test "$langinfo_ok" = "yes"; then if test "$langinfo_ok" = "yes"; then AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) fi fi AC_MSG_CHECKING([whether to use nl_langinfo]) if test "$langinfo_ok" = "yes"; then AC_TRY_COMPILE([#include ], [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no]) if test "$langinfo_ok" = "no"; then langinfo_ok="no (could not compile with nl_langinfo)"; fi if test "$langinfo_ok" = "yes"; then AC_DEFINE(HAVE_LANGINFO) fi fi AC_MSG_RESULT([$langinfo_ok]) ]) #-------------------------------------------------------------------- # SC_CONFIG_MANPAGES # # Decide whether to use symlinks for linking the manpages, # whether to compress the manpages after installation, and # whether to add a package name suffix to the installed # manpages to avoidfile name clashes. # If compression is enabled also find out what file name suffix # the given compression program is using. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-man-symlinks # --enable-man-compression=PROG # --enable-man-suffix[=STRING] # # Defines the following variable: # # MAN_FLAGS - The apropriate flags for installManPage # according to the user's selection. # #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_MANPAGES], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([whether to use symlinks for manpages]) AC_ARG_ENABLE(man-symlinks, [ --enable-man-symlinks use symlinks for the manpages], test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks", enableval="no") AC_MSG_RESULT([$enableval]) AC_MSG_CHECKING([whether to compress the manpages]) AC_ARG_ENABLE(man-compression, [ --enable-man-compression=PROG compress the manpages with PROG], test "$enableval" = "yes" && AC_MSG_ERROR([missing argument to --enable-man-compression]) test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --compress $enableval", enableval="no") AC_MSG_RESULT([$enableval]) if test "$enableval" != "no"; then AC_MSG_CHECKING([for compressed file suffix]) touch TeST $enableval TeST Z=`ls TeST* | sed 's/^....//'` rm -f TeST* MAN_FLAGS="$MAN_FLAGS --extension $Z" AC_MSG_RESULT([$Z]) fi AC_MSG_CHECKING([whether to add a package name suffix for the manpages]) AC_ARG_ENABLE(man-suffix, [ --enable-man-suffix=STRING use STRING as a suffix to manpage file names (default: $1)], test "$enableval" = "yes" && enableval="$1" test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --suffix $enableval", enableval="no") AC_MSG_RESULT([$enableval]) AC_SUBST(MAN_FLAGS) ]) #-------------------------------------------------------------------- # SC_CONFIG_CFLAGS # # Try to determine the proper flags to pass to the compiler # for building shared libraries and other such nonsense. # # Arguments: # none # # Results: # # Defines and substitutes the following vars: # # DL_OBJS - Name of the object file that implements dynamic # loading for Tcl on this system. # DL_LIBS - Library file(s) to include in tclsh and other base # applications in order for the "load" command to work. # LDFLAGS - Flags to pass to the compiler when linking object # files into an executable application binary such # as tclsh. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. Could # be the same as CC_SEARCH_FLAGS if ${CC} is used to link. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. # MAKE_LIB - Command to execute to build the a library; # differs when building shared or static. # MAKE_STUB_LIB - # Command to execute to build a stub library. # INSTALL_LIB - Command to execute to install a library; # differs when building shared or static. # INSTALL_STUB_LIB - # Command to execute to install a stub library. # STLIB_LD - Base command to use for combining object files # into a static library. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components # of a shared library (may request position-independent # code, among other things). # SHLIB_LD - Base command to use for combining object files # into a shared library. # SHLIB_LD_FLAGS -Flags to pass when building a shared library. This # differes from the SHLIB_CFLAGS as it is not used # when building object files or executables. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build # shared libraries. The value of the symbol is # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on # SunOS 4.x, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the # tclConfig.sh, since they are only used for the build # of Tcl and Tk. # Examples: MacOS X records the library version and # compatibility version in the shared library. But # of course the Tcl version of this is only used for Tcl. # LIB_SUFFIX - Specifies everything that comes after the "libfoo" # in a static or shared library name, using the $VERSION variable # to put the version in the right place. This is used # by platforms that need non-standard library names. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs # to have a version after the .so, and ${VERSION}.a # on AIX, since a shared library needs to have # a .a extension whereas shared objects for loadable # extensions have a .so extension. Defaults to # ${VERSION}${SHLIB_SUFFIX}. # TCL_NEEDS_EXP_FILE - # 1 means that an export file is needed to link to a # shared library. # TCL_EXP_FILE - The name of the installed export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # TCL_BUILD_EXP_FILE - # The name of the built export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # CFLAGS_DEBUG - # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) # #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_CFLAGS], [AC_PREREQ(2.57)dnl # Step 0.a: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no") if test "$enableval" = "yes"; then do64bit=yes else do64bit=no fi AC_MSG_RESULT($do64bit) # Step 0.b: Enable Solaris 64 bit VIS support? AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no") if test "$enableval" = "yes"; then # Force 64bit on with VIS do64bit=yes do64bitVIS=yes else do64bitVIS=no fi AC_MSG_RESULT($do64bitVIS) # Step 1: set the variable "system" to hold the name and version number # for the system. This can usually be done via the "uname" command, but # there are a few systems, like Next, where this doesn't work. AC_MSG_CHECKING([system version (for dynamic loading)]) if test -f /usr/lib/NextStep/software_version; then system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else system=`uname -s`-`uname -r` if test "$?" -ne 0 ; then AC_MSG_RESULT([unknown (can't find uname command)]) system=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then system=MP-RAS-`awk '{print $3}' /etc/.relid'` fi if test "`uname -s`" = "AIX" ; then system=AIX-`uname -v`.`uname -r` fi AC_MSG_RESULT($system) fi fi # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) # Require ranlib early so we can override it in special cases below. AC_REQUIRE([AC_PROG_RANLIB]) # Step 3: set configuration options based on system name and version. do64bit_ok=no LDFLAGS_ORIG="$LDFLAGS" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = "yes" ; then CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing" else CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. dnl AC_CHECK_TOOL(AR, ar) AC_CHECK_PROG(AR, ar, ar) if test "${AR}" = "" ; then AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.]) fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" PLAT_OBJS="" case $system in AIX-5.*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi LIBS="$LIBS -lc" # AIX-5 uses ELF style dynamic libraries SHLIB_CFLAGS="" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then AC_MSG_WARN("64bit mode not supported with GCC on $system") else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS="$LDFLAGS -q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = "ia64" ; then # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" if test "$GCC" = "yes" ; then CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' fi ;; AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} LD_LIBRARY_PATH_VAR="LIBPATH" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' # AIX v<=4.1 has some different flags than 4.2+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then LIBOBJS="$LIBOBJS tclLoadAix.o" DL_LIBS="-lld" fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then AC_MSG_WARN("64bit mode not supported with GCC on $system") else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS="$LDFLAGS -q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to # insure proper sequencing, is to add it to the tail of MATH_LIBS. # This library also supplies gettimeofday. # # AIX does not have a timezone field in struct tm. When the AIX # bsd library is used, the timezone global and the gettimeofday # methods are to be avoided for timezone deduction instead, we # deduce the timezone by comparing the localtime result on a # known GMT value. AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) if test $libbsd = yes; then MATH_LIBS="$MATH_LIBS -lbsd" AC_DEFINE(USE_DELTA_FOR_TZ) fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -nostart" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"]) ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD="cc -shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) # Use updated header definitions where possible AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library LIBS="$LIBS -lxnet" # Use the XOPEN network library SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = "yes" ; then SHLIB_LD="gcc -shared" SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS='' CC_SEARCH_FLAGS='' fi # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then hpux_arch=`gcc -dumpmachine` case $hpux_arch in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD="gcc -shared" SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS='' CC_SEARCH_FLAGS='' ;; *) AC_MSG_WARN("64bit mode not supported with GCC on $system") ;; esac else do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS="$LDFLAGS +DD64" fi fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-4.*) SHLIB_CFLAGS="-G 0" SHLIB_SUFFIX=".a" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="$LDFLAGS -Wl,-D,08000000" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' if test "$GCC" = "yes" ; then CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then if test "$GCC" = "yes" ; then AC_MSG_WARN([64bit mode not supported by gcc]) else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS="$LDFLAGS -64" fi fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-O2 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" if test "$have_dl" = yes; then SHLIB_LD="${CC} -shared" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="tclLoadDld.o" DL_LIBS="-ldld" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then CFLAGS="$CFLAGS -mieee" fi # The combo of gcc + glibc has a bug related # to inlining of functions like strtod(). The # -fno-builtin flag should address this problem # but it does not work. The -fno-inline flag # is kind of overkill but it works. # Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${LIBOBJS}" != x ; then CFLAGS="$CFLAGS -fno-inline" fi # XIM peeking works under XFree86. AC_DEFINE(PEEK_XCLOSEIM) ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" if test "$have_dl" = yes; then SHLIB_LD="${CC} -shared" DL_OBJS="" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="" DL_LIBS="-ldld" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then CFLAGS="$CFLAGS -mieee" fi ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,-Bexport" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-*|FreeBSD-[[1-2]].*) # Not available on all versions: check for include file. AC_CHECK_HEADER(dlfcn.h, [ # NetBSD/SPARC needs -fPIC, -fpic will not do. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' AC_MSG_CHECKING(for ELF) AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif ], AC_MSG_RESULT(yes) SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so', AC_MSG_RESULT(no) SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' ) ], [ SHLIB_CFLAGS="" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' ]) # FreeBSD doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" AC_MSG_CHECKING(for ELF) AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif ], [AC_MSG_RESULT(yes) SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'], [AC_MSG_RESULT(no) SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'] ) # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; FreeBSD-*) # FreeBSD 3.* and greater have ELF. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' if test "${TCL_THREADS}" = "1" ; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; Rhapsody-*|Darwin-*) SHLIB_CFLAGS="-fno-common" SHLIB_LD="cc -dynamiclib \${LDFLAGS}" TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" PLAT_OBJS=\$\(MAC\_OSX_OBJS\) DL_LIBS="" LDFLAGS="$LDFLAGS -prebind" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" CFLAGS_OPTIMIZE="-Os" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" AC_DEFINE(MAC_OSX_TCL) AC_DEFINE(HAVE_CFBUNDLE) AC_DEFINE(USE_VFORK) AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8") LIBS="$LIBS -framework CoreFoundation" ;; NEXTSTEP-*) SHLIB_CFLAGS="" SHLIB_LD="cc -nostdlib -r" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 SHLIB_CFLAGS="" # Hack: make package name same as library name SHLIB_LD='ld -R -export $@:' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" if test "$SHARED_BUILD" = "1" ; then SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = "1" ; then SHLIB_LD='ld -shared -expect_unresolved "*"' else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' if test "$GCC" = "yes" ; then CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = "1" ; then CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = "yes" ; then LIBS="$LIBS -lpthread -lmach -lexc" else CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; RISCos-*) SHLIB_CFLAGS="-G 0" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="$LDFLAGS -Wl,-D,08000000" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. if test "$GCC" = "yes" ; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) SHLIB_CFLAGS="-K PIC" SHLIB_LD="cc -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) SHLIB_CFLAGS="-PIC" SHLIB_LD="ld" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[[0-6]]*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. AC_DEFINE(_REENTRANT) AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) SHLIB_CFLAGS="-KPIC" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = "yes" ; then SHLIB_LD="$CC -shared" CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. AC_DEFINE(_REENTRANT) AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then arch=`isainfo` if test "$arch" = "sparcv9 sparc" ; then if test "$GCC" = "yes" ; then AC_MSG_WARN("64bit mode not supported with GCC on $system") else do64bit_ok=yes if test "$do64bitVIS" = "yes" ; then CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS="$LDFLAGS -xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS="$LDFLAGS -xarch=v9" fi fi else AC_MSG_WARN("64bit mode only supported sparcv9 system") fi fi # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = "yes" ; then SHLIB_LD="$CC -shared" CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; ULTRIX-4.*) SHLIB_CFLAGS="-G 0" SHLIB_SUFFIX=".a" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="$LDFLAGS -Wl,-D,08000000" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$GCC" != "yes" ; then CFLAGS="$CFLAGS -DHAVE_TZSET -std1" fi ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" SHLIB_LD="cc -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. hold_ldflags=$LDFLAGS AC_MSG_CHECKING(for ld accepts -Bexport flag) LDFLAGS="$LDFLAGS -Wl,-Bexport" AC_TRY_LINK(, [int i;], [found=yes], [LDFLAGS=$hold_ldflags found=no]) AC_MSG_RESULT($found) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform") fi # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need # to determine which of several header files defines the a.out file # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we # support only a file format that is more or less version-7-compatible. # In particular, # - a.out files must begin with `struct exec'. # - the N_TXTOFF on the `struct exec' must compute the seek address # of the text segment # - The `struct exec' must contain a_magic, a_text, a_data, a_bss # and a_entry fields. # The following compilation should succeed if and only if either sys/exec.h # or a.out.h is usable for the purpose. # # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the # `struct exec' includes a second header that contains information that # duplicates the v7 fields that are needed. if test "x$DL_OBJS" = "xtclLoadAout.o" ; then AC_MSG_CHECKING(sys/exec.h) AC_TRY_COMPILE([#include ],[ struct exec foo; unsigned long seek; int flag; #if defined(__mips) || defined(mips) seek = N_TXTOFF (foo.ex_f, foo.ex_o); #else seek = N_TXTOFF (foo); #endif flag = (foo.a_magic == OMAGIC); return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; ], tcl_ok=usable, tcl_ok=unusable) AC_MSG_RESULT($tcl_ok) if test $tcl_ok = usable; then AC_DEFINE(USE_SYS_EXEC_H) else AC_MSG_CHECKING(a.out.h) AC_TRY_COMPILE([#include ],[ struct exec foo; unsigned long seek; int flag; #if defined(__mips) || defined(mips) seek = N_TXTOFF (foo.ex_f, foo.ex_o); #else seek = N_TXTOFF (foo); #endif flag = (foo.a_magic == OMAGIC); return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; ], tcl_ok=usable, tcl_ok=unusable) AC_MSG_RESULT($tcl_ok) if test $tcl_ok = usable; then AC_DEFINE(USE_A_OUT_H) else AC_MSG_CHECKING(sys/exec_aout.h) AC_TRY_COMPILE([#include ],[ struct exec foo; unsigned long seek; int flag; #if defined(__mips) || defined(mips) seek = N_TXTOFF (foo.ex_f, foo.ex_o); #else seek = N_TXTOFF (foo); #endif flag = (foo.a_midmag == OMAGIC); return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; ], tcl_ok=usable, tcl_ok=unusable) AC_MSG_RESULT($tcl_ok) if test $tcl_ok = usable; then AC_DEFINE(USE_SYS_EXEC_AOUT_H) else DL_OBJS="" fi fi fi fi # Step 5: disable dynamic loading if requested via a command-line switch. AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], [tcl_ok=$enableval], [tcl_ok=yes]) if test "$tcl_ok" = "no"; then DL_OBJS="" fi if test "x$DL_OBJS" != "x" ; then BUILD_DLTEST="\$(DLTEST_TARGETS)" else echo "Can't figure out how to do dynamic loading or shared libraries" echo "on this system." SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" ; then if test "$GCC" = "yes" ; then case $system in AIX-*) ;; BSD/OS*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*|OpenBSD-*) ;; Rhapsody-*|Darwin-*) ;; RISCos-*) ;; SCO_SV-3.2*) ;; ULTRIX-4.*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi fi if test "$SHARED_LIB_SUFFIX" = "" ; then SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = "" ; then UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' fi if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then LIB_SUFFIX=${SHARED_LIB_SUFFIX} MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' else LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} if test "$RANLIB" = "" ; then MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}' INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' else MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@' INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))' fi dnl Not at all clear what this was doing in Tcl's configure.in dnl or why it was needed was needed. In any event, this sort of dnl things needs to be done in the big loop above. dnl REMOVE THIS BLOCK LATER! (mdejong) dnl case $system in dnl BSD/OS*) dnl ;; dnl AIX-[[1-4]].*) dnl ;; dnl *) dnl SHLIB_LD_LIBS="" dnl ;; dnl esac fi # Stub lib does not depend on shared/static configuration if test "$RANLIB" = "" ; then MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)' else MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@' INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))' fi AC_SUBST(DL_LIBS) AC_SUBST(DL_OBJS) AC_SUBST(PLAT_OBJS) AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS_DEBUG) AC_SUBST(LDFLAGS_OPTIMIZE) AC_SUBST(CC_SEARCH_FLAGS) AC_SUBST(LD_SEARCH_FLAGS) AC_SUBST(STLIB_LD) AC_SUBST(SHLIB_LD) AC_SUBST(TCL_SHLIB_LD_EXTRAS) AC_SUBST(TK_SHLIB_LD_EXTRAS) AC_SUBST(SHLIB_LD_FLAGS) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(SHLIB_CFLAGS) AC_SUBST(SHLIB_SUFFIX) AC_SUBST(MAKE_LIB) AC_SUBST(MAKE_STUB_LIB) AC_SUBST(INSTALL_LIB) AC_SUBST(INSTALL_STUB_LIB) AC_SUBST(RANLIB) ]) #-------------------------------------------------------------------- # SC_SERIAL_PORT # # Determine which interface to use to talk to the serial port. # Note that #include lines must begin in leftmost column for # some compilers to recognize them as preprocessor directives, # and some build environments have stdin not pointing at a # pseudo-terminal (usually /dev/null instead.) # # Arguments: # none # # Results: # # Defines only one of the following vars: # HAVE_SYS_MODEM_H # USE_TERMIOS # USE_TERMIO # USE_SGTTY # #-------------------------------------------------------------------- AC_DEFUN([SC_SERIAL_PORT], [AC_PREREQ(2.57)dnl AC_CHECK_HEADERS(sys/modem.h) AC_MSG_CHECKING([termios vs. termio vs. sgtty]) AC_CACHE_VAL(tcl_cv_api_serial, [ AC_TRY_RUN([ #include int main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; t.sg_flags |= ODDP | EVENP | RAW; return 0; } return 1; }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include #include int main() { struct termios t; if (tcgetattr(0, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { cfsetospeed(&t, 0); t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { t.sg_ospeed = 0; t.sg_flags |= ODDP | EVENP | RAW; return 0; } return 1; }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) fi]) case $tcl_cv_api_serial in termios) AC_DEFINE(USE_TERMIOS);; termio) AC_DEFINE(USE_TERMIO);; sgtty) AC_DEFINE(USE_SGTTY);; esac AC_MSG_RESULT($tcl_cv_api_serial) ]) #-------------------------------------------------------------------- # SC_MISSING_POSIX_HEADERS # # Supply substitutes for missing POSIX header files. Special # notes: # - stdlib.h doesn't define strtol, strtoul, or # strtod insome versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # # Arguments: # none # # Results: # # Defines some of the following vars: # NO_DIRENT_H # NO_ERRNO_H # NO_VALUES_H # HAVE_LIMITS_H or NO_LIMITS_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_UNISTD_H # HAVE_SYS_PARAM_H # # HAVE_STRING_H ? # #-------------------------------------------------------------------- AC_DEFUN([SC_MISSING_POSIX_HEADERS], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING(dirent.h) AC_TRY_LINK([#include #include ], [ #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ], tcl_ok=yes, tcl_ok=no) if test $tcl_ok = no; then AC_DEFINE(NO_DIRENT_H) fi AC_MSG_RESULT($tcl_ok) AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) AC_CHECK_HEADER(limits.h, [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) if test $tcl_ok = 0; then AC_DEFINE(NO_STDLIB_H) fi AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then AC_DEFINE(NO_STRING_H) fi AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)]) AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). AC_HAVE_HEADERS(unistd.h sys/param.h) ]) #-------------------------------------------------------------------- # SC_PATH_X # # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. # # Arguments: # none # # Results: # # Sets the the following vars: # XINCLUDES # XLIBSW # #-------------------------------------------------------------------- AC_DEFUN([SC_PATH_X], [AC_PREREQ(2.57)dnl AC_PATH_X not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then AC_TRY_CPP([#include ], , not_really_there="yes") else if test ! -r $x_includes/X11/Intrinsic.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING(for X11 header files) found_xincludes="no" AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then AC_MSG_RESULT($i) XINCLUDES=" -I$i" found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then XINCLUDES="-I$x_includes" found_xincludes="yes" fi fi if test found_xincludes = "no"; then AC_MSG_RESULT(couldn't find any!) fi if test "$no_x" = yes; then AC_MSG_CHECKING(for X11 libraries) XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then AC_MSG_RESULT($i) XLIBSW="-L$i -lX11" x_libraries="$i" break fi done else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) fi if test "$XLIBSW" = nope ; then AC_MSG_RESULT(couldn't find any! Using -lX11.) XLIBSW=-lX11 fi ]) #-------------------------------------------------------------------- # SC_BLOCKING_STYLE # # The statements below check for systems where POSIX-style # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. # On these systems (mostly older ones), use the old BSD-style # FIONBIO approach instead. # # Arguments: # none # # Results: # # Defines some of the following vars: # HAVE_SYS_IOCTL_H # HAVE_SYS_FILIO_H # USE_FIONBIO # O_NONBLOCK # #-------------------------------------------------------------------- AC_DEFUN([SC_BLOCKING_STYLE], [AC_PREREQ(2.57)dnl AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/filio.h) AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) if test -f /usr/lib/NextStep/software_version; then system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else system=`uname -s`-`uname -r` if test "$?" -ne 0 ; then system=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then system=MP-RAS-`awk '{print $3}' /etc/.relid'` fi if test "`uname -s`" = "AIX" ; then system=AIX-`uname -v`.`uname -r` fi fi fi case $system in # There used to be code here to use FIONBIO under AIX. However, it # was reported that FIONBIO doesn't work under AIX 3.2.5. Since # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO # code (JO, 5/31/97). OSF*) AC_DEFINE(USE_FIONBIO) AC_MSG_RESULT(FIONBIO) ;; SunOS-4*) AC_DEFINE(USE_FIONBIO) AC_MSG_RESULT(FIONBIO) ;; ULTRIX-4.*) AC_DEFINE(USE_FIONBIO) AC_MSG_RESULT(FIONBIO) ;; *) AC_MSG_RESULT(O_NONBLOCK) ;; esac ]) #-------------------------------------------------------------------- # SC_TIME_HANLDER # # Checks how the system deals with time.h, what time structures # are used on the system, and what fields the structures have. # # Arguments: # none # # Results: # # Defines some of the following vars: # USE_DELTA_FOR_TZ # HAVE_TM_GMTOFF # HAVE_TM_TZADJ # HAVE_TIMEZONE_VAR # #-------------------------------------------------------------------- AC_DEFUN([SC_TIME_HANDLER], [AC_PREREQ(2.57)dnl AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME AC_STRUCT_TIMEZONE AC_CHECK_FUNCS(gmtime_r localtime_r) AC_MSG_CHECKING([tm_tzadj in struct tm]) AC_CACHE_VAL(tcl_cv_member_tm_tzadj, AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) AC_MSG_RESULT($tcl_cv_member_tm_tzadj) if test $tcl_cv_member_tm_tzadj = yes ; then AC_DEFINE(HAVE_TM_TZADJ) fi AC_MSG_CHECKING([tm_gmtoff in struct tm]) AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) AC_MSG_RESULT($tcl_cv_member_tm_gmtoff) if test $tcl_cv_member_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF) fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # AC_MSG_CHECKING([long timezone variable]) AC_CACHE_VAL(tcl_cv_var_timezone, AC_TRY_COMPILE([#include ], [extern long timezone; timezone += 1; exit (0);], tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) AC_MSG_RESULT($tcl_cv_timezone_long) if test $tcl_cv_timezone_long = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR) else # # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # AC_MSG_CHECKING([time_t timezone variable]) AC_CACHE_VAL(tcl_cv_timezone_time, AC_TRY_COMPILE([#include ], [extern time_t timezone; timezone += 1; exit (0);], tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) AC_MSG_RESULT($tcl_cv_timezone_time) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR) fi fi ]) #-------------------------------------------------------------------- # SC_BUGGY_STRTOD # # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. # Also, on Compaq's Tru64 Unix 5.0, # strtod(" ") returns 0.0 instead of a failure to convert. # # Arguments: # none # # Results: # # Might defines some of the following vars: # strtod (=fixstrtod) # #-------------------------------------------------------------------- AC_DEFUN([SC_BUGGY_STRTOD], [AC_PREREQ(2.57)dnl AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) AC_CACHE_VAL(tcl_cv_strtod_buggy,[ AC_TRY_RUN([ extern double strtod(); int main() { char *infString="Inf", *nanString="NaN", *spaceString=" "; char *term; double value; value = strtod(infString, &term); if ((term != infString) && (term[-1] == 0)) { exit(1); } value = strtod(nanString, &term); if ((term != nanString) && (term[-1] == 0)) { exit(1); } value = strtod(spaceString, &term); if (term == (spaceString+1)) { exit(1); } exit(0); }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)]) if test "$tcl_cv_strtod_buggy" = 1; then AC_MSG_RESULT(ok) else AC_MSG_RESULT(buggy) LIBOBJS="$LIBOBJS fixstrtod.o" AC_DEFINE(strtod, fixstrtod) fi fi ]) #-------------------------------------------------------------------- # SC_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. # -lnsl) are dealt with here. # # Arguments: # Requires the following vars to be set in the Makefile: # DL_LIBS # LIBS # MATH_LIBS # # Results: # # Subst's the following var: # TCL_LIBS # MATH_LIBS # # Might append to the following vars: # LIBS # # Might define the following vars: # HAVE_NET_ERRNO_H # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_LINK_LIBS], [AC_PREREQ(2.57)dnl #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to work # right (and it must appear before "-lm"). #-------------------------------------------------------------------- AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)]) #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- tcl_checkBoth=0 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) if test "$tcl_checkSocket" = 1; then AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"])]) # Don't perform the eval of the libraries here because DL_LIBS # won't be set until we call SC_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' AC_SUBST(TCL_LIBS) AC_SUBST(MATH_LIBS) ]) #-------------------------------------------------------------------- # SC_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. # # Arguments: # None # # Results: # # Might define the following vars: # _ISOC99_SOURCE # _LARGEFILE64_SOURCE # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_EARLY_FLAG], [AC_PREREQ(2.57)dnl AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, AC_TRY_COMPILE([[#define ]$1[ 1 ]$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then AC_DEFINE($1) tcl_flags="$tcl_flags $1" fi]) AC_DEFUN([SC_TCL_EARLY_FLAGS], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([for required early compiler flags]) tcl_flags="" SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], [char *p = (char *)strtoll; char *q = (char *)strtoull;]) SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], [struct stat64 buf; int i = stat64("/", &buf);]) if test "x${tcl_flags}" = "x" ; then AC_MSG_RESULT(none) else AC_MSG_RESULT(${tcl_flags}) fi]) #-------------------------------------------------------------------- # SC_TCL_64BIT_FLAGS # # Check for what is defined in the way of 64-bit features. # # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE # HAVE_STRUCT_DIRENT64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_64BIT_FLAGS], [AC_PREREQ(2.57)dnl AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG) AC_MSG_RESULT(using long) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) AC_MSG_RESULT(${tcl_cv_type_64bit}) # Now check for auxiliary declarations AC_MSG_CHECKING([for struct dirent64]) AC_CACHE_VAL(tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include #include ],[struct dirent64 p;], tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64) fi AC_MSG_RESULT(${tcl_cv_struct_dirent64}) AC_MSG_CHECKING([for struct stat64]) AC_CACHE_VAL(tcl_cv_struct_stat64,[ AC_TRY_COMPILE([#include ],[struct stat64 p; ], tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) if test "x${tcl_cv_struct_stat64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_STAT64) fi AC_MSG_RESULT(${tcl_cv_struct_stat64}) AC_MSG_CHECKING([for off64_t]) AC_CACHE_VAL(tcl_cv_type_off64_t,[ AC_TRY_COMPILE([#include ],[off64_t offset; ], tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) AC_CHECK_FUNCS(open64 lseek64) dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the dnl functions lseek64 and open64 are defined. if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in ?]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi]) owfs-2.8p15/module/owtcl/Makefile.in0000664000175000017500000006020211756250030014273 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.3 2010/05/05 12:00:47 oskin Exp $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@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@ target_triplet = @target@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/version.h subdir = module/owtcl ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(datadir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = am_ow_la_OBJECTS = ow.lo ow_la_OBJECTS = $(am_ow_la_OBJECTS) ow_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ow_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(ow_la_SOURCES) DIST_SOURCES = $(ow_la_SOURCES) DATA = $(data_DATA) $(noinst_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibdir = @OWTCL_INSTALL_PATH@/owtcl-$(OWTCL_VERSION) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ #SHLIB_SUFFIX = $(TCL_SHLIB_SUFFIX) LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ PACKAGE = ow 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ #something like this. $(TCL_EXEC_PREFIX)/lib@LIBPOSTFIX@/owtcl-$(OWTCL_VERSION) datadir = $(pkglibdir) datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ #if 0 OWTCL_MAJOR_VERSION = 1 OWTCL_MINOR_VERSION = 0 OWTCL_VERSION = $(OWTCL_MAJOR_VERSION).$(OWTCL_MINOR_VERSION) EXTRA_DIST = owtclInitScript.h tcl.m4 ow.tcl example/owdir.tcl example/test.tcl pkglib_LTLIBRARIES = ow.la ow_la_SOURCES = ow.c ow_la_LDFLAGS = -module -release $(OWTCL_VERSION) -shared -shrext "$(TCL_SHLIB_SUFFIX)" #ow_la_LIBADD = ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ow_la_LIBADD = $(TCL_LIB_SPEC) ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ${TCL_LIBS} ow_la_DEPENDENCIES = ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la data_DATA = ow.tcl pkgIndex.tcl @HAVE_DARWIN_TRUE@noinst_DATA = darwin-relink MAJOR_VERSION = $(OWTCL_MAJOR_VERSION) MINOR_VERSION = $(OWTCL_MINOR_VERSION) AM_CFLAGS = -I../owlib/src/include \ -I../owcapi/src/include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ $(TCL_DEFS) \ $(TCL_SHLIB_CFLAGS) \ $(TCL_INCLUDE_SPEC) \ -DTCL_PACKAGE_PATH=\"'$(TCL_PACKAGE_PATH)'\" \ -DOWTCL_PACKAGE_PATH=\"$(pkglibdir)\" \ ${PIC_FLAGS} all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/version.h $(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 module/owtcl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owtcl/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; $(srcdir)/version.h: $(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-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || 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)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_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 ow.la: $(ow_la_OBJECTS) $(ow_la_DEPENDENCIES) $(EXTRA_ow_la_DEPENDENCIES) $(ow_la_LINK) -rpath $(pkglibdir) $(ow_la_OBJECTS) $(ow_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dataDATA: $(data_DATA) @$(NORMAL_INSTALL) test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)" @list='$(data_DATA)'; test -n "$(datadir)" || 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)$(datadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \ done uninstall-dataDATA: @$(NORMAL_UNINSTALL) @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir) 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) $(DATA) installdirs: for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(datadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-local \ clean-pkglibLTLIBRARIES 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-dataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES 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-dataDATA uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-pkglibLTLIBRARIES 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-dataDATA 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-pkglibLTLIBRARIES 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-dataDATA uninstall-pkglibLTLIBRARIES #endif #define OWTCL_MAJOR_VERSION 1 #define OWTCL_MINOR_VERSION 0 #define OWTCL_VERSION "1.0" ow.lo: owtclInitScript.h ow.tcl.h version.h #LDADD = -L../owlib/src/c $(TCL_LIB_SPEC) -low -lowcapi ${TCL_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} #LDADD = $(TCL_LIB_SPEC) ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ${TCL_LIBS} ${PTHREAD_CFLAGS} ${PTHREAD_LIBS} #SHLIB_LD = $(TCL_SHLIB_LD) $(LIBS) -low ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-local: @RM@ -f ow.tcl.h pkgIndex.tcl darwin-relink clean-generic: @RM@ -f *~ .*~ ow.tcl.h: ow.tcl ${ow_la_DEPENDENCIES} sed -e '/^$\#/d' -e '/^$$/d' -e 's/\\\"/\\\\"/g' -e 's/\"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $@ || { $(RM) $@; exit 1; } # Have to relink the library since it's generated with -bundle, it should be -dynamiclib darwin-relink: ow.la # mv .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX).old gcc -dynamiclib -flat_namespace -undefined suppress \ -o .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) \ .libs/ow.o \ ../owlib/src/c/.libs/libow.so \ ${LIBUSB_LIBS} \ ../owcapi/src/c/.libs/libowcapi.so \ -install_name $(pkglibdir)/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) \ -compatibility_version 1 -current_version 1.0 touch $@ pkgIndex.tcl: (echo 'if {[catch {package require Tcl 8.1}]} return';\ echo 'package ifneeded $(PACKAGE) $(OWTCL_VERSION)\ [list load [file join $$dir $(PACKAGE)$(TCL_SHLIB_SUFFIX)] $(PACKAGE)]'\ ) > pkgIndex.tcl # 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: owfs-2.8p15/module/owtcl/version.h0000664000175000017500000000032311370256757014100 00000000000000#if 0 OWTCL_MAJOR_VERSION = 1 OWTCL_MINOR_VERSION = 0 OWTCL_VERSION = $(OWTCL_MAJOR_VERSION).$(OWTCL_MINOR_VERSION) #endif #define OWTCL_MAJOR_VERSION 1 #define OWTCL_MINOR_VERSION 0 #define OWTCL_VERSION "1.0" owfs-2.8p15/module/owtcl/example/0000775000175000017500000000000011756315511013747 500000000000000owfs-2.8p15/module/owtcl/example/test.tcl0000664000175000017500000000141611222527724015353 00000000000000#!/usr/bin/env tclsh # -*- Tcl -*- # File: test.tcl # # $Id: test.tcl,v 1.1 2009/07/01 00:37:40 alfille Exp $ # # Start script with this command: tclsh test.tcl # package require ow 0.2 puts "Version information:" puts [ ::OW::version ] ::OW::init --fake 28 --fake 10 puts "\nDirectory-listing of / (return string)" puts [ ::OW::get "/" ] puts "\nDirectory-listing of / (return list)" set list [ ::OW::get / -list ] puts $list puts "\nFirst object in directory list" puts [ lindex $list 0 ] puts "\nRead /10.67C6697351FF/temperature" puts [ ::OW::get "/10.67C6697351FF/temperature" ] puts "\nRead /10.67C6697351FF/type" puts [ ::OW::get "/10.67C6697351FF/type" ] puts "\nRead bus.0/interface/settings/name" puts [ ::OW::get "bus.0/interface/settings/name" ] ::OW::finish owfs-2.8p15/module/owtcl/example/owdir.tcl0000664000175000017500000000153311222527724015520 00000000000000#!/usr/bin/env tclsh # -*- Tcl -*- # File: owdir.tcl # # $Id: owdir.tcl,v 1.1 2009/07/01 00:37:40 alfille Exp $ # # Start script with this command: tclsh owdir.tcl # package require ow 0.2 puts [ ::OW::version ] if { $argc == 0 } { puts "Usage:" puts "\towdir.tcl 1wire-adapter \[dir\]" puts " 1wire-adapter (required):" puts "\t'u' for USB -or-" puts "\t--fake=10,28 for a fake-adapter with DS18S20 and DS18B20-sensor -or-" puts "\t/dev/ttyS0 (or whatever) serial port -or-" puts "\t4304 for remote-server at port 4304" puts "\t192.168.1.1:4304 for remote-server at 192.168.1.1:4304" exit; } set adapter [ lindex $argv 0 ]; if { $argc > 1 } { set dir [ lindex $argv 1 ]; } else { set dir "/"; } ::OW::init $adapter #::OW::set_error_print 2; #::OW::set_error_level 9; puts [ ::OW::get $dir ] ::OW::finish owfs-2.8p15/module/owtcl/Makefile.am0000664000175000017500000000530411370256757014302 00000000000000# $Id: Makefile.am,v 1.3 2010/05/05 12:00:47 oskin Exp $ include version.h EXTRA_DIST = owtclInitScript.h tcl.m4 ow.tcl example/owdir.tcl example/test.tcl pkglib_LTLIBRARIES = ow.la ow_la_SOURCES = ow.c ow_la_LDFLAGS = -module -release $(OWTCL_VERSION) -shared -shrext "$(TCL_SHLIB_SUFFIX)" #ow_la_LIBADD = ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ow_la_LIBADD = $(TCL_LIB_SPEC) ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ${TCL_LIBS} ow_la_DEPENDENCIES = ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ow.lo: owtclInitScript.h ow.tcl.h version.h data_DATA = ow.tcl pkgIndex.tcl if HAVE_DARWIN noinst_DATA = darwin-relink endif PACKAGE = ow MAJOR_VERSION = $(OWTCL_MAJOR_VERSION) MINOR_VERSION = $(OWTCL_MINOR_VERSION) pkglibdir = @OWTCL_INSTALL_PATH@/owtcl-$(OWTCL_VERSION) #something like this. $(TCL_EXEC_PREFIX)/lib@LIBPOSTFIX@/owtcl-$(OWTCL_VERSION) datadir = $(pkglibdir) #SHLIB_SUFFIX = $(TCL_SHLIB_SUFFIX) LIBTOOL_DEPS = @LIBTOOL_DEPS@ AM_CFLAGS = -I../owlib/src/include \ -I../owcapi/src/include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ $(TCL_DEFS) \ $(TCL_SHLIB_CFLAGS) \ $(TCL_INCLUDE_SPEC) \ -DTCL_PACKAGE_PATH=\"'$(TCL_PACKAGE_PATH)'\" \ -DOWTCL_PACKAGE_PATH=\"$(pkglibdir)\" \ ${PIC_FLAGS} #LDADD = -L../owlib/src/c $(TCL_LIB_SPEC) -low -lowcapi ${TCL_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} #LDADD = $(TCL_LIB_SPEC) ../owlib/src/c/libow.la ../owcapi/src/c/libowcapi.la ${TCL_LIBS} ${PTHREAD_CFLAGS} ${PTHREAD_LIBS} #SHLIB_LD = $(TCL_SHLIB_LD) $(LIBS) -low ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-local: @RM@ -f ow.tcl.h pkgIndex.tcl darwin-relink clean-generic: @RM@ -f *~ .*~ ow.tcl.h: ow.tcl ${ow_la_DEPENDENCIES} sed -e '/^$\#/d' -e '/^$$/d' -e 's/\\\"/\\\\"/g' -e 's/\"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $@ || { $(RM) $@; exit 1; } # Have to relink the library since it's generated with -bundle, it should be -dynamiclib darwin-relink: ow.la # mv .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX).old gcc -dynamiclib -flat_namespace -undefined suppress \ -o .libs/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) \ .libs/ow.o \ ../owlib/src/c/.libs/libow.so \ ${LIBUSB_LIBS} \ ../owcapi/src/c/.libs/libowcapi.so \ -install_name $(pkglibdir)/ow-$(OWTCL_VERSION)$(TCL_SHLIB_SUFFIX) \ -compatibility_version 1 -current_version 1.0 touch $@ pkgIndex.tcl: (echo 'if {[catch {package require Tcl 8.1}]} return';\ echo 'package ifneeded $(PACKAGE) $(OWTCL_VERSION)\ [list load [file join $$dir $(PACKAGE)$(TCL_SHLIB_SUFFIX)] $(PACKAGE)]'\ ) > pkgIndex.tcl owfs-2.8p15/module/owtcl/owtclInitScript.h0000664000175000017500000000430711222527724015551 00000000000000// -*- C++ -*- // File: owtclInitScript.h // // Created: Mon Jan 10 22:53:33 2005 // // $Id: owtclInitScript.h,v 1.1 2009/07/01 00:37:40 alfille Exp $ // /* * The following string is the startup script executed when the ow is * loaded. It looks on disk in several different directories for a script * "ow.tcl" that is compatible with this version of owtcl. */ static char owtclInitScript[] = "if {[info proc owtclInit]==\"\"} {\n\ proc owtclInit {} {\n\ global tcl_pkgPath errorInfo env\n\ rename owtclInit {}\n\ set errors {}\n\ if {![info exists env(OWTCL_LIBRARY_FILE)]} {\n\ set env(OWTCL_LIBRARY_FILE) ow.tcl\n\ }\n\ if {[info exists env(OWTCL_LIBRARY)]} {\n\ lappend dirs $env(OWTCL_LIBRARY)\n\ }\n\ lappend dirs " OWTCL_PACKAGE_PATH "\n\ if {[info exists tcl_pkgPath]} {\n\ foreach i $tcl_pkgPath {\n\ lappend dirs [file join $i owtcl-" OWTCL_VERSION "] \\\n\ [file join $i owtcl] $i\n\ }\n\ }\n\ lappend dirs [pwd]\n\ foreach i $dirs {\n\ set try [file join $i $env(OWTCL_LIBRARY_FILE)]\n\ if {[file exists $try]} {\n\ if {![catch {uplevel #0 [list source $try]} msg]} {\n\ set env(OWTCL_LIBRARY) $i\n\ return\n\ } else {\n\ append errors \"$try: $msg\n$errorInfo\n\"\n\ }\n\ }\n\ }\n" #ifdef NO_EMBEDDED_RUNTIME " set msg \"Can't find a $env(OWTCL_LIBRARY_FILE) in the following directories: \n\"\n\ append msg \" $dirs\n\n$errors\n\n\"\n\ append msg \"This probably means that owtcl wasn't installed properly.\"\n\ return -code error $msg\n" #else " set env(OWTCL_LIBRARY) EMBEDDED_RUNTIME\n" " uplevel #0 {" # include "ow.tcl.h" " }\n" #endif " }\n\ }\n\ owtclInit"; /* * The init script can't make certain calls in a safe interpreter, * so we always have to use the embedded runtime for it */ static char owtclSafeInitScript[] = "if {[info proc owtclInit]==\"\"} {\n\ proc owtclInit {} {\n\ set env(OWTCL_LIBRARY) EMBEDDED_RUNTIME\n" #ifdef NO_EMBEDDED_RUNTIME " append msg \"owtcl requires embedded runtime to be compiled for\"\n\ append msg \" use in safe interpreters\"\n\ return -code error $msg\n" #endif " uplevel #0 {" # include "ow.tcl.h" " }" " }\n\ }\n\ owtclInit"; owfs-2.8p15/module/owhttpd/0000775000175000017500000000000011756315510012654 500000000000000owfs-2.8p15/module/owhttpd/src/0000775000175000017500000000000011756315510013443 500000000000000owfs-2.8p15/module/owhttpd/src/Makefile.in0000664000175000017500000005120411756250027015433 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owhttpd/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include c all: all-recursive .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 module/owhttpd/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owhttpd/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owhttpd/src/Makefile.am0000664000175000017500000000006510504776327015427 00000000000000SUBDIRS = include c clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owhttpd/src/include/0000775000175000017500000000000011756315510015066 500000000000000owfs-2.8p15/module/owhttpd/src/include/owhttpd.h0000664000175000017500000000304511617614007016651 00000000000000/* $Id: owhttpd.h,v 1.22 2011/08/07 22:56:07 alfille Exp $ OWFS and OWHTTPD one-wire file system and one-wire web server By Paul H Alfille {c} 2003 GPL palfille@earthlink.net */ /* OWHTTPD - specific header */ #ifndef OWHTTPD_H #define OWHTTPD_H #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include // getpwuid #include // initgroups #include #define SVERSION "owhttpd" #define BODYCOLOR "BGCOLOR='#BBBBBB'" #define TOPTABLE "WIDTH='100%%' BGCOLOR='#DDDDDD' BORDER='1'" #define DEVTABLE "BGCOLOR='#DDDDDD' BORDER='1'" #define VALTABLE "BGCOLOR='#DDDDDD' BORDER='1'" /* * Main routine for actually handling a request * deals with a conncection */ /* in owhttpd_handler.c */ int handle_socket(FILE * out); /* in owhttpd_present */ enum content_type { ct_text, ct_html, ct_icon }; void HTTPstart(FILE * out, const char *status, const enum content_type ct); void HTTPtitle(FILE * out, const char *title); void HTTPheader(FILE * out, const char *head); void HTTPfoot(FILE * out); /* in owhttpd_write.c */ void PostData(struct one_wire_query *owq); void ChangeData(struct one_wire_query *owq); /* in owhttpd_read.c */ void ShowDevice(FILE * out, struct parsedname *const pn); /* in owhttpd_dir.c */ void ShowDir(FILE * out, struct parsedname * pn); int Backup(const char *path); /* in ow_favicon.c */ void Favicon(FILE * out); /* in owhttpd_escape */ void httpunescape(BYTE * httpstr) ; char * httpescape( char * original_string ) ; #endif /* OWHTTPD_H */ owfs-2.8p15/module/owhttpd/src/include/Makefile.in0000664000175000017500000003661511756250027017067 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owhttpd/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = owhttpd.h 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 module/owhttpd/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owhttpd/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owhttpd/src/include/Makefile.am0000664000175000017500000000007510432627750017046 00000000000000noinst_HEADERS = owhttpd.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owhttpd/src/c/0000775000175000017500000000000011756315510013665 500000000000000owfs-2.8p15/module/owhttpd/src/c/owhttpd_escape.c0000664000175000017500000000333411617614007016764 00000000000000/* $Id: owhttpd_escape.c,v 1.2 2011/08/07 22:56:07 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #include "owhttpd.h" /* Change web-escaped string back to straight ascii */ /* Works in-place since the final string is never longer */ void httpunescape(BYTE * httpstr) { BYTE *in = httpstr; /* input string pointer */ BYTE *out = httpstr; /* output string pointer */ while (in) { switch (*in) { case '+': *out++ = ' '; break; case '\0': *out++ = '\0'; return; case '%': if ( isxdigit(in[1]) && isxdigit(in[2]) ) { ++in; *out++ = string2num((char *) in); ++in; break ; } // fall through default: *out++ = *in; break; } in++; } } /* HTTP encode */ char * httpescape( char * original_string ) { char * original_p = original_string ; char * escaped_string ; char * escaped_p ; if ( original_string == NULL ) { return NULL ; } escaped_p = escaped_string = owmalloc( strlen(original_string)*3 + 1 ) ; if ( escaped_string == NULL ) { return NULL ; } while (1) { switch ( *original_p ) { case '\0': *escaped_p = '\0' ; return escaped_string ; case ' ': case '!': case '"': case '#': case '$': case '%': case '@': case '\'': case '(': case ')': case '<': case '>': case ';': case ':': case '+': case ',': case '=': UCLIBCLOCK; escaped_p += sprintf( escaped_p, "%%%.2X", *original_p++ ) ; UCLIBCUNLOCK; break ; default: *escaped_p++ = *original_p++ ; break ; } } } owfs-2.8p15/module/owhttpd/src/c/owhttpd_present.c0000644000175000017500000000356311667517525017222 00000000000000/* $Id: owhttpd_present.c,v 1.14 2011/11/04 01:53:12 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #define SVERSION "owhttpd" #include "owhttpd.h" /* ------------ Protoypes ---------------- */ /* Utility HTML page display functions */ void HTTPstart(FILE * out, const char *status, const enum content_type ct) { char d[44]; time_t t = NOW_TIME; size_t l = strftime(d, sizeof(d), "%a, %d %b %Y %T GMT", gmtime(&t)); fprintf(out, "HTTP/1.0 %s\r\n", status); fprintf(out, "Date: %*s\n", (int) l, d); fprintf(out, "Server: %s\r\n", SVERSION); fprintf(out, "Last-Modified: %*s\r\n", (int) l, d); /* * fprintf( out, "MIME-version: 1.0\r\n" ); */ switch (ct) { case ct_html: fprintf(out, "Content-Type: text/html\r\n"); break; case ct_icon: fprintf(out, "Content-Length: 894\r\n"); fprintf(out, "Connection: close\r\n"); break ; case ct_text: fprintf(out, "Content-Type: text/plain\r\n"); break ; } fprintf(out, "\r\n"); } void HTTPtitle(FILE * out, const char *title) { fprintf(out, "1-Wire Web: %s\n", title); } void HTTPheader(FILE * out, const char *head) { struct connection_in * in ; in = Inbound_Control.head ; fprintf(out, "
OWFS on %sBus listingOWFS homepageDallas/Maximby Paul H Alfille
\n", (in==NO_CONNECTION)?"no buses":SAFESTRING(SOC(in)->devicename)); fprintf(out, "

%s


\n", head); } void HTTPfoot(FILE * out) { fprintf(out, ""); } owfs-2.8p15/module/owhttpd/src/c/owhttpd_favicon.c0000644000175000017500000001372111673262742017157 00000000000000/* $Id: owhttpd_favicon.c,v 1.6 2011/12/18 04:02:42 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #include "owhttpd.h" // #include /* for dirname() */ /* ------------ Protoypes ---------------- */ static const char favicon[] = { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x28, 0x03, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; void Favicon(FILE * out) { int i; HTTPstart(out, "200 OK", ct_icon); for (i = 0; i < 894; ++i) { fprintf(out, "%c", favicon[i]); } HTTPfoot(out); } owfs-2.8p15/module/owhttpd/src/c/owhttpd_handler.c0000644000175000017500000003113211674131131017127 00000000000000/* $Id: owhttpd_handler.c,v 1.98 2011/12/20 03:40:28 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #define _GNU_SOURCE #include // for getline #undef _GNU_SOURCE #include "owhttpd.h" // #include /* for dirname() */ /* ------------ Protoypes ---------------- */ struct urlparse { char *line; size_t line_length ; char *cmd; char *file; char *version; char *request; char *value; }; enum http_return { http_ok, http_dir, http_icon, http_400, http_404 } ; /* Error page functions */ static void Bad400(FILE * out, struct parsedname * pn); static void Bad404(FILE * out, struct parsedname * pn); /* URL parsing function */ static void URLparse(struct urlparse *up); static enum http_return handle_GET(FILE * out, struct urlparse * up) ; static enum http_return handle_POST(FILE * out, struct urlparse * up) ; static void ReadToCRLF( FILE * out ) ; static void TrimBoundary( char ** boundary ) ; static int GetPostData( char * boundary, struct memblob * mb, FILE * out ) ; static char * GetPostPath( FILE * out ) ; /* --------------- Functions ---------------- */ /* Main handler for a web page */ int handle_socket(FILE * out) { enum http_return http_code = http_ok ; struct urlparse up; struct parsedname s_pn; struct parsedname * pn = &s_pn ; up.line = NULL ; // prep for getline with null. Will be allocated by getline. if ( getline(&(up.line), &(up.line_length), out) >= 0 ) { LEVEL_CALL("PreParse line=%s", up.line); URLparse(&up); /* Break up URL */ httpunescape((BYTE *) up.file ); httpunescape((BYTE *) up.request ); httpunescape((BYTE *) up.value ); LEVEL_CALL ("WLcmd: %s\tfile: %s\trequest: %s\tvalue: %s\tversion: %s", SAFESTRING(up.cmd), SAFESTRING(up.file), SAFESTRING(up.request), SAFESTRING(up.value), SAFESTRING(up.version)); if (up.cmd == NULL) { // No command line in request pn = NO_PARSEDNAME ; http_code = http_400 ; } else if (up.file == NULL) { // could not parse a path from the request pn = NO_PARSEDNAME ; http_code = http_404 ; } else if (strcasecmp(up.file, "/favicon.ico") == 0) { // special case for the icon LEVEL_DEBUG("http icon request."); ReadToCRLF(out) ; pn = NO_PARSEDNAME ; http_code = http_icon ; } else if (FS_ParsedName(up.file, pn)) { // Can't understand the file name = URL LEVEL_DEBUG("http %s not understood.",up.file); ReadToCRLF(out) ; pn = NO_PARSEDNAME ; http_code = http_404 ; } else if (pn->selected_device == NO_DEVICE) { // directory! LEVEL_DEBUG("http directory request."); ReadToCRLF(out) ; http_code = http_dir ; } else if (strcmp(up.cmd, "POST") == 0) { LEVEL_DEBUG("http POST request."); http_code = handle_POST( out, &up ) ; } else if (strcmp(up.cmd, "GET") == 0) { LEVEL_DEBUG("http GET request."); http_code = handle_GET( out, &up ) ; // special case for possible alias changes // Parsedname structure may point to a device that no longer exists if ( http_code == http_ok ) { // was able to write FS_ParsedName_destroy(pn); if (FS_ParsedName(up.file, pn)) { // Can't understand the device name any more LEVEL_DEBUG("Alias change for %s",up.file); if (FS_ParsedName("/", pn)) { // Try to set to root LEVEL_DEBUG("Set to root"); pn = NO_PARSEDNAME ; http_code = http_404 ; } } } } else { ReadToCRLF(out) ; http_code = http_400 ; } free(up.line) ; } else { LEVEL_DEBUG("No http data."); pn = NO_PARSEDNAME ; http_code = http_400 ; } // This is necessary for SunOS fflush(out); switch ( http_code ) { case http_icon: Favicon(out); break ; case http_400: Bad400(out,pn); break ; case http_404: Bad404(out,pn); break ; case http_dir: ShowDir(out, pn); break ; case http_ok: ShowDevice(out, pn); break ; } if ( pn != NO_PARSEDNAME ) { FS_ParsedName_destroy(pn); } return 0 ; } /* The HTTP request is a GET message */ static enum http_return handle_GET(FILE * out, struct urlparse * up) { /* read lines until blank */ if (up->version) { ReadToCRLF( out ) ; } if (up->request == NULL) { // NO request -- just a read or dir, not a write LEVEL_DEBUG("Simple GET request -- read a value or directory"); return http_ok ; } else if (up->value==NULL) { // write without a value LEVEL_DEBUG("Null value for write command -- Bad URL."); return http_400 ; } else { /* First write new values, then show */ OWQ_allocate_struct_and_pointer(owq_write); size_t req_leng = strlen(up->request) ; size_t fil_leng = strlen(up->file) ; char * remove_filetype = NULL ; // remove the filetype from the file name // see if the URL includes the property twice -- happens if only a property is shown if ( req_leng <= fil_leng && strcasecmp(up->request,&up->file[fil_leng-req_leng])==0 ) { struct parsedname s_pn ; if ( FS_ParsedName(up->file,&s_pn)==0 ) { if ( s_pn.selected_filetype != NO_FILETYPE ) { LEVEL_DEBUG("Property name %s duplicated on command line. Not a problem.",up->request) ; remove_filetype = &up->file[fil_leng-req_leng-1] ; remove_filetype[0] = '\0'; } FS_ParsedName_destroy(&s_pn); } } // Create the owq to write to. if ( BAD( OWQ_create_plus(up->file, up->request, owq_write) ) ) { // for write return http_404 ; } OWQ_assign_write_buffer( up->value, strlen(up->value), 0, owq_write ) ; /* Execute the write */ ChangeData(owq_write); OWQ_destroy(owq_write); if ( remove_filetype != NULL ) { // restore full URL path remove_filetype[0] = '/' ; } return http_ok ; } } /* The HTTP request is a POST message */ static enum http_return handle_POST(FILE * out, struct urlparse * up) { enum http_return http_code ; char * boundary = NULL ; size_t boundary_length ; /* read lines until blank */ if (up->version) { ReadToCRLF( out ) ; } // use getline because it handles null chars if ( getline(&boundary,&boundary_length,out) > 2 ) { char * post_path = GetPostPath( out ) ; TrimBoundary( &boundary) ; LEVEL_CALL("POST boundary=%s",boundary); if ( post_path ) { struct memblob mb ; if ( GetPostData( boundary, &mb, out ) == 0 ) { struct one_wire_query * owq = OWQ_create_from_path( post_path ) ; // for write if ( owq ) { LEVEL_DEBUG("File upload %s for %ld bytes",post_path,MemblobLength(&mb)); if ( GOOD( OWQ_allocate_write_buffer( (char *) MemblobData(&mb), MemblobLength(&mb), 0, owq)) ) { PostData(owq); http_code = http_ok ; } else { http_code = http_404 ; } OWQ_destroy(owq) ; } else { LEVEL_DEBUG("Can't create %s",post_path); http_code = http_404 ; } } else { LEVEL_DEBUG("Can't read full binary data from file upload"); http_code = http_404 ; } MemblobClear( &mb ) ; owfree(post_path ) ; } else { LEVEL_DEBUG("Can't read property name from file upload"); http_code = http_404 ; } } if ( boundary ) { free(boundary) ; // allocated in getline with malloc, not owmalloc } return http_code ; } /* URL handler for a web page */ static void URLparse(struct urlparse *up) { char *str; int first = 1; up->cmd = up->version = up->file = up->request = up->value = NULL; /* Separate out the three parameters, all in same line */ for (str = up->line; *str; str++) { switch (*str) { case ' ': case '\n': case '\r': *str = '\0'; first = 1; break; default: if (!first || up->version) { break; } else if (up->file) { up->version = str; } else if (up->cmd) { up->file = str; } else { up->cmd = str; } first = 0; } } /* Separate out the filename and FORM data */ if (up->file) { for (str = up->file; *str; str++) { if (*str == '?') { *str = '\0'; up->request = str + 1; break; } } /* trim off trailing '/' */ --str; if (*str == '/' && str > up->file) *str = '\0'; } /* Separate out the FORM field and value */ if (up->request) { for (str = up->request; *str; str++) { if (*str == '=') { *str = '\0'; up->value = str + 1; break; } } } /* Remove garbage from oned of value */ if (up->value) { for (str = up->value; *str; str++) { if (*str == '&') { *str = '\0'; break; } } /* Special case -- checkbox off, CHANGE is value read */ if (strcmp("CHANGE", up->value) == 0) { up->value[0] = '0'; up->value[1] = '\0'; } } LEVEL_DEBUG("URL parse file=%s, request=%s, value=%s", SAFESTRING(up->file), SAFESTRING(up->request), SAFESTRING(up->value)); } static void Bad400(FILE * out, struct parsedname *pn) { LEVEL_CALL("Return a 400 HTTP error code"); if ( pn == NULL ) { HTTPstart(out, "400 Bad Request", ct_text); fprintf(out, "null"); } else if ( pn->state & ePS_text ) { HTTPstart(out, "400 Bad Request", ct_text); fprintf(out, "400 Bad request"); } else if ( pn->state & ePS_json ) { HTTPstart(out, "400 Bad Request", ct_text); fprintf(out, "null"); } else { HTTPstart(out, "400 Bad Request", ct_html); HTTPtitle(out, "Error 400 -- Bad request"); HTTPheader(out, "Unrecognized Request"); fprintf(out, "

The 1-wire web server is carefully constrained for security and stability. Your requested web page is not recognized.

"); fprintf(out, "

Navigate from the Main page for best results.

"); } HTTPfoot(out); } static void Bad404(FILE * out, struct parsedname *pn) { LEVEL_CALL("Return a 404 HTTP error code"); if ( pn == NULL ) { HTTPstart(out, "404 Not Found", ct_text); fprintf(out, "null"); } else if ( pn->state & ePS_text ) { HTTPstart(out, "404 Not Found", ct_text); fprintf(out, "404 Not Found"); } else if ( pn->state & ePS_json ) { HTTPstart(out, "404 Not Found", ct_text); fprintf(out, "null"); } else { HTTPstart(out, "404 Not Found", ct_html); HTTPtitle(out, "Error 404 -- Item doesn't exist"); HTTPheader(out, "Nonexistent Device"); fprintf(out, "

The 1-wire web server is carefully constrained for security and stability. Your requested device is not recognized.

"); fprintf(out, "

Navigate from the Main page for best results.

"); } HTTPfoot(out); } static void ReadToCRLF( FILE * out ) { char * text_in = NULL ; size_t length_in = 0 ; ssize_t getline_length ; /* read lines until blank */ while ( (getline_length = getline(&text_in, &length_in, out)) > 0 ) { LEVEL_DEBUG("More (%d) data:%s",(int)getline_length,text_in); if ( strcmp(text_in, "\r\n")==0 || strcmp(text_in, "\n")==0 ) { break ; } } if ( text_in != NULL ) { free( text_in) ; } } static void TrimBoundary( char ** boundary ) { char * remove_char ; remove_char = strrchr( *boundary, '\n' ) ; if ( remove_char ) { *remove_char = '\0' ; } remove_char = strrchr( *boundary, '\r' ) ; if ( remove_char ) { *remove_char = '\0' ; } } static char * GetPostPath( FILE * out ) { char * text_in = NULL ; size_t length_in = 0 ; char * path_found = NO_PATH ; /* read lines until blank */ while (getline(&text_in, &length_in, out)>-1) { char * namestart ; LEVEL_DEBUG("Post data:%s",SAFESTRING(text_in)); if ( strcmp(text_in, "\r\n")==0 || strcmp(text_in, "\n")==0 ) { if ( text_in ) { free( text_in) ; } return path_found ; } namestart = strstr(text_in," name=\"") ; if (namestart != NULL ) { char * nameend ; namestart += 7 ; nameend = strchr(namestart,'\"') ; if ( nameend != NULL ) { nameend[0] = '\0' ; if( path_found ) { owfree(path_found); } path_found = owstrdup( namestart ) ; } } } if ( text_in ) { free( text_in) ; } return path_found ; } // read data from file upload static int GetPostData( char * boundary, struct memblob * mb, FILE * out ) { char * data = NULL ; size_t data_length ; ssize_t read_this_pass ; MemblobInit( mb, 1000 ) ; // increqment in 1K amounts (arbitrary) while ( (read_this_pass = getline(&data, &data_length, out)) > -1 ) { Debug_Bytes(boundary,(BYTE *)data,(size_t)read_this_pass); if ( strstr( data, boundary ) != NULL ) { free(data) ; // allocated by getline with malloc, not owmalloc MemblobTrim(2,mb) ; // trim off final 0x0A 0x0D LEVEL_DEBUG("Read in POST file upload of %ld bytes",MemblobLength(mb)); return 0 ; } if ( MemblobAdd( (BYTE *)data, (size_t)read_this_pass, mb ) ) { LEVEL_DEBUG("Data size too large"); free(data) ; // allocated by getline with malloc, not owmalloc return 1 ; } } if ( data ) { free(data) ; // allocated by getline with malloc, not owmalloc } LEVEL_DEBUG("HTTP error -- no ending MIME boundary"); return 1 ; } owfs-2.8p15/module/owhttpd/src/c/Makefile.in0000664000175000017500000005235211756250027015662 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.30 2010/04/21 18:17:25 alfille Exp $ 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@ target_triplet = @target@ bin_PROGRAMS = owhttpd$(EXEEXT) subdir = module/owhttpd/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_owhttpd_OBJECTS = owhttpd.$(OBJEXT) owhttpd_handler.$(OBJEXT) \ owhttpd_present.$(OBJEXT) owhttpd_write.$(OBJEXT) \ owhttpd_read.$(OBJEXT) owhttpd_dir.$(OBJEXT) \ owhttpd_escape.$(OBJEXT) owhttpd_favicon.$(OBJEXT) owhttpd_OBJECTS = $(am_owhttpd_OBJECTS) owhttpd_LDADD = $(LDADD) am__DEPENDENCIES_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(owhttpd_SOURCES) DIST_SOURCES = $(owhttpd_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ owhttpd_SOURCES = owhttpd.c \ owhttpd_handler.c \ owhttpd_present.c \ owhttpd_write.c \ owhttpd_read.c \ owhttpd_dir.c \ owhttpd_escape.c \ owhttpd_favicon.c owhttpd_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} 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 module/owhttpd/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owhttpd/src/c/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-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_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 owhttpd$(EXEEXT): $(owhttpd_OBJECTS) $(owhttpd_DEPENDENCIES) $(EXTRA_owhttpd_DEPENDENCIES) @rm -f owhttpd$(EXEEXT) $(LINK) $(owhttpd_OBJECTS) $(owhttpd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_dir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_escape.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_favicon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_handler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_present.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owhttpd_write.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -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-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic 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-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owhttpd/src/c/owhttpd_dir.c0000644000175000017500000001022711654642610016301 00000000000000/* $Id: owhttpd_dir.c,v 1.21 2011/11/04 01:53:12 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #include "owhttpd.h" // #include /* for dirname() */ /* --------------- Functions ---------------- */ static void ShowDirText(FILE * out, struct parsedname * pn); static void ShowDirJson(FILE * out, struct parsedname * pn); /* Find he next higher level by search for last slash that doesn't end the string */ /* return length of "higher level" */ /* Assumes good path: null delimitted starts with / non-null */ int Backup(const char *path) { int i = strlen(path) - 1; if (i == 0) return 1; if (path[i] == '/') --i; while (path[i] != '/') --i; return i + 1; } #define name_directory "directory" #define name_onewire_chip "1-wire chip" /* Callback function to FS_dir */ static void ShowDirCallback(void *v, const struct parsedname *pn_entry) { /* uncached tag */ /* device name */ /* Have to allocate all buffers to make it work for Coldfire */ FILE *out = v; const char *nam; const char *typ; char * escaped_path = httpescape( pn_entry->path ) ; if (IsDir(pn_entry)) { nam = FS_DirName(pn_entry); typ = name_directory; } else { nam = pn_entry->selected_device->readable_name; typ = name_onewire_chip; } fprintf(out, "%s%s%s", escaped_path==NULL ? pn_entry->path : escaped_path, FS_DirName(pn_entry), nam, typ); if ( escaped_path ) { owfree( escaped_path ) ; } } /* Misnamed. Actually all directory */ void ShowDir(FILE * out, struct parsedname * pn) { int b = Backup(pn->path); // length of string to get to higher level if (pn->state & ePS_text) { ShowDirText(out, pn); return; } else if (pn->state & ePS_json) { ShowDirJson(out, pn); return; } HTTPstart(out, "200 OK", ct_html); HTTPtitle(out, "Directory"); if (NotRealDir(pn)) { /* return whole path since tree structure could be much deeper now */ /* first / is stripped off */ HTTPheader(out, &pn->path[1]); } else if (pn->state) { /* return whole path since tree structure could be much deeper now */ /* first / is stripped off */ HTTPheader(out, &pn->path[1]); } else { HTTPheader(out, "directory"); } fprintf(out, ""); if (b != 1) { char * escaped_path = httpescape( pn->path ) ; fprintf(out, "", b, escaped_path==NULL ? pn->path : escaped_path ); if ( escaped_path ) { owfree( escaped_path ) ; } } else { fprintf(out, ""); } FS_dir(ShowDirCallback, out, pn); fprintf(out, "
uphigher leveldirectory
tophighest leveldirectory
"); HTTPfoot(out); } static void ShowDirTextCallback(void *v, const struct parsedname *const pn_entry) { /* uncached tag */ /* device name */ /* Have to allocate all buffers to make it work for Coldfire */ FILE *out = v; const char *nam; const char *typ; if (IsDir(pn_entry)) { nam = FS_DirName(pn_entry); typ = name_directory; } else { nam = pn_entry->selected_device->readable_name; typ = name_onewire_chip; } fprintf(out, "%s %s \"%s\"\r\n", FS_DirName(pn_entry), nam, typ); } static void ShowDirText(FILE * out, struct parsedname * pn) { HTTPstart(out, "200 OK", ct_text); FS_dir(ShowDirTextCallback, out, pn); return; } static void ShowDirJsonCallback(void *v, const struct parsedname *const pn_entry) { /* uncached tag */ /* device name */ /* Have to allocate all buffers to make it work for Coldfire */ FILE *out = v; const char *nam; if (IsDir(pn_entry)) { nam = FS_DirName(pn_entry); } else { nam = pn_entry->selected_device->readable_name; } fprintf(out, "\"%s\":[],\n", nam ) ; } static void ShowDirJson(FILE * out, struct parsedname * pn) { HTTPstart(out, "200 OK", ct_text); fprintf(out, "{" ); FS_dir(ShowDirJsonCallback, out, pn); fprintf(out, "}" ); return; } owfs-2.8p15/module/owhttpd/src/c/owhttpd_write.c0000664000175000017500000000345111363740313016654 00000000000000/* $Id: owhttpd_write.c,v 1.16 2010/04/22 03:21:47 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #include "owhttpd.h" // #include /* for dirname() */ /* string format functions */ static int hex_convert(char *str); static void hex_only(char *str); /* --------------- Functions ---------------- */ // POST data -- a file upload void PostData(struct one_wire_query *owq) { /* Do command processing and make changes to 1-wire devices */ LEVEL_DETAIL("Uploaded Data path=%s size=%ld", PN(owq)->path, OWQ_size(owq)); FS_write_postparse(owq); } // Standard Data via GET void ChangeData(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); ASCII *value_string = OWQ_buffer(owq); /* Do command processing and make changes to 1-wire devices */ LEVEL_DETAIL("New data path=%s value=%s", pn->path, value_string); switch (pn->selected_filetype->format) { case ft_binary: hex_only(value_string); OWQ_size(owq) = hex_convert(value_string); break; default: OWQ_size(owq) = strlen(value_string); break; } FS_write_postparse(owq); } /* reads an as ascii hex string, strips out non-hex, converts in place */ static void hex_only(char *str) { char *leader = str; char *trailer = str; while (*leader) { if (isxdigit(*leader)) { *trailer++ = *leader; } leader++; } *trailer = '\0'; } /* reads an as ascii hex string, converts in place */ /* returns length */ static int hex_convert(char *str) { char *leader = str; BYTE *trailer = (BYTE *) str; while (*leader) { *trailer++ = string2num(leader); leader += 2 ; } return trailer - ((BYTE *) str); } owfs-2.8p15/module/owhttpd/src/c/Makefile.am0000664000175000017500000000147611363640465015655 00000000000000# $Id: Makefile.am,v 1.30 2010/04/21 18:17:25 alfille Exp $ bin_PROGRAMS = owhttpd owhttpd_SOURCES = owhttpd.c \ owhttpd_handler.c \ owhttpd_present.c \ owhttpd_write.c \ owhttpd_read.c \ owhttpd_dir.c \ owhttpd_escape.c \ owhttpd_favicon.c owhttpd_DEPENDENCIES = ../../../owlib/src/c/libow.la AM_CFLAGS = -I../include \ -I../../../owlib/src/include \ -L../../../owlib/src/c \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owhttpd/src/c/owhttpd_read.c0000644000175000017500000004344711655103372016446 00000000000000/* $Id: owhttpd_read.c,v 1.51 2011/11/05 00:44:42 alfille Exp $ * http.c for owhttpd (1-wire web server) * By Paul Alfille 2003, using libow * offshoot of the owfs ( 1wire file system ) * * GPL license ( Gnu Public Lincense ) * * Based on chttpd. copyright(c) 0x7d0 greg olszewski * */ #include "owhttpd.h" // #include /* for dirname() */ /* --------------- Prototypes---------------- */ //static void Show(FILE * out, const char *const path, const char *const file); //static void ShowText(FILE * out, const char *path, const char *file); static void Show(FILE * out, const struct parsedname *pn_entry); static void ShowDirectory(FILE * out, const struct parsedname *pn_entry); static void ShowReadWrite(FILE * out, struct one_wire_query *owq); static void ShowReadonly(FILE * out, struct one_wire_query *owq); static void ShowWriteonly(FILE * out, struct one_wire_query *owq); static void ShowStructure(FILE * out, struct one_wire_query *owq); static void StructureDetail(FILE * out, const char * structure_details ); static void Upload( FILE * out, const struct parsedname * pn ) ; static void ShowText(FILE * out, const struct parsedname *pn_entry); static void ShowTextDirectory(FILE * out, const struct parsedname *pn_entry); static void ShowTextReadWrite(FILE * out, struct one_wire_query *owq); static void ShowTextReadonly(FILE * out, struct one_wire_query *owq); static void ShowTextWriteonly(FILE * out, struct one_wire_query *owq); static void ShowTextStructure(FILE * out, struct one_wire_query *owq); static void ShowJson(FILE * out, const struct parsedname *pn_entry); static void ShowJsonDirectory(FILE * out, const struct parsedname *pn_entry); static void ShowJsonReadWrite(FILE * out, struct one_wire_query *owq); static void ShowJsonReadonly(FILE * out, struct one_wire_query *owq); static void ShowJsonWriteonly(FILE * out, struct one_wire_query *owq); static void ShowJsonStructure(FILE * out, struct one_wire_query *owq); static void StructureDetailJson(FILE * out, const char * structure_details ); /* --------------- Functions ---------------- */ /* Device entry -- table line for a filetype */ static void Show(FILE * out, const struct parsedname *pn_entry) { struct one_wire_query *owq = OWQ_create_from_path(pn_entry->path); // for read or dir /* Left column */ fprintf(out, "%s", FS_DirName(pn_entry)); if (owq == NO_ONE_WIRE_QUERY) { fprintf(out, "Memory exhausted"); } else if ( BAD( OWQ_allocate_read_buffer(owq)) ) { fprintf(out, "Memory exhausted"); } else if (pn_entry->selected_filetype == NO_FILETYPE) { ShowDirectory(out, pn_entry); } else if (IsStructureDir(pn_entry)) { ShowStructure(out, owq); } else if (pn_entry->selected_filetype->format == ft_directory || pn_entry->selected_filetype->format == ft_subdir) { // Directory ShowDirectory(out, pn_entry); } else if (pn_entry->selected_filetype->write == NO_WRITE_FUNCTION || Globals.readonly) { // Unwritable if (pn_entry->selected_filetype->read != NO_READ_FUNCTION) { ShowReadonly(out, owq); } } else { // Writeable if (pn_entry->selected_filetype->read == NO_READ_FUNCTION) { ShowWriteonly(out, owq); } else { ShowReadWrite(out, owq); } } fprintf(out, "\r\n"); OWQ_destroy(owq); } /* Device entry -- table line for a filetype */ static void ShowReadWrite(FILE * out, struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; const char *file = FS_DirName(pn); SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { fprintf(out, "Error: %s", strerror(-read_return)); return; } switch (pn->selected_filetype->format) { case ft_binary: { int i = 0; fprintf(out, "
"); Upload( out, pn ) ; break; } case ft_yesno: case ft_bitfield: if (pn->extension >= 0) { fprintf(out, "
", file, (OWQ_buffer(owq)[0] == '0') ? "" : "CHECKED", file); break; } // fall through default: fprintf(out, "
", file, read_return, OWQ_buffer(owq)); break; } } static void Upload( FILE * out, const struct parsedname * pn ) { fprintf(out,"
Load from file:
",pn->path); } /* Device entry -- table line for a filetype */ static void ShowReadonly(FILE * out, struct one_wire_query *owq) { SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { fprintf(out, "Error: %s", strerror(-read_return)); return; } switch (PN(owq)->selected_filetype->format) { case ft_binary: { int i = 0; fprintf(out, "
");
			while (i < read_return) {
				fprintf(out, "%.2hhX", OWQ_buffer(owq)[i]);
				if (((++i) < read_return) && (i & 0x1F) == 0) {
					fprintf(out, "\r\n");
				}
			}
			fprintf(out, "
"); break; } case ft_yesno: case ft_bitfield: if (PN(owq)->extension >= 0) { switch (OWQ_buffer(owq)[0]) { case '0': fprintf(out, "NO (0)"); break; case '1': fprintf(out, "YES (1)"); break; } break; } // fall through default: fprintf(out, "%.*s", read_return, OWQ_buffer(owq)); break; } } /* Structure entry */ static void ShowStructure(FILE * out, struct one_wire_query *owq) { SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { fprintf(out, "Error: %s", strerror(-read_return)); return; } fprintf(out, "%.*s", read_return, OWQ_buffer(owq)); // Optional structure details StructureDetail(out,OWQ_buffer(owq)) ; } /* Detailed (parsed) structure entry */ static void StructureDetail(FILE * out, const char * structure_details ) { char format_type ; int extension ; int elements ; char rw[4] ; int size ; if ( sscanf( structure_details, "%c,%d,%d,%2s,%d,", &format_type, &extension, &elements, rw, &size ) < 5 ) { return ; } fprintf(out, "
"); switch( format_type ) { case 'b': fprintf(out, "Binary string"); break ; case 'a': fprintf(out, "Ascii string"); break ; case 'D': fprintf(out, "Directory"); break ; case 'i': fprintf(out, "Integer value"); break ; case 'u': fprintf(out, "Unsigned integer value"); break ; case 'f': fprintf(out, "Floating point value"); break ; case 'l': fprintf(out, "Alias"); break ; case 'y': fprintf(out, "Yes/No value"); break ; case 'd': fprintf(out, "Date value"); break ; case 't': fprintf(out, "Temperature value"); break ; case 'g': fprintf(out, "Delta temperature value"); break ; case 'p': fprintf(out, "Pressure value"); break ; default: fprintf(out, "Unknown value type"); } fprintf(out, ", "); if ( elements == 1 ) { fprintf(out, "Singleton"); } else if ( extension == EXTENSION_BYTE ) { fprintf(out, "Array of %d bits as a BYTE",elements); } else if ( extension == EXTENSION_ALL ) { fprintf(out, "Array of %d elements combined",elements); } else { fprintf(out, "Element %d (of %d)",extension,elements); } fprintf(out, ", "); if ( strncasecmp( rw, "rw", 2 ) == 0 ) { fprintf(out, "Read/Write"); } else if ( strncasecmp( rw, "ro", 2 ) == 0 ) { fprintf(out, "Read only"); } else if ( strncasecmp( rw, "wo", 2 ) == 0 ) { fprintf(out, "Write only"); } else{ fprintf(out, "No access"); } fprintf(out, ", "); if ( format_type == 'b' ) { fprintf(out, "%d bytes",size); } else { fprintf(out, "%d characters",size); } } /* Device entry -- table line for a filetype */ static void ShowWriteonly(FILE * out, struct one_wire_query *owq) { const char *file = FS_DirName(PN(owq)); switch (PN(owq)->selected_filetype->format) { case ft_binary: fprintf(out, "
", file, (int) (OWQ_size(owq) >> 5)); Upload(out,PN(owq)) ; break; case ft_yesno: case ft_bitfield: if (PN(owq)->extension >= 0) { fprintf(out, "
", file, file); break; } // fall through default: fprintf(out, "
", file); break; } } static void ShowDirectory(FILE * out, const struct parsedname *pn_entry) { fprintf(out, "%s", pn_entry->path, FS_DirName(pn_entry)); } /* Device entry -- table line for a filetype */ static void ShowText(FILE * out, const struct parsedname *pn_entry) { struct one_wire_query *owq = OWQ_create_from_path(pn_entry->path); // for read or dir /* Left column */ fprintf(out, "%s ", FS_DirName(pn_entry)); if (owq == NO_ONE_WIRE_QUERY) { } else if ( BAD( OWQ_allocate_read_buffer(owq)) ) { //fprintf(out, "(memory exhausted)"); } else if (pn_entry->selected_filetype == NO_FILETYPE) { ShowTextDirectory(out, pn_entry); } else if (pn_entry->selected_filetype->format == ft_directory || pn_entry->selected_filetype->format == ft_subdir) { ShowTextDirectory(out, pn_entry); } else if (IsStructureDir(pn_entry)) { ShowTextStructure(out, owq); } else if (pn_entry->selected_filetype->write == NO_WRITE_FUNCTION || Globals.readonly) { // Unwritable if (pn_entry->selected_filetype->read != NO_READ_FUNCTION) { ShowTextReadonly(out, owq); } } else { // Writeable if (pn_entry->selected_filetype->write == NO_READ_FUNCTION) { ShowTextWriteonly(out, owq); } else { ShowTextReadWrite(out, owq); } } fprintf(out, "\r\n"); OWQ_destroy(owq); } /* Device entry -- table line for a filetype */ static void ShowTextStructure(FILE * out, struct one_wire_query *owq) { SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { //fprintf(out, "error: %s", strerror(-read_return)); return; } fprintf(out, "%.*s", read_return, OWQ_buffer(owq)); } /* Device entry -- table line for a filetype */ static void ShowTextReadWrite(FILE * out, struct one_wire_query *owq) { SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { //fprintf(out, "error: %s", strerror(-read_return)); return; } switch (PN(owq)->selected_filetype->format) { case ft_binary: { int i; for (i = 0; i < read_return; ++i) { fprintf(out, "%.2hhX", OWQ_buffer(owq)[i]); } break; } case ft_yesno: case ft_bitfield: if (PN(owq)->extension >= 0) { fprintf(out, "%c", OWQ_buffer(owq)[0]); break; } // fall through default: fprintf(out, "%.*s", read_return, OWQ_buffer(owq)); break; } } /* Device entry -- table line for a filetype */ static void ShowTextReadonly(FILE * out, struct one_wire_query *owq) { ShowTextReadWrite(out, owq); } /* Device entry -- table line for a filetype */ static void ShowTextWriteonly(FILE * out, struct one_wire_query *owq) { (void) owq; fprintf(out, "(writeonly)"); } static void ShowTextDirectory(FILE * out, const struct parsedname *pn_entry) { (void) out; (void) pn_entry; } /* Now show the device */ static void ShowDeviceTextCallback(void *v, const struct parsedname * pn_entry) { FILE *out = v; ShowText(out, pn_entry); } static void ShowDeviceCallback(void *v, const struct parsedname * pn_entry) { FILE *out = v; // Show(sds->out, sds->path, FS_DirName(pn_entry)); Show(out, pn_entry); } static void ShowDeviceText(FILE * out, struct parsedname *pn) { HTTPstart(out, "200 OK", ct_text); if (pn->selected_filetype == NO_DEVICE) { /* whole device */ //printf("whole directory path=%s \n", pn->path); FS_dir(ShowDeviceTextCallback, out, pn); } else { /* Single item */ //printf("single item path=%s\n", pn->path); ShowText(out, pn); } } /* Device entry -- table line for a filetype */ static void ShowJson(FILE * out, const struct parsedname *pn_entry) { struct one_wire_query *owq = OWQ_create_from_path(pn_entry->path); // for read or dir if (owq == NO_ONE_WIRE_QUERY) { fprintf(out, "null"); } else if ( BAD( OWQ_allocate_read_buffer(owq)) ) { fprintf(out, "null"); } else if (pn_entry->selected_filetype == NO_FILETYPE) { ShowJsonDirectory(out, pn_entry); } else if (IsStructureDir(pn_entry)) { ShowJsonStructure(out, owq); } else if (pn_entry->selected_filetype->format == ft_directory || pn_entry->selected_filetype->format == ft_subdir) { ShowJsonDirectory(out, pn_entry); } else if (pn_entry->selected_filetype->write == NO_WRITE_FUNCTION || Globals.readonly) { // Unwritable if (pn_entry->selected_filetype->read != NO_READ_FUNCTION) { ShowJsonReadonly(out, owq); } } else { // Writeable if (pn_entry->selected_filetype->write == NO_READ_FUNCTION) { ShowJsonWriteonly(out, owq); } else { ShowJsonReadWrite(out, owq); } } OWQ_destroy(owq); } /* Device entry -- table line for a filetype */ static void ShowJsonStructure(FILE * out, struct one_wire_query *owq) { SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { fprintf(out, "null"); return; } fprintf(out, "\"%.*s\":", read_return, OWQ_buffer(owq)); StructureDetailJson( out, OWQ_buffer(owq) ) ; } /* Detailed (parsed) structure entry */ static void StructureDetailJson(FILE * out, const char * structure_details ) { char format_type ; int extension ; int elements ; char rw[4] ; int size ; if ( sscanf( structure_details, "[\"%c\",\"%d\",\"%d\",\"%2s\",\"%d\",", &format_type, &extension, &elements, rw, &size ) < 5 ) { return ; } fprintf(out, "\""); switch( format_type ) { case 'b': fprintf(out, "Binary string"); break ; case 'a': fprintf(out, "Ascii string"); break ; case 'D': fprintf(out, "Directory"); break ; case 'i': fprintf(out, "Integer value"); break ; case 'u': fprintf(out, "Unsigned integer value"); break ; case 'f': fprintf(out, "Floating point value"); break ; case 'l': fprintf(out, "Alias"); break ; case 'y': fprintf(out, "Yes/No value"); break ; case 'd': fprintf(out, "Date value"); break ; case 't': fprintf(out, "Temperature value"); break ; case 'g': fprintf(out, "Delta temperature value"); break ; case 'p': fprintf(out, "Pressure value"); break ; default: fprintf(out, "Unknown value type"); } fprintf(out, "\", \""); if ( elements == 1 ) { fprintf(out, "Singleton"); } else if ( extension == EXTENSION_BYTE ) { fprintf(out, "Array of %d bits as a BYTE",elements); } else if ( extension == EXTENSION_ALL ) { fprintf(out, "Array of %d elements combined",elements); } else { fprintf(out, "Element %d (of %d)",extension,elements); } fprintf(out, "\", \""); if ( strncasecmp( rw, "rw", 2 ) == 0 ) { fprintf(out, "Read/Write"); } else if ( strncasecmp( rw, "ro", 2 ) == 0 ) { fprintf(out, "Read only"); } else if ( strncasecmp( rw, "wo", 2 ) == 0 ) { fprintf(out, "Write only"); } else{ fprintf(out, "No access"); } fprintf(out, "\", \""); if ( format_type == 'b' ) { fprintf(out, "%d bytes",size); } else { fprintf(out, "%d characters",size); } fprintf( out, "\"]" ); } /* Device entry -- table line for a filetype */ static void ShowJsonReadWrite(FILE * out, struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; SIZE_OR_ERROR read_return = FS_read_postparse(owq); if (read_return < 0) { fprintf(out, "null"); return; } switch (pn->selected_filetype->format) { case ft_binary: { int i; fprintf(out,"\""); for (i = 0; i < read_return; ++i) { fprintf(out, "%.2hhX", OWQ_buffer(owq)[i]); } fprintf(out,"\""); break; } case ft_yesno: case ft_bitfield: if (PN(owq)->extension >= 0) { fprintf(out, "\"%s\"", OWQ_buffer(owq)[0]=='0'?"false":"true"); break; } // fall through default: fprintf(out, "\"%.*s\"", read_return, OWQ_buffer(owq)); break; } } /* Device entry -- table line for a filetype */ static void ShowJsonReadonly(FILE * out, struct one_wire_query *owq) { ShowJsonReadWrite(out, owq); } /* Device entry -- table line for a filetype */ static void ShowJsonWriteonly(FILE * out, struct one_wire_query *owq) { (void) owq ; fprintf(out,"null") ; } static void ShowJsonDirectory(FILE * out, const struct parsedname *pn_entry) { (void) pn_entry; fprintf(out,"[]") ; } /* Now show the device */ static void ShowDeviceJsonCallback(void *v, const struct parsedname * pn_entry) { FILE *out = v; fprintf(out, "\"%s\":",FS_DirName(pn_entry) ) ; ShowJson(out, pn_entry); fprintf(out, ",\n" ) ; } static void ShowDeviceJson(FILE * out, struct parsedname *pn) { HTTPstart(out, "200 OK", ct_text); if (pn->selected_filetype == NO_DEVICE) { /* whole device */ fprintf(out, "{\n" ) ; FS_dir(ShowDeviceJsonCallback, out, pn); fprintf(out, "}" ); } else { /* Single item */ //printf("single item path=%s\n", pn->path); ShowJson(out, pn); } } void ShowDevice(FILE * out, struct parsedname *pn) { if (pn->state & ePS_text) { ShowDeviceText(out, pn); return; } else if (pn->state & ePS_json) { ShowDeviceJson(out, pn); return; } HTTPstart(out, "200 OK", ct_html); HTTPtitle(out, &pn->path[1]); HTTPheader(out, &pn->path[1]); if (NotUncachedDir(pn) && IsRealDir(pn)) { fprintf(out, "
uncached version", pn->path); } fprintf(out, ""); fprintf(out, "", Backup(pn->path), pn->path); if (pn->selected_filetype == NO_FILETYPE) { /* whole device */ FS_dir(ShowDeviceCallback, out, pn); } else { /* single item */ Show(out, pn); } fprintf(out, "
updirectory
"); HTTPfoot(out); } owfs-2.8p15/module/owhttpd/src/c/owhttpd.c0000664000175000017500000000515611620362276015452 00000000000000/* $Id: owhttpd.c,v 1.73 2011/08/10 01:54:06 alfille Exp $ OW_HTML -- OWFS used for the web OW -- One-Wire filesystem Written 2003 Paul H Alfille * based on chttpd/1.0 * main program. Somewhat adapted from dhttpd * Copyright (c) 0x7d0 * Some parts * Copyright (c) 0x7cd David A. Bartold * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "owhttpd.h" // httpd-specific /* * Default port to listen too. If you aren't root, you'll need it to * be > 1024 unless you plan on using a config file */ #define DEFAULTPORT 80 static void Acceptor(int listenfd); int main(int argc, char *argv[]) { int c; /* Set up owlib */ LibSetup(program_type_httpd); /* grab our executable name */ if (argc > 0) { Globals.progname = owstrdup(argv[0]); } while ((c = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) != -1) { switch (c) { case 'V': fprintf(stderr, "%s version:\n\t" VERSION "\n", argv[0]); break; default: break; } if ( BAD( owopt(c, optarg) ) ) { ow_exit(0); /* rest of message */ } } /* non-option arguments */ while (optind < argc) { ARG_Generic(argv[optind]); ++optind; } if (Outbound_Control.active == 0) { if (Globals.zero == zero_none) { LEVEL_DEFAULT("%s would be \"locked in\" so will quit.\nBonjour and Avahi not available.", argv[0]); ow_exit(1); } else { LEVEL_CONNECT("%s will use an ephemeral port", argv[0]) ; } ARG_Server(NULL); // make an ephemeral assignment } /* become a daemon if not told otherwise */ if ( BAD(EnterBackground()) ) { ow_exit(1); } /* Set up adapters */ if ( BAD(LibStart()) ) { ow_exit(1); } set_exit_signal_handlers(exit_handler); set_signal_handlers(NULL); ServerProcess(Acceptor); LEVEL_DEBUG("ServerProcess done"); ow_exit(0); LEVEL_DEBUG("owhttpd done"); return 0; } static void Acceptor(int listenfd) { FILE *fp = fdopen(listenfd, "w+"); if (fp) { handle_socket(fp); fflush(fp); fclose(fp); } } owfs-2.8p15/module/owhttpd/Makefile.in0000664000175000017500000005116211756250027014647 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owhttpd DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owhttpd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owhttpd/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owhttpd/Makefile.am0000664000175000017500000000005710432627750014634 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/Makefile.am0000644000175000017500000000213411751511721013132 00000000000000## $Id: Makefile.am,v 1.33 2012/05/06 15:08:01 alfille Exp $ if ENABLE_OWSHELL MODULE_SUBDIR_OWSHELL = owshell endif if ENABLE_OWLIB MODULE_SUBDIR_OWLIB = owlib endif if ENABLE_OWHTTPD MODULE_SUBDIR_OWHTTPD = owhttpd endif if ENABLE_OWSERVER MODULE_SUBDIR_OWSERVER = owserver endif if ENABLE_OWEXTERNAL MODULE_SUBDIR_OWSERVER = owserver endif if ENABLE_OWFS MODULE_SUBDIR_OWFS = owfs endif if ENABLE_OWFTPD MODULE_SUBDIR_OWFTPD = owftpd endif if ENABLE_OWCAPI MODULE_SUBDIR_OWCAPI = owcapi endif if ENABLE_OWNET MODULE_SUBDIR_OWNET = ownet endif if ENABLE_OWTAP MODULE_SUBDIR_OWTAP = owtap endif if ENABLE_OWMON MODULE_SUBDIR_OWMON = owmon endif if ENABLE_SWIG MODULE_SUBDIR_SWIG = swig endif if ENABLE_OWTCL MODULE_SUBDIR_OWTCL = owtcl endif SUBDIRS = $(MODULE_SUBDIR_OWSHELL) $(MODULE_SUBDIR_OWNET) $(MODULE_SUBDIR_OWLIB) $(MODULE_SUBDIR_OWHTTPD) $(MODULE_SUBDIR_OWSERVER) $(MODULE_SUBDIR_OWFS) $(MODULE_SUBDIR_OWFTPD) $(MODULE_SUBDIR_OWCAPI) $(MODULE_SUBDIR_OWTAP) $(MODULE_SUBDIR_OWMON) $(MODULE_SUBDIR_SWIG) $(MODULE_SUBDIR_OWTCL) clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owlib/0000775000175000017500000000000011756315510012277 500000000000000owfs-2.8p15/module/owlib/src/0000775000175000017500000000000011756315510013066 500000000000000owfs-2.8p15/module/owlib/src/Makefile.in0000664000175000017500000005117611756250027015066 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owlib/src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = c include all: all-recursive .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 module/owlib/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owlib/src/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owlib/src/Makefile.am0000664000175000017500000000006610504776327015053 00000000000000SUBDIRS = c include clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owlib/src/include/0000775000175000017500000000000011756315510014511 500000000000000owfs-2.8p15/module/owlib/src/include/rwlock.h0000664000175000017500000000203011441421241016064 00000000000000/* From Paul Alfille */ /* $Id: rwlock.h,v 1.10 2010/09/07 11:31:45 alfille Exp $ */ /* Implementation of Reader/Writer locks using semaphores and mutexes */ /* based on "The Little Book of Semaphores" bu Allen B. Downey */ /* http://www.greenteapress.com */ /* Note, these are relatively light-weight rwlocks, only solve writer starvation and no timeout or queued wakeup */ #ifndef RWLOCK_H #define RWLOCK_H #include "owfs_config.h" #if OW_MT #include #include "sem.h" typedef struct { pthread_mutex_t protect_reader_count; int reader_count; sem_t allow_readers; sem_t no_processes; } my_rwlock_t; void my_rwlock_init(my_rwlock_t * rwlock); inline void my_rwlock_write_lock(my_rwlock_t * rwlock); inline void my_rwlock_write_unlock(my_rwlock_t * rwlock); inline void my_rwlock_read_lock(my_rwlock_t * rwlock); inline void my_rwlock_read_unlock(my_rwlock_t * rwlock); void my_rwlock_destroy(my_rwlock_t * rwlock); #else /* not OW_MT */ typedef int my_rwlock_t ; #endif /* OW_MT */ #endif /* RWLOCK */ owfs-2.8p15/module/owlib/src/include/ow_charblob.h0000664000175000017500000000303411447014637017066 00000000000000/* $Id: ow_charblob.h,v 1.6 2010/09/24 03:23:11 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, Implementation: 2006 dirblob */ #ifndef OW_CHARBLOB_H /* tedious wrapper */ #define OW_CHARBLOB_H #define NO_CHARBLOB NULL struct charblob { int troubled; size_t allocated; size_t used; ASCII *blob; }; void CharblobClear(struct charblob *cb); void CharblobInit(struct charblob *cb); int CharblobPure(struct charblob *cb); int CharblobAdd(const ASCII * a, size_t s, struct charblob *cb); int CharblobAddChar(const ASCII a, struct charblob *cb); ASCII * CharblobData(struct charblob * cb); size_t CharblobLength( struct charblob * cb ); #endif /* OW_CHARBLOB_H */ owfs-2.8p15/module/owlib/src/include/ow_generic_write.h0000664000175000017500000000273111377353405020144 00000000000000/* $Id: ow_generic_write.h,v 1.2 2010/05/27 02:20:53 alfille Exp $ OW -- One-Wire filesystem LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_GENERIC_WRITE_H /* tedious wrapper */ #define OW_GENERIC_WRITE_H struct generic_write { int pagesize ; enum write_crc_type { wct_no_crc, wct_crc8, wct_crc16, } crc_type ; enum write_address_type { wat_not_supported, wat_2byte, wat_1byte, wat_page, wat_complement, } addressing_type ; BYTE write_cmd ; BYTE read_cmd ; BYTE copy_cmd ; } ; #define NO_GENERIC_WRITE NULL #endif /* OW_GENERIC_WRITE_H */ owfs-2.8p15/module/owlib/src/include/ow_integer.h0000664000175000017500000000351311525114066016743 00000000000000/* $Id: ow_integer.h,v 1.10 2011/02/11 02:00:22 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_INTEGER_H #define OW_INTEGER_H /* Routines to play with byte <-> integer */ static inline uint8_t UT_uint8(const BYTE * p) { return (uint8_t) p[0]; } static inline uint16_t UT_uint16(const BYTE * p) { return (((uint16_t) p[1]) << 8) | ((uint16_t) p[0]); } static inline uint32_t UT_uint24(const BYTE * p) { return (((uint32_t) p[2]) << 16) | (((uint32_t) p[1]) << 8) | ((uint32_t) p[0]); } static inline uint32_t UT_uint32(const BYTE * p) { return (((uint32_t) p[3]) << 24) | (((uint32_t) p[2]) << 16) | (((uint32_t) p[1]) << 8) | ((uint32_t) p[0]); } static inline int8_t UT_int8(const BYTE * p) { return (int8_t) p[0]; } static inline int16_t UT_int16(const BYTE * p) { return (((int16_t) p[1]) << 8) | ((uint16_t) p[0]); } static inline int32_t UT_int24(const BYTE * p) { return (((int32_t) p[2]) << 16) | (((uint32_t) p[1]) << 8) | ((uint32_t) p[0]); } static inline int32_t UT_int32(const BYTE * p) { // least sig to most sig return (((int32_t) p[3]) << 24) | (((uint32_t) p[2]) << 16) | (((uint32_t) p[1]) << 8) | ((uint32_t) p[0]); } static inline void UT_uint16_to_bytes( const uint16_t num, unsigned char * p ) { p[0] = num&0xFF ; p[1] = (num>>8)&0xFF ; } static inline void UT_uint24_to_bytes( const uint16_t num, unsigned char * p ) { p[0] = num&0xFF ; p[1] = (num>>8)&0xFF ; p[2] = (num>>16)&0xFF ; } static inline void UT_uint32_to_bytes( const uint32_t num, unsigned char * p ) { p[0] = num&0xFF ; p[1] = (num>>8)&0xFF ; p[2] = (num>>16)&0xFF ; p[3] = (num>>24)&0xFF ; } #endif /* OW_INTEGER_H */ owfs-2.8p15/module/owlib/src/include/ow_2413.h0000664000175000017500000000107211310575610015673 00000000000000/* $Id: ow_2413.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2413_H #define OW_2413_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2413); #endif /* 2413 code */ owfs-2.8p15/module/owlib/src/include/ow_traffic.h0000664000175000017500000000252211422162670016723 00000000000000/* $Id: ow_traffic.h,v 1.2 2010/07/23 00:43:36 alfille Exp $ Debug and error messages Meant to be included in ow.h Separated just for readability */ /* OWFS source code 1-wire filesystem for linux {c} 2006 Paul H Alfille License GPL2.0 */ #ifndef OW_TRAFFIC_H #define OW_TRAFFIC_H /* Debugging interface to showing all bus traffic * You need to configure compile with * ./configure --enable-owtraffic * */ /* Show bus traffic in detail (must be configured into the build) */ #if OW_SHOW_TRAFFIC void TrafficOut( const char * data_type, const BYTE * data, size_t length, const struct connection_in * in ); void TrafficIn( const char * data_type, const BYTE * data, size_t length, const struct connection_in * in ); void TrafficOutFD( const char * data_type, const BYTE * data, size_t length, FILE_DESCRIPTOR_OR_ERROR file_descriptor ); void TrafficInFD( const char * data_type, const BYTE * data, size_t length, FILE_DESCRIPTOR_OR_ERROR file_descriptor ); #else /* OW_SHOW_TRAFFIC */ #define TrafficOut( data_type, data, length, in ) { } while (0) #define TrafficIn( data_type, data, length, in ) { } while (0) #define TrafficOutFD( data_type, data, length, file_descriptor ) { } while (0) #define TrafficInFD( data_type, data, length, file_descriptor ) { } while (0) #endif /* OW_SHOW_TRAFFIC */ #endif /* OW_TRAFFIC_H */ owfs-2.8p15/module/owlib/src/include/ow_2502.h0000664000175000017500000000107311310575610015673 00000000000000/* $Id: ow_2502.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2502_H #define OW_2502_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2502); DeviceHeader(DS1982U); #endif owfs-2.8p15/module/owlib/src/include/ow_2450.h0000664000175000017500000000104411310575610015673 00000000000000/* $Id: ow_2450.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2450_H #define OW_2450_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2450); #endif owfs-2.8p15/module/owlib/src/include/ow_communication.h0000664000175000017500000000407511517343222020156 00000000000000/* $Id: ow_communication.h,v 1.10 2011/01/24 18:36:02 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_COMMUNICATION_H /* tedious wrapper */ #define OW_COMMUNICATION_H enum com_type { ct_unknown, ct_serial, ct_telnet, ct_tcp, ct_i2c, ct_usb, ct_netlink, ct_none, } ; enum com_state { cs_virgin, cs_deflowered, } ; struct com_serial { struct termios oldSerialTio; /*old serial port settings */ } ; struct com_tcp { char *host; char *service; struct addrinfo *ai; struct addrinfo *ai_ok; enum { needs_negotiation, completed_negotiation, } telnet_negotiated ; // have we attempted telnet negotiation -- reset at each OPEN int telnet_supported ; // server does telnet settings } ; struct communication { enum com_type type ; enum com_state state ; struct timeval timeout ; // for serial or tcp read FILE_DESCRIPTOR_OR_PERSISTENT file_descriptor; char * devicename ; union { struct com_serial serial ; struct com_tcp tcp ; struct com_tcp telnet ; } dev ; enum { flow_none, flow_soft, flow_hard, } flow ; speed_t baud; // baud rate in the form of B9600 int bits; enum { parity_none, parity_odd, parity_even, parity_mark, } parity ; enum { stop_1, stop_2, stop_15, } stop; cc_t vmin ; cc_t vtime ; } ; #endif /* OW_COMMUNICATION_H */ owfs-2.8p15/module/owlib/src/include/sem.h0000664000175000017500000000312011377034702015362 00000000000000/* From Geo Carncross geocar@internetconnection.net -- GPL */ /* File for incomplete semaphore implementations */ /* $Id: sem.h,v 1.8 2010/05/25 20:57:38 alfille Exp $ */ /* Note: gcc wants inline before int */ #ifndef __semaphore_h #define __semaphore_h #ifdef HAVE_SEMAPHORE_H #include #else /* HAVE_SEMAPHORE_H */ #include #include #include typedef struct { pthread_mutex_t m; pthread_cond_t c; volatile unsigned int v, w; } sem_t; static inline int sem_destroy(sem_t * s) { pthread_mutex_lock(&s->m); if (s->w) { pthread_mutex_unlock(&s->m); errno = EBUSY; return -1; } pthread_cond_destroy(&s->c); pthread_mutex_unlock(&s->m); pthread_mutex_destroy(&s->m); return 0; } static inline int sem_init(sem_t * s, int ign, int val) { if (ign != 0) { errno = ENOSYS; return -1; } if (pthread_mutex_init(&s->m, NULL) != 0) return -1; if (pthread_cond_init(&s->c, NULL) != 0) return -1; s->v = val; s->w = 0; return 0; } static inline int sem_post(sem_t * s) { int ok; if (pthread_mutex_lock(&s->m) == -1) return -1; s->v++; if (s->w == 1) ok = pthread_cond_signal(&s->c); else if (s->w > 1) ok = pthread_cond_broadcast(&s->c); pthread_mutex_unlock(&s->m); return ok; } static inline int sem_wait(sem_t * s) { int ok = 0; if (pthread_mutex_lock(&s->m) == -1) return -1; while (s->v == 0) { s->w++; if (pthread_cond_wait(&s->c, &s->m) == -1) { ok = -1; break; } s->w--; } s->v--; pthread_mutex_unlock(&s->m); return ok; } #endif /* HAVE_SEMAPHORE_H */ #endif /* __semaphore_h */ owfs-2.8p15/module/owlib/src/include/ow_generic_read.h0000664000175000017500000000311111404776754017725 00000000000000/* $Id: ow_generic_read.h,v 1.4 2010/06/12 21:36:44 alfille Exp $ OW -- One-Wire filesystem LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_GENERIC_READ_H /* tedious wrapper */ #define OW_GENERIC_READ_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" #define UNPAGED_MEMORY 0 struct generic_read { int pagesize ; enum read_crc_type { rct_no_crc, rct_crc8, rct_crc16, } crc_type ; enum read_address_type { rat_not_supported, rat_2byte, rat_1byte, rat_page, rat_complement, } addressing_type ; BYTE command ; } ; #define NO_GENERIC_READ NULL #endif /* OW_GENERIC_READ_H */ owfs-2.8p15/module/owlib/src/include/ow_2423.h0000664000175000017500000000104411310575610015673 00000000000000/* $Id: ow_2423.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2423_H #define OW_2423_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2423); #endif owfs-2.8p15/module/owlib/src/include/ow_1923.h0000664000175000017500000000104411310575610015677 00000000000000/* $Id: ow_1923.h,v 1.4 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1923_H #define OW_1923_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1923); #endif owfs-2.8p15/module/owlib/src/include/ow_2430.h0000664000175000017500000000104711310575610015674 00000000000000/* $Id: ow_2430.h,v 1.3 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2430A_H #define OW_2430A_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2430A); #endif owfs-2.8p15/module/owlib/src/include/ow_fd.h0000664000175000017500000000332311501277126015677 00000000000000/* $Id: ow_fd.h,v 1.4 2010/12/13 02:00:54 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_FD_H /* tedious wrapper */ #define OW_FD_H /* Simple type for file descriptors */ typedef int FILE_DESCRIPTOR_OR_ERROR ; #define FILE_DESCRIPTOR_BAD -1 #define FILE_DESCRIPTOR_VALID(fd) ((fd)>FILE_DESCRIPTOR_BAD) #define FILE_DESCRIPTOR_NOT_VALID(fd) (! FILE_DESCRIPTOR_VALID(fd)) /* Add a little complexity for Persistence * There is another state where a channel is alreaddy opened * and we with to test that one first */ typedef int FILE_DESCRIPTOR_OR_PERSISTENT ; #define FILE_DESCRIPTOR_PERSISTENT_IN_USE -2 /* Pipe channels */ enum fd_pipe_channels { fd_pipe_read = 0 , fd_pipe_write = 1 , } ; #endif /* OW_LOCALRETURNS_H */ owfs-2.8p15/module/owlib/src/include/netlink.h0000664000175000017500000001715611663574332016266 00000000000000#ifndef __LINUX_NETLINK_H #define __LINUX_NETLINK_H #include /* for sa_family_t */ #include #define NETLINK_ROUTE 0 /* Routing/device hook */ #define NETLINK_UNUSED 1 /* Unused number */ #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3 /* Firewalling hook */ #define NETLINK_INET_DIAG 4 /* INET socket monitoring */ #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ #define NETLINK_XFRM 6 /* ipsec */ #define NETLINK_SELINUX 7 /* SELinux event notifications */ #define NETLINK_ISCSI 8 /* Open-iSCSI */ #define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_FIB_LOOKUP 10 #define NETLINK_CONNECTOR 11 #define NETLINK_NETFILTER 12 /* netfilter subsystem */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ #define NETLINK_GENERIC 16 #define MAX_LINKS 32 struct sockaddr_nl { sa_family_t nl_family; /* AF_NETLINK */ unsigned short nl_pad; /* zero */ uint32_t nl_pid; /* process pid */ uint32_t nl_groups; /* multicast groups mask */ }; #pragma pack(push) /* push current alignment to stack */ #pragma pack(1) /* set alignment to 1 byte boundary */ struct nlmsghdr { uint32_t nlmsg_len; /* Length of message including header */ uint16_t nlmsg_type; /* Message content */ uint16_t nlmsg_flags; /* Additional flags */ uint32_t nlmsg_seq; /* Sequence number */ uint32_t nlmsg_pid; /* Sending process PID */ }; #pragma pack(pop) /* restore original alignment from stack */ /* Flags values */ #define NLM_F_REQUEST 1 /* It is request message. */ #define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */ #define NLM_F_ACK 4 /* Reply with ack, with zero or error code */ #define NLM_F_ECHO 8 /* Echo this request */ /* Modifiers to GET request */ #define NLM_F_ROOT 0x100 /* specify tree root */ #define NLM_F_MATCH 0x200 /* return all matching */ #define NLM_F_ATOMIC 0x400 /* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) /* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100 /* Override existing */ #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ #define NLM_F_APPEND 0x800 /* Add to end of list */ /* 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL 4.4BSD CHANGE NLM_F_REPLACE True CHANGE NLM_F_CREATE|NLM_F_REPLACE Append NLM_F_CREATE Check NLM_F_EXCL */ #define NLMSG_ALIGNTO 4 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len <= (len)) #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) #define NLMSG_NOOP 0x1 /* Nothing. */ #define NLMSG_ERROR 0x2 /* Error */ #define NLMSG_DONE 0x3 /* End of a dump */ #define NLMSG_OVERRUN 0x4 /* Data lost */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ struct nlmsgerr { int error; struct nlmsghdr msg; }; #define NETLINK_ADD_MEMBERSHIP 1 #define NETLINK_DROP_MEMBERSHIP 2 #define NETLINK_PKTINFO 3 struct nl_pktinfo { uint32_t group; }; #define NET_MAJOR 36 /* Major 36 is reserved for networking */ enum { NETLINK_UNCONNECTED = 0, NETLINK_CONNECTED, }; /* * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> * +---------------------+- - -+- - - - - - - - - -+- - -+ * | Header | Pad | Payload | Pad | * | (struct nlattr) | ing | | ing | * +---------------------+- - -+- - - - - - - - - -+- - -+ * <-------------- nlattr->nla_len --------------> */ struct nlattr { uint16_t nla_len; uint16_t nla_type; }; #define NLA_ALIGNTO 4 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) #ifdef __KERNEL__ #include #include struct netlink_skb_parms { struct ucred creds; /* Skb credentials */ uint32_t pid; uint32_t dst_pid; uint32_t dst_group; kernel_cap_t eff_cap; uint32_t loginuid; /* Login (audit) uid */ uint32_t sid; /* SELinux security id */ }; #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); extern int netlink_has_listeners(struct sock *sk, unsigned int group); extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, uint32_t pid, int nonblock); extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, uint32_t pid, uint32_t group, gfp_t allocation); extern void netlink_set_err(struct sock *ssk, uint32_t pid, uint32_t group, int code); extern int netlink_register_notifier(struct notifier_block *nb); extern int netlink_unregister_notifier(struct notifier_block *nb); /* finegrained unicast helpers: */ struct sock *netlink_getsockbyfilp(struct file *filp); int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo, struct sock *ssk); void netlink_detachskb(struct sock *sk, struct sk_buff *skb); int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); /* * skb should fit one page. This choice is good for headerless malloc. */ #define NLMSG_GOODORDER 0 #define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) struct netlink_callback { struct sk_buff *skb; struct nlmsghdr *nlh; int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); int (*done)(struct netlink_callback *cb); int family; long args[5]; }; struct netlink_notify { int pid; int protocol; }; static __inline__ struct nlmsghdr * __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) { struct nlmsghdr *nlh; int size = NLMSG_LENGTH(len); nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); nlh->nlmsg_type = type; nlh->nlmsg_len = size; nlh->nlmsg_flags = flags; nlh->nlmsg_pid = pid; nlh->nlmsg_seq = seq; memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); return nlh; } #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ goto nlmsg_failure; \ __nlmsg_put(skb, pid, seq, type, len, flags); }) #define NLMSG_PUT(skb, pid, seq, type, len) \ NLMSG_NEW(skb, pid, seq, type, len, 0) #define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \ NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \ (cb)->nlh->nlmsg_seq, type, len, flags) #define NLMSG_END(skb, nlh) \ ({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ (skb)->len; }) #define NLMSG_CANCEL(skb, nlh) \ ({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \ -1; }) extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, struct nlmsghdr *nlh, int (*dump)(struct sk_buff *skb, struct netlink_callback*), int (*done)(struct netlink_callback*)); #define NL_NONROOT_RECV 0x1 #define NL_NONROOT_SEND 0x2 extern void netlink_set_nonroot(int protocol, unsigned flag); #endif /* __KERNEL__ */ #endif /* __LINUX_NETLINK_H */ owfs-2.8p15/module/owlib/src/include/ow_devices.h0000644000175000017500000000431011674131132016720 00000000000000/* $Id: ow_devices.h,v 1.27 2011/12/20 02:16:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_DEVICES_H #define OW_DEVICES_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif // specific read/write code for each device #include "ow_standard.h" // Needed for all devices -- should be before other devices #include "ow_none.h" // Non-existent devices #include "ow_1820.h" // thermometer #include "ow_1821.h" // thermostat #include "ow_1921.h" // thermometer #include "ow_1923.h" // thermometer / humidity #include "ow_1963.h" // ibutton SHA memory #include "ow_1977.h" // password memory #include "ow_1991.h" // ibutton Multikey memory #include "ow_1993.h" // ibutton memory #include "ow_2401.h" // Simple ID and base defines #include "ow_2404.h" // dual port mem and clock #include "ow_2405.h" // switch #include "ow_2406.h" // switch #include "ow_2408.h" // switch #include "ow_2409.h" // hub #include "ow_2413.h" // switch #include "ow_2415.h" // Clock #include "ow_2423.h" // Counter #include "ow_2430.h" // eeprom #include "ow_2433.h" // eeprom #include "ow_2436.h" // Battery #include "ow_2438.h" // Battery #include "ow_2450.h" // A/D convertor #include "ow_2502.h" // write-only memory #include "ow_2505.h" // write-only memory #include "ow_2760.h" // battery #include "ow_2804.h" // switch #include "ow_2890.h" // potentiometer #include "ow_bae.h" // Pascal Baerten's PIC-based device #include "ow_eds.h" // Embedded Data Systems #include "ow_eeef.h" // Hobby Boards UVI etc #include "ow_example_slave.h" // Example of slave programming #include "ow_interface.h" // interface pseudo-device #include "ow_lcd.h" // LCD driver #include "ow_simultaneous.h" // fake entry to address entire directory #include "ow_stats.h" // statistic reporting pseudo-device #include "ow_settings.h" // settings pseudo-device #include "ow_system.h" // system pseudo-device #endif owfs-2.8p15/module/owlib/src/include/ow_usb_msg.h0000664000175000017500000000626711475612455016767 00000000000000/* $Id: ow_usb_msg.h,v 1.4 2010/12/02 03:40:29 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* DS9490R-W USB 1-Wire master USB parameters: Vendor ID: 04FA ProductID: 2490 Dallas controller DS2490 */ #ifndef OW_USB_MSG_H /* tedious wrapper */ #define OW_USB_MSG_H #if OW_USB /* conditional inclusion of USB */ /* Extensive FreeBSD workarounds by Robert Nilsson */ /* Peter Radcliffe updated support for FreeBSD >= 8 */ #ifdef __FreeBSD__ // Add a few definitions we need #undef HAVE_USB_INTERRUPT_READ // This call in libusb is unneeded for FreeBSD (and it's broken) #if __FreeBSD__ < 8 #include #include #define USB_CLEAR_HALT BSD_usb_clear_halt #endif /* __FreeBSD__ < 8 */ struct usb_dev_handle { FILE_DESCRIPTOR_OR_ERROR file_descriptor; struct usb_bus *bus; struct usb_device *device; int config; int interface; int altsetting; void *impl_info; }; #endif /* __FreeBSD__ */ #ifndef USB_CLEAR_HALT #define USB_CLEAR_HALT usb_clear_halt #endif /* USB_CLEAR_HALT */ /* All the rest of the code sees is the DS9490_detect routine and the iroutine structure */ GOOD_OR_BAD USB_Control_Msg(BYTE bRequest, UINT wValue, UINT wIndex, const struct parsedname *pn); GOOD_OR_BAD DS9490_open(struct usb_list *ul, struct connection_in *in); #define DS9490_getstatus_BUFFER_LENGTH ( 32 + 1 ) RESET_TYPE DS9490_getstatus(BYTE * buffer, int * readlen, const struct parsedname *pn); SIZE_OR_ERROR DS9490_read(BYTE * buf, size_t size, const struct parsedname *pn); SIZE_OR_ERROR DS9490_write(const BYTE * buf, size_t size, const struct parsedname *pn); void DS9490_close(struct connection_in *in); // Mode Command Code Constants #define ONEWIREDEVICEDETECT 0xA5 #define COMMCMDERRORRESULT_NRS 0x01 #define COMMCMDERRORRESULT_SH 0x02 extern char badUSBname[] ; #define CONTROL_CMD 0x00 #define COMM_CMD 0x01 #define MODE_CMD 0x02 #define TEST_CMD 0x03 #define CTL_RESET_DEVICE 0x0000 #define CTL_START_EXE 0x0001 #define CTL_RESUME_EXE 0x0002 #define CTL_HALT_EXE_IDLE 0x0003 #define CTL_HALT_EXE_DONE 0x0004 #define CTL_FLUSH_COMM_CMDS 0x0007 #define CTL_FLUSH_CV_BUFFER 0x0008 #define CTL_FLUSH_CMT_BUFFER 0x0009 #define CTL_GET_COMM_CMDS 0x000A // Device Status Flags #define STATUSFLAGS_SPUA 0x01 // if set Strong Pull-up is active #define STATUSFLAGS_PRGA 0x02 // if set a 12V programming pulse is being generated #define STATUSFLAGS_12VP 0x04 // if set the external 12V programming voltage is present #define STATUSFLAGS_PMOD 0x08 // if set the DS2490 powered from USB and external sources #define STATUSFLAGS_HALT 0x10 // if set the DS2490 is currently halted #define STATUSFLAGS_IDLE 0x20 // if set the DS2490 is currently idle #endif /* OW_USB */ #endif /* OW_USB_MSG_H */ owfs-2.8p15/module/owlib/src/include/ow_standard.h0000644000175000017500000000600511740076517017112 00000000000000/* $Id: ow_standard.h,v 1.7 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_STANDARD_H #define OW_STANDARD_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow.h" #include "ow_connection.h" #include "ow_codes.h" /* ------- Prototypes ----------- */ ZERO_OR_ERROR FS_type(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_alias(struct one_wire_query *owq); ZERO_OR_ERROR FS_w_alias(struct one_wire_query *owq); ZERO_OR_ERROR FS_code(struct one_wire_query *owq); ZERO_OR_ERROR FS_crc8(struct one_wire_query *owq); ZERO_OR_ERROR FS_ID(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_ID(struct one_wire_query *owq); ZERO_OR_ERROR FS_address(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_address(struct one_wire_query *owq); ZERO_OR_ERROR FS_locator(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_locator(struct one_wire_query *owq); ZERO_OR_ERROR FS_present(struct one_wire_query *owq); /* ------- Structures ----------- */ #define F_address \ {"address" , PROPERTY_LENGTH_ADDRESS, NON_AGGREGATE, ft_ascii , fc_static , FS_address , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_r_address \ {"r_address" , PROPERTY_LENGTH_ADDRESS, NON_AGGREGATE, ft_ascii , fc_static , FS_r_address, NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_crc8 \ {"crc8" , 2, NON_AGGREGATE, ft_ascii , fc_static , FS_crc8 , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_id \ {"id" , 12, NON_AGGREGATE, ft_ascii , fc_static , FS_ID , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_r_id \ {"r_id" , 12, NON_AGGREGATE, ft_ascii , fc_static , FS_r_ID , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_code \ {"family" , 2, NON_AGGREGATE, ft_ascii , fc_static , FS_code , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_present \ {"present" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno , fc_volatile, FS_present , NO_WRITE_FUNCTION, VISIBILE_PRESENT, {v:NULL}, } #define F_type \ {"type" , PROPERTY_LENGTH_TYPE, NON_AGGREGATE, ft_vascii, fc_static , FS_type , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_alias \ {"alias" ,PROPERTY_LENGTH_ALIAS, NON_AGGREGATE, ft_alias, fc_static , FS_r_alias , FS_w_alias, VISIBLE, {v:NULL}, } #define F_locator \ {"locator" , PROPERTY_LENGTH_ADDRESS, NON_AGGREGATE, ft_ascii , fc_directory,FS_locator , NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_r_locator \ {"r_locator" , PROPERTY_LENGTH_ADDRESS, NON_AGGREGATE, ft_ascii , fc_directory,FS_r_locator, NO_WRITE_FUNCTION, VISIBLE, {v:NULL}, } #define F_STANDARD_NO_TYPE F_address,F_code,F_crc8,F_id,F_locator,F_present,F_r_address,F_r_id,F_r_locator,F_alias #define F_STANDARD F_STANDARD_NO_TYPE,F_type #endif /* OW_STANDARD_H */ owfs-2.8p15/module/owlib/src/include/ow_system.h0000664000175000017500000000120311310575610016622 00000000000000/* $Id: ow_system.h,v 1.11 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_SYSTEM_H #define OW_SYSTEM_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(sys_process); DeviceHeader(sys_connections); DeviceHeader(sys_configure); #endif /* OW_SYSTEM_H */ owfs-2.8p15/module/owlib/src/include/ow_pid.h0000664000175000017500000000055210557552546016077 00000000000000/* $Id: ow_pid.h,v 1.3 2007/01/30 05:19:34 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 PID saving code -- isolated for convenience */ #ifndef OWPID_H /* tedious wrapper */ #define OWPID_H /* PID file nsme */ extern int pid_created; extern char *pid_file; void PIDstart(void); void PIDstop(void); #endif /* OWPID_H */ owfs-2.8p15/module/owlib/src/include/ow_search.h0000664000175000017500000000704211611434674016562 00000000000000/* $Id: ow_search.h,v 1.2 2011/07/20 02:13:16 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_SEARCH_H /* tedious wrapper */ #define OW_SEARCH_H enum search_status { search_good, search_done, search_error } ; struct device_search { int LastDiscrepancy; // for search int LastDevice; // for search int index; BYTE sn[SERIAL_NUMBER_SIZE]; BYTE search; // For adapters that maintain dir-at-once (or dirgulp): struct dirblob gulp; }; enum search_status BUS_first(struct device_search *ds, const struct parsedname *pn); enum search_status BUS_next(struct device_search *ds, const struct parsedname *pn); enum search_status BUS_first_alarm(struct device_search *ds, const struct parsedname *pn); enum search_status BUS_next_both(struct device_search *ds, const struct parsedname *pn); enum search_status BUS_next_both_bitbang(struct device_search *ds, const struct parsedname *pn) ; void BUS_next_cleanup( struct device_search *ds ) ; #endif /* OW_SEARCH_H */ owfs-2.8p15/module/owlib/src/include/ow_codes.h0000664000175000017500000000151311360124613016375 00000000000000/* $Id: ow_codes.h,v 1.6 2010/04/10 16:38:35 alfille Exp $ Debug and error messages Meant to be included in ow.h Separated just for readability */ /* OWFS source code 1-wire filesystem for linux {c} 2006 Paul H Alfille License GPL2.0 */ #ifndef OW_CODES_H #define OW_CODES_H /* 1-wire ROM commands */ #define _1W_READ_ROM 0x33 #define _1W_OLD_READ_ROM 0x0F #define _1W_MATCH_ROM 0x55 #define _1W_SKIP_ROM 0xCC #define _1W_SEARCH_ROM 0xF0 #define _1W_CONDITIONAL_SEARCH_ROM 0xEC #define _1W_RESUME 0xA5 #define _1W_OVERDRIVE_SKIP_ROM 0x3C #define _1W_OVERDRIVE_MATCH_ROM 0x69 #define _1W_SWAP 0xAA // used by the DS27xx #define _1W_LOCATOR 0x00 // used by the Link Locator #endif /* OW_CODES_H */ owfs-2.8p15/module/owlib/src/include/ow_usb_cycle.h0000644000175000017500000000700011754612217017254 00000000000000/* $Id: ow_usb_cycle.h,v 1.8 2012/05/16 02:44:31 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_USB_CYCLE_H /* tedious wrapper */ #define OW_USB_CYCLE_H #if OW_USB #include // Mac needs this before according to Peter Peter Radcliffe's work #include /* All the rest of the code sees is the DS9490_detect routine and the iroutine structure */ struct usb_list { struct usb_bus *bus; struct usb_device *dev; int usb_bus_number; int usb_dev_number; }; void USB_first(struct usb_list *ul); GOOD_OR_BAD USB_next(struct usb_list *ul); GOOD_OR_BAD USB_next_until_n(struct usb_list *ul, int num) ; GOOD_OR_BAD DS9490_root_dir( struct dirblob * db, struct connection_in * in ) ; GOOD_OR_BAD DS9490_ID_this_master(struct connection_in *in); char *DS9490_device_name(const struct usb_list *ul); #define DS2490_USB_VENDOR 0x04FA #define DS2490_USB_PRODUCT 0x2490 #endif /* OW_USB */ #endif /* OW_USB_CYCLE_H */ owfs-2.8p15/module/owlib/src/include/ow_2406.h0000664000175000017500000000104411310575610015674 00000000000000/* $Id: ow_2406.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2406_H #define OW_2406_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2406); #endif owfs-2.8p15/module/owlib/src/include/ow_filetype.h0000644000175000017500000001415111740706640017131 00000000000000/* $Id: ow_filetype.h,v 1.28 2012/04/10 01:32:16 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille */ #ifndef OW_FILETYPE_H /* tedious wrapper */ #define OW_FILETYPE_H /* Define our understanding of integers, floats, ... */ #include "ow_localtypes.h" /* Several different structures: device -- one for each type of 1-wire device filetype -- one for each type of file parsedname -- translates a path into usable form */ /* --------------------------------------------------------- */ /* Filetypes -- directory entries for each 1-wire chip found */ /* Filetype is the most elaborate of the internal structures, though simple in concept. Actually a little misnamed. Each filetype corresponds to a device property, and to a file in the file system (though there are Filetype entries for some directory elements too) Filetypes belong to a particular device. (i.e. each device has it's list of filetypes) and have a name and pointers to processing functions. Filetypes also have a data format (integer, ascii,...) and a data length, and an indication of whether the property is static, changes only on command, or is volatile. Some properties occur are arrays (pages of memory, logs of temperature values). The "aggregate" structure holds to allowable size, and the method of access. -- Aggregate properties are either accessed all at once, then split, or accessed individually. The choice depends on the device hardware. There is even a further wrinkle: mixed. In cases where the handling can be either, mixed causes separate handling of individual items are querried, and combined if ALL are requested. This is useful for the DS2450 quad A/D where volt and PIO functions step on each other, but the conversion time for individual is rather costly. */ enum ag_index { ag_numbers, ag_letters, }; enum ag_combined { ag_separate, ag_aggregate, ag_mixed, ag_sparse, }; /* aggregate defines array properties */ struct aggregate { int elements; /* Maximum number of elements */ enum ag_index letters; /* name them with letters or numbers */ enum ag_combined combined; /* Combined bitmaps properties, or separately addressed */ }; /* property format, controls web display */ /* Some explanation of ft_format: Each file type is either a device (physical 1-wire chip or virtual statistics container). or a file (property). The devices act as directories of properties. The files are either properties of the device, or sometimes special directories themselves. If properties, they can be integer, text, etc or special directory types. There is also the directory type, ft_directory reflects a branch type, which restarts the parsing process. */ enum ft_format { ft_unknown, ft_directory, ft_subdir, ft_integer, ft_unsigned, ft_float, ft_alias, // A human readable name in lue of numeric ID ft_ascii, ft_vascii, // variable length ascii -- must be read and measured. ft_binary, ft_yesno, ft_date, ft_bitfield, ft_temperature, ft_tempgap, ft_pressure, }; /* property changability. Static unchanged, Stable we change, Volatile changes */ enum fc_change { fc_static, // doesn't change (e.g. chip property) fc_stable, // only changes if we write to the chip fc_read_stable, // stable after a read, not a write fc_volatile, // changes on it's own (e.g. external pin voltage) fc_simultaneous_temperature, // volatile with a twist fc_simultaneous_voltage, // volatile with a twist fc_uncached, // Don't cache (because the read and write interpretation are different) fc_second, // timer (changes every second) fc_statistic, // internally held statistic fc_persistent, // internal cumulative counter fc_directory, // directory listing fc_presence, // chip <-> bus pairing fc_link, // a link to another property -- cache that one instead fc_page, // cache a page of memory fc_subdir, // really a NOP, but makes code clearer }; /* Predeclare one_wire_query */ struct one_wire_query; /* Predeclare parsedname */ struct parsedname; #define PROPERTY_LENGTH_INTEGER 12 #define PROPERTY_LENGTH_UNSIGNED 12 #define PROPERTY_LENGTH_BITFIELD 12 #define PROPERTY_LENGTH_FLOAT 12 #define PROPERTY_LENGTH_PRESSURE 12 #define PROPERTY_LENGTH_TEMP 12 #define PROPERTY_LENGTH_TEMPGAP 12 #define PROPERTY_LENGTH_DATE 24 #define PROPERTY_LENGTH_YESNO 1 #define PROPERTY_LENGTH_STRUCTURE 32 #define PROPERTY_LENGTH_DIRECTORY 8 #define PROPERTY_LENGTH_SUBDIR 0 #define PROPERTY_LENGTH_ALIAS 256 #define PROPERTY_LENGTH_ADDRESS 16 #define PROPERTY_LENGTH_TYPE 32 #define NON_AGGREGATE NULL #define NO_FILETYPE_DATA {v:NULL} #define NO_READ_FUNCTION NULL #define NO_WRITE_FUNCTION NULL #include "ow_visibility.h" /* filetype gives -file types- for chip properties */ struct filetype { char *name; int suglen; // length of field struct aggregate *ag; // struct pointer for aggregate enum ft_format format; // type of data enum fc_change change; // volatility ZERO_OR_ERROR (*read) (struct one_wire_query *); // read callback function ZERO_OR_ERROR (*write) (struct one_wire_query *); // write callback function enum e_visibility (*visible) (const struct parsedname *); // Show in a directory listing? union { void * v; int i; UINT u; _FLOAT f; size_t s; BYTE c; ASCII *a; } data; // extra data pointer (used for separating similar but differently named functions) }; #include "ow_bitfield.h" // read/write bit fields /* --------- end Filetype -------------------- */ #endif /* OW_FILETYPE_H */ owfs-2.8p15/module/owlib/src/include/ow_dnssd.h0000664000175000017500000023106211441567463016435 00000000000000/* * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef OW_DNSSD_H #define OW_DNSSD_H #define ORIGINAL_DNSSD_INCLUDE 0 #ifdef __cplusplus extern "C" { #endif /* */ int OW_Load_dnssd_library(void); void OW_Free_dnssd_library(void); /* standard calling convention under Win32 is __stdcall */ /* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */ /* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */ #if defined(_WIN32) && !defined(EFI32) && !defined(EFI64) #define DNSSD_API __stdcall #else /* */ #define DNSSD_API #endif /* */ /* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */ #if defined(__FreeBSD_version) && (__FreeBSD_version < 500000) #include /* Likewise, on Sun, standard integer types are in sys/types.h */ #elif defined(__sun__) #include /* EFI does not have stdint.h, or anything else equivalent */ #elif defined(EFI32) || defined(EFI64) typedef UINT8 uint8_t; typedef INT8 int8_t; typedef UINT16 uint16_t; typedef INT16 int16_t; typedef UINT32 uint32_t; typedef INT32 int32_t; /* Windows has its own differences */ #elif defined(_WIN32) #include #define _UNUSED #define bzero(a, b) memset(a, 0, b) #ifndef _MSL_STDINT_H typedef UINT8 uint8_t; typedef INT8 int8_t; typedef UINT16 uint16_t; typedef INT16 int16_t; typedef UINT32 uint32_t; typedef INT32 int32_t; #endif /* */ /* All other Posix platforms use stdint.h */ #else /* */ #include #endif /* */ /* DNSServiceRef, DNSRecordRef * * Opaque internal data types. * Note: client is responsible for serializing access to these structures if * they are shared between concurrent threads. */ typedef struct _DNSServiceRef_t *DNSServiceRef; typedef struct _DNSRecordRef_t *DNSRecordRef; /* General flags used in functions defined below */ enum { kDNSServiceFlagsMoreComing = 0x1, /* MoreComing indicates to a callback that at least one more result is * queued and will be delivered following immediately after this one. * Applications should not update their UI to display browse * results when the MoreComing flag is set, because this would * result in a great deal of ugly flickering on the screen. * Applications should instead wait until until MoreComing is not set, * and then update their UI. * When MoreComing is not set, that doesn't mean there will be no more * answers EVER, just that there are no more answers immediately * available right now at this instant. If more answers become available * in the future they will be delivered as usual. */ kDNSServiceFlagsAdd = 0x2, kDNSServiceFlagsDefault = 0x4, /* Flags for domain enumeration and browse/query reply callbacks. * "Default" applies only to enumeration and is only valid in * conjuction with "Add". An enumeration callback with the "Add" * flag NOT set indicates a "Remove", i.e. the domain is no longer * valid. */ kDNSServiceFlagsNoAutoRename = 0x8, /* Flag for specifying renaming behavior on name conflict when registering * non-shared records. By default, name conflicts are automatically handled * by renaming the service. NoAutoRename overrides this behavior - with this * flag set, name conflicts will result in a callback. The NoAutorename flag * is only valid if a name is explicitly specified when registering a service * (i.e. the default name is not used.) */ kDNSServiceFlagsShared = 0x10, kDNSServiceFlagsUnique = 0x20, /* Flag for registering individual records on a connected * DNSServiceRef. Shared indicates that there may be multiple records * with this name on the network (e.g. PTR records). Unique indicates that the * record's name is to be unique on the network (e.g. SRV records). */ kDNSServiceFlagsBrowseDomains = 0x40, kDNSServiceFlagsRegistrationDomains = 0x80, /* Flags for specifying domain enumeration type in DNSServiceEnumerateDomains. * BrowseDomains enumerates domains recommended for browsing, RegistrationDomains * enumerates domains recommended for registration. */ kDNSServiceFlagsLongLivedQuery = 0x100, /* Flag for creating a long-lived unicast query for the DNSServiceQueryRecord call. */ kDNSServiceFlagsAllowRemoteQuery = 0x200, /* Flag for creating a record for which we will answer remote queries * (queries from hosts more than one hop away; hosts not directly connected to the local link). */ kDNSServiceFlagsForceMulticast = 0x400 /* Flag for signifying that a query or registration should be performed exclusively via multicast DNS, * even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS. */ }; /* * The values for DNS Classes and Types are listed in RFC 1035, and are available * on every OS in its DNS header file. Unfortunately every OS does not have the * same header file containing DNS Class and Type constants, and the names of * the constants are not consistent. For example, BIND 8 uses "T_A", * BIND 9 uses "ns_t_a", Windows uses "DNS_TYPE_A", etc. * For this reason, these constants are also listed here, so that code using * the DNS-SD programming APIs can use these constants, so that the same code * can compile on all our supported platforms. */ enum { kDNSServiceClass_IN = 1 /* Internet */ }; enum { kDNSServiceType_A = 1, /* Host address. */ kDNSServiceType_NS = 2, /* Authoritative server. */ kDNSServiceType_MD = 3, /* Mail destination. */ kDNSServiceType_MF = 4, /* Mail forwarder. */ kDNSServiceType_CNAME = 5, /* Canonical name. */ kDNSServiceType_SOA = 6, /* Start of authority zone. */ kDNSServiceType_MB = 7, /* Mailbox domain name. */ kDNSServiceType_MG = 8, /* Mail group member. */ kDNSServiceType_MR = 9, /* Mail rename name. */ kDNSServiceType_NULL = 10, /* Null resource record. */ kDNSServiceType_WKS = 11, /* Well known service. */ kDNSServiceType_PTR = 12, /* Domain name pointer. */ kDNSServiceType_HINFO = 13, /* Host information. */ kDNSServiceType_MINFO = 14, /* Mailbox information. */ kDNSServiceType_MX = 15, /* Mail routing information. */ kDNSServiceType_TXT = 16, /* One or more text strings. */ kDNSServiceType_RP = 17, /* Responsible person. */ kDNSServiceType_AFSDB = 18, /* AFS cell database. */ kDNSServiceType_X25 = 19, /* X_25 calling address. */ kDNSServiceType_ISDN = 20, /* ISDN calling address. */ kDNSServiceType_RT = 21, /* Router. */ kDNSServiceType_NSAP = 22, /* NSAP address. */ kDNSServiceType_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */ kDNSServiceType_SIG = 24, /* Security signature. */ kDNSServiceType_KEY = 25, /* Security key. */ kDNSServiceType_PX = 26, /* X.400 mail mapping. */ kDNSServiceType_GPOS = 27, /* Geographical position (withdrawn). */ kDNSServiceType_AAAA = 28, /* Ip6 Address. */ kDNSServiceType_LOC = 29, /* Location Information. */ kDNSServiceType_NXT = 30, /* Next domain (security). */ kDNSServiceType_EID = 31, /* Endpoint identifier. */ kDNSServiceType_NIMLOC = 32, /* Nimrod Locator. */ kDNSServiceType_SRV = 33, /* Server Selection. */ kDNSServiceType_ATMA = 34, /* ATM Address */ kDNSServiceType_NAPTR = 35, /* Naming Authority PoinTeR */ kDNSServiceType_KX = 36, /* Key Exchange */ kDNSServiceType_CERT = 37, /* Certification record */ kDNSServiceType_A6 = 38, /* IPv6 address (deprecates AAAA) */ kDNSServiceType_DNAME = 39, /* Non-terminal DNAME (for IPv6) */ kDNSServiceType_SINK = 40, /* Kitchen sink (experimentatl) */ kDNSServiceType_OPT = 41, /* EDNS0 option (meta-RR) */ kDNSServiceType_TKEY = 249, /* Transaction key */ kDNSServiceType_TSIG = 250, /* Transaction signature. */ kDNSServiceType_IXFR = 251, /* Incremental zone transfer. */ kDNSServiceType_AXFR = 252, /* Transfer zone of authority. */ kDNSServiceType_MAILB = 253, /* Transfer mailbox records. */ kDNSServiceType_MAILA = 254, /* Transfer mail agent records. */ kDNSServiceType_ANY = 255 /* Wildcard match. */ }; /* possible error code values */ enum { kDNSServiceErr_NoError = 0, kDNSServiceErr_Unknown = -65537, /* 0xFFFE FFFF */ kDNSServiceErr_NoSuchName = -65538, kDNSServiceErr_NoMemory = -65539, kDNSServiceErr_BadParam = -65540, kDNSServiceErr_BadReference = -65541, kDNSServiceErr_BadState = -65542, kDNSServiceErr_BadFlags = -65543, kDNSServiceErr_Unsupported = -65544, kDNSServiceErr_NotInitialized = -65545, kDNSServiceErr_AlreadyRegistered =-65547, kDNSServiceErr_NameConflict = -65548, kDNSServiceErr_Invalid = -65549, kDNSServiceErr_Firewall = -65550, kDNSServiceErr_Incompatible = -65551, /* client library incompatible with daemon */ kDNSServiceErr_BadInterfaceIndex =-65552, kDNSServiceErr_Refused = -65553, kDNSServiceErr_NoSuchRecord = -65554, kDNSServiceErr_NoAuth = -65555, kDNSServiceErr_NoSuchKey = -65556, kDNSServiceErr_NATTraversal = -65557, kDNSServiceErr_DoubleNAT = -65558, kDNSServiceErr_BadTime = -65559 /* mDNS Error codes are in the range * FFFE FF00 (-65792) to FFFE FFFF (-65537) */ }; /* Maximum length, in bytes, of a service name represented as a */ /* literal C-String, including the terminating NULL at the end. */ #define kDNSServiceMaxServiceName 64 /* Maximum length, in bytes, of a domain name represented as an *escaped* C-String */ /* including the final trailing dot, and the C-String terminating NULL at the end. */ #define kDNSServiceMaxDomainName 1005 /* * Notes on DNS Name Escaping * -- or -- * "Why is kDNSServiceMaxDomainName 1005, when the maximum legal domain name is 255 bytes?" * * All strings used in DNS-SD are UTF-8 strings. * With few exceptions, most are also escaped using standard DNS escaping rules: * * '\\' represents a single literal '\' in the name * '\.' represents a single literal '.' in the name * '\ddd', where ddd is a three-digit decimal value from 000 to 255, * represents a single literal byte with that value. * A bare unescaped '.' is a label separator, marking a boundary between domain and subdomain. * * The exceptions, that do not use escaping, are the routines where the full * DNS name of a resource is broken, for convenience, into servicename/regtype/domain. * In these routines, the "servicename" is NOT escaped. It does not need to be, since * it is, by definition, just a single literal string. Any characters in that string * represent exactly what they are. The "regtype" portion is, technically speaking, * escaped, but since legal regtypes are only allowed to contain letters, digits, * and hyphens, there is nothing to escape, so the issue is moot. The "domain" * portion is also escaped, though most domains in use on the public Internet * today, like regtypes, don't contain any characters that need to be escaped. * As DNS-SD becomes more popular, rich-text domains for service discovery will * become common, so software should be written to cope with domains with escaping. * * The servicename may be up to 63 bytes of UTF-8 text (not counting the C-String * terminating NULL at the end). The regtype is of the form _service._tcp or * _service._udp, where the "service" part is 1-14 characters, which may be * letters, digits, or hyphens. The domain part of the three-part name may be * any legal domain, providing that the resulting servicename+regtype+domain * name does not exceed 255 bytes. * * For most software, these issues are transparent. When browsing, the discovered * servicenames should simply be displayed as-is. When resolving, the discovered * servicename/regtype/domain are simply passed unchanged to DNSServiceResolve(). * When a DNSServiceResolve() succeeds, the returned fullname is already in * the correct format to pass to standard system DNS APIs such as res_query(). * For converting from servicename/regtype/domain to a single properly-escaped * full DNS name, the helper function DNSServiceConstructFullName() is provided. * * The following (highly contrived) example illustrates the escaping process. * Suppose you have an service called "Dr. Smith\Dr. Johnson", of type "_ftp._tcp" * in subdomain "4th. Floor" of subdomain "Building 2" of domain "apple.com." * The full (escaped) DNS name of this service's SRV record would be: * Dr\.\032Smith\\Dr\.\032Johnson._ftp._tcp.4th\.\032Floor.Building\0322.apple.com. */ /* * Constants for specifying an interface index * * Specific interface indexes are identified via a 32-bit unsigned integer returned * by the if_nametoindex() family of calls. * * If the client passes 0 for interface index, that means "do the right thing", * which (at present) means, "if the name is in an mDNS local multicast domain * (e.g. 'local.', '254.169.in-addr.arpa.', '0.8.E.F.ip6.arpa.') then multicast * on all applicable interfaces, otherwise send via unicast to the appropriate * DNS server." Normally, most clients will use 0 for interface index to * automatically get the default sensible behaviour. * * If the client passes a positive interface index, then for multicast names that * indicates to do the operation only on that one interface. For unicast names the * interface index is ignored unless kDNSServiceFlagsForceMulticast is also set. * * If the client passes kDNSServiceInterfaceIndexLocalOnly when registering * a service, then that service will be found *only* by other local clients * on the same machine that are browsing using kDNSServiceInterfaceIndexLocalOnly * or kDNSServiceInterfaceIndexAny. * If a client has a 'private' service, accessible only to other processes * running on the same machine, this allows the client to advertise that service * in a way such that it does not inadvertently appear in service lists on * all the other machines on the network. * * If the client passes kDNSServiceInterfaceIndexLocalOnly when browsing * then it will find *all* records registered on that same local machine. * Clients explicitly wishing to discover *only* LocalOnly services can * accomplish this by inspecting the interfaceIndex of each service reported * to their DNSServiceBrowseReply() callback function, and discarding those * where the interface index is not kDNSServiceInterfaceIndexLocalOnly. */ #define kDNSServiceInterfaceIndexAny 0 #define kDNSServiceInterfaceIndexLocalOnly ( (uint32_t) -1 ) typedef uint32_t DNSServiceFlags; typedef int32_t DNSServiceErrorType; /********************************************************************************************* * * Unix Domain Socket access, DNSServiceRef deallocation, and data processing functions * *********************************************************************************************/ /* DNSServiceRefSockFD() * * Access underlying Unix domain socket for an initialized DNSServiceRef. * The DNS Service Discovery implmementation uses this socket to communicate between * the client and the mDNSResponder daemon. The application MUST NOT directly read from * or write to this socket. Access to the socket is provided so that it can be used as a * run loop source, or in a select() loop: when data is available for reading on the socket, * DNSServiceProcessResult() should be called, which will extract the daemon's reply from * the socket, and pass it to the appropriate application callback. By using a run loop or * select(), results from the daemon can be processed asynchronously. Without using these * constructs, DNSServiceProcessResult() will block until the response from the daemon arrives. * The client is responsible for ensuring that the data on the socket is processed in a timely * fashion - the daemon may terminate its connection with a client that does not clear its * socket buffer. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls. * * return value: The DNSServiceRef's underlying socket descriptor, or -1 on * error. */ #if ORIGINAL_DNSSD_INCLUDE int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef); #else /* */ typedef int DNSSD_API(*_DNSServiceRefSockFD) (DNSServiceRef sdRef); extern _DNSServiceRefSockFD DNSServiceRefSockFD; #endif /* */ /* DNSServiceProcessResult() * * Read a reply from the daemon, calling the appropriate application callback. This call will * block until the daemon's response is received. Use DNSServiceRefSockFD() in * conjunction with a run loop or select() to determine the presence of a response from the * server before calling this function to process the reply without blocking. Call this function * at any point if it is acceptable to block until the daemon's response arrives. Note that the * client is responsible for ensuring that DNSServiceProcessResult() is called whenever there is * a reply from the daemon - the daemon may terminate its connection with a client that does not * process the daemon's responses. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls * that take a callback parameter. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns * an error code indicating the specific failure that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceProcessResult) (DNSServiceRef sdRef); extern _DNSServiceProcessResult DNSServiceProcessResult; #endif /* */ /* DNSServiceRefDeallocate() * * Terminate a connection with the daemon and free memory associated with the DNSServiceRef. * Any services or records registered with this DNSServiceRef will be deregistered. Any * Browse, Resolve, or Query operations called with this reference will be terminated. * * Note: If the reference's underlying socket is used in a run loop or select() call, it should * be removed BEFORE DNSServiceRefDeallocate() is called, as this function closes the reference's * socket. * * Note: If the reference was initialized with DNSServiceCreateConnection(), any DNSRecordRefs * created via this reference will be invalidated by this call - the resource records are * deregistered, and their DNSRecordRefs may not be used in subsequent functions. Similarly, * if the reference was initialized with DNSServiceRegister, and an extra resource record was * added to the service via DNSServiceAddRecord(), the DNSRecordRef created by the Add() call * is invalidated when this function is called - the DNSRecordRef may not be used in subsequent * functions. * * Note: This call is to be used only with the DNSServiceRef defined by this API. It is * not compatible with dns_service_discovery_ref objects defined in the legacy Mach-based * DNSServiceDiscovery.h API. * * sdRef: A DNSServiceRef initialized by any of the DNSService calls. * */ #if ORIGINAL_DNSSD_INCLUDE void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef); #else /* */ typedef void DNSSD_API(*_DNSServiceRefDeallocate) (DNSServiceRef sdRef); extern _DNSServiceRefDeallocate DNSServiceRefDeallocate; #endif /* */ /********************************************************************************************* * * Domain Enumeration * *********************************************************************************************/ /* DNSServiceEnumerateDomains() * * Asynchronously enumerate domains available for browsing and registration. * * The enumeration MUST be cancelled via DNSServiceRefDeallocate() when no more domains * are to be found. * * Note that the names returned are (like all of DNS-SD) UTF-8 strings, * and are escaped using standard DNS escaping rules. * (See "Notes on DNS Name Escaping" earlier in this file for more details.) * A graphical browser displaying a hierarchical tree-structured view should cut * the names at the bare dots to yield individual labels, then de-escape each * label according to the escaping rules, and then display the resulting UTF-8 text. * * DNSServiceDomainEnumReply Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceEnumerateDomains(). * * flags: Possible values are: * kDNSServiceFlagsMoreComing * kDNSServiceFlagsAdd * kDNSServiceFlagsDefault * * interfaceIndex: Specifies the interface on which the domain exists. (The index for a given * interface is determined via the if_nametoindex() family of calls.) * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise indicates * the failure that occurred (other parameters are undefined if errorCode is nonzero). * * replyDomain: The name of the domain. * * context: The context pointer passed to DNSServiceEnumerateDomains. * */ typedef void (DNSSD_API * DNSServiceDomainEnumReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *replyDomain, void *context ); /* DNSServiceEnumerateDomains() Parameters: * * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the enumeration operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Possible values are: * kDNSServiceFlagsBrowseDomains to enumerate domains recommended for browsing. * kDNSServiceFlagsRegistrationDomains to enumerate domains recommended * for registration. * * interfaceIndex: If non-zero, specifies the interface on which to look for domains. * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to enumerate domains on * all interfaces. See "Constants for specifying an interface index" for more details. * * callBack: The function to be called when a domain is found or the call asynchronously * fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is not invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceDomainEnumReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceEnumerateDomains) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceDomainEnumReply callBack, void *context /* may be NULL */ ); extern _DNSServiceEnumerateDomains DNSServiceEnumerateDomains; #endif /* */ /********************************************************************************************* * * Service Registration * *********************************************************************************************/ /* Register a service that is discovered via Browse() and Resolve() calls. * * * DNSServiceRegisterReply() Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceRegister(). * * flags: Currently unused, reserved for future use. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred (including name conflicts, * if the kDNSServiceFlagsNoAutoRename flag was used when registering.) * Other parameters are undefined if errorCode is nonzero. * * name: The service name registered (if the application did not specify a name in * DNSServiceRegister(), this indicates what name was automatically chosen). * * regtype: The type of service registered, as it was passed to the callout. * * domain: The domain on which the service was registered (if the application did not * specify a domain in DNSServiceRegister(), this indicates the default domain * on which the service was registered). * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceRegisterReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context ); /* DNSServiceRegister() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the registration will remain active indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * interfaceIndex: If non-zero, specifies the interface on which to register the service * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to register on all * available interfaces. See "Constants for specifying an interface index" for more details. * * flags: Indicates the renaming behavior on name conflict (most applications * will pass 0). See flag definitions above for details. * * name: If non-NULL, specifies the service name to be registered. * Most applications will not specify a name, in which case the computer * name is used (this name is communicated to the client via the callback). * If a name is specified, it must be 1-63 bytes of UTF-8 text. * If the name is longer than 63 bytes it will be automatically truncated * to a legal length, unless the NoAutoRename flag is set, * in which case kDNSServiceErr_BadParam will be returned. * * regtype: The service type followed by the protocol, separated by a dot * (e.g. "_ftp._tcp"). The service type must be an underscore, followed * by 1-14 characters, which may be letters, digits, or hyphens. * The transport protocol must be "_tcp" or "_udp". New service types * should be registered at . * * domain: If non-NULL, specifies the domain on which to advertise the service. * Most applications will not specify a domain, instead automatically * registering in the default domain(s). * * host: If non-NULL, specifies the SRV target host name. Most applications * will not specify a host, instead automatically using the machine's * default host name(s). Note that specifying a non-NULL host does NOT * create an address record for that host - the application is responsible * for ensuring that the appropriate address record exists, or creating it * via DNSServiceRegisterRecord(). * * port: The port, in network byte order, on which the service accepts connections. * Pass 0 for a "placeholder" service (i.e. a service that will not be discovered * by browsing, but will cause a name conflict if another client tries to * register that same name). Most clients will not use placeholder services. * * txtLen: The length of the txtRecord, in bytes. Must be zero if the txtRecord is NULL. * * txtRecord: The TXT record rdata. A non-NULL txtRecord MUST be a properly formatted DNS * TXT record, i.e. ... * Passing NULL for the txtRecord is allowed as a synonym for txtLen=1, txtRecord="", * i.e. it creates a TXT record of length one containing a single empty string. * RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty * string is the smallest legal DNS TXT record. * * callBack: The function to be called when the registration completes or asynchronously * fails. The client MAY pass NULL for the callback - The client will NOT be notified * of the default values picked on its behalf, and the client will NOT be notified of any * asynchronous errors (e.g. out of memory errors, etc.) that may prevent the registration * of the service. The client may NOT pass the NoAutoRename flag if the callback is NULL. * The client may still deregister the service at any time via DNSServiceRefDeallocate(). * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) * */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRegister ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, /* may be NULL */ const char *regtype, const char *domain, /* may be NULL */ const char *host, /* may be NULL */ uint16_t port, uint16_t txtLen, const void *txtRecord, /* may be NULL */ DNSServiceRegisterReply callBack, /* may be NULL */ void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRegister) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, /* may be NULL */ const char *regtype, const char *domain, /* may be NULL */ const char *host, /* may be NULL */ uint16_t port, uint16_t txtLen, const void *txtRecord, /* may be NULL */ DNSServiceRegisterReply callBack, /* may be NULL */ void *context /* may be NULL */ ); extern _DNSServiceRegister DNSServiceRegister; #endif /* */ /* DNSServiceAddRecord() * * Add a record to a registered service. The name of the record will be the same as the * registered service's name. * The record can later be updated or deregistered by passing the RecordRef initialized * by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * * * Parameters; * * sdRef: A DNSServiceRef initialized by DNSServiceRegister(). * * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * If the above DNSServiceRef is passed to DNSServiceRefDeallocate(), RecordRef is also * invalidated and may not be used further. * * flags: Currently ignored, reserved for future use. * * rrtype: The type of the record (e.g. kDNSServiceType_TXT, kDNSServiceType_SRV, etc) * * rdlen: The length, in bytes, of the rdata. * * rdata: The raw rdata to be contained in the added resource record. * * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred (the RecordRef is not initialized). */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceAddRecord ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceAddRecord) ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl ); extern _DNSServiceAddRecord DNSServiceAddRecord; #endif /* */ /* DNSServiceUpdateRecord * * Update a registered resource record. The record must either be: * - The primary txt record of a service registered via DNSServiceRegister() * - A record added to a registered service via DNSServiceAddRecord() * - An individual record registered by DNSServiceRegisterRecord() * * * Parameters: * * sdRef: A DNSServiceRef that was initialized by DNSServiceRegister() * or DNSServiceCreateConnection(). * * RecordRef: A DNSRecordRef initialized by DNSServiceAddRecord, or NULL to update the * service's primary txt record. * * flags: Currently ignored, reserved for future use. * * rdlen: The length, in bytes, of the new rdata. * * rdata: The new rdata to be contained in the updated resource record. * * ttl: The time to live of the updated resource record, in seconds. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord ( DNSServiceRef sdRef, DNSRecordRef RecordRef, /* may be NULL */ DNSServiceFlags flags, uint16_t rdlen, const void *rdata, uint32_t ttl ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceUpdateRecord) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, /* may be NULL */ DNSServiceFlags flags, uint16_t rdlen, const void *rdata, uint32_t ttl ); extern _DNSServiceUpdateRecord DNSServiceUpdateRecord; #endif /* */ /* DNSServiceRemoveRecord * * Remove a record previously added to a service record set via DNSServiceAddRecord(), or deregister * an record registered individually via DNSServiceRegisterRecord(). * * Parameters: * * sdRef: A DNSServiceRef initialized by DNSServiceRegister() (if the * record being removed was registered via DNSServiceAddRecord()) or by * DNSServiceCreateConnection() (if the record being removed was registered via * DNSServiceRegisterRecord()). * * recordRef: A DNSRecordRef initialized by a successful call to DNSServiceAddRecord() * or DNSServiceRegisterRecord(). * * flags: Currently ignored, reserved for future use. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an * error code indicating the error that occurred. */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRemoveRecord) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags ); extern _DNSServiceRemoveRecord DNSServiceRemoveRecord; #endif /* */ /********************************************************************************************* * * Service Discovery * *********************************************************************************************/ /* Browse for instances of a service. * * * DNSServiceBrowseReply() Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceBrowse(). * * flags: Possible values are kDNSServiceFlagsMoreComing and kDNSServiceFlagsAdd. * See flag definitions for details. * * interfaceIndex: The interface on which the service is advertised. This index should * be passed to DNSServiceResolve() when resolving the service. * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * the errorCode is nonzero. * * serviceName: The discovered service name. This name should be displayed to the user, * and stored for subsequent use in the DNSServiceResolve() call. * * regtype: The service type, which is usually (but not always) the same as was passed * to DNSServiceBrowse(). One case where the discovered service type may * not be the same as the requested service type is when using subtypes: * The client may want to browse for only those ftp servers that allow * anonymous connections. The client will pass the string "_ftp._tcp,_anon" * to DNSServiceBrowse(), but the type of the service that's discovered * is simply "_ftp._tcp". The regtype for each discovered service instance * should be stored along with the name, so that it can be passed to * DNSServiceResolve() when the service is later resolved. * * domain: The domain of the discovered service instance. This may or may not be the * same as the domain that was passed to DNSServiceBrowse(). The domain for each * discovered service instance should be stored along with the name, so that * it can be passed to DNSServiceResolve() when the service is later resolved. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceBrowseReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context ); /* DNSServiceBrowse() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the browse operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Currently ignored, reserved for future use. * * interfaceIndex: If non-zero, specifies the interface on which to browse for services * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Most applications will pass 0 to browse on all available * interfaces. See "Constants for specifying an interface index" for more details. * * regtype: The service type being browsed for followed by the protocol, separated by a * dot (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp". * * domain: If non-NULL, specifies the domain on which to browse for services. * Most applications will not specify a domain, instead browsing on the * default domain(s). * * callBack: The function to be called when an instance of the service being browsed for * is found, or if the call asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is not invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceBrowse ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *regtype, const char *domain, /* may be NULL */ DNSServiceBrowseReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceBrowse) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *regtype, const char *domain, /* may be NULL */ DNSServiceBrowseReply callBack, void *context /* may be NULL */ ); extern _DNSServiceBrowse DNSServiceBrowse; #endif /* */ /* DNSServiceResolve() * * Resolve a service name discovered via DNSServiceBrowse() to a target host name, port number, and * txt record. * * Note: Applications should NOT use DNSServiceResolve() solely for txt record monitoring - use * DNSServiceQueryRecord() instead, as it is more efficient for this task. * * Note: When the desired results have been returned, the client MUST terminate the resolve by calling * DNSServiceRefDeallocate(). * * Note: DNSServiceResolve() behaves correctly for typical services that have a single SRV record * and a single TXT record. To resolve non-standard services with multiple SRV or TXT records, * DNSServiceQueryRecord() should be used. * * DNSServiceResolveReply Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceResolve(). * * flags: Currently unused, reserved for future use. * * interfaceIndex: The interface on which the service was resolved. * * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * the errorCode is nonzero. * * fullname: The full service domain name, in the form ... * (This name is escaped following standard DNS rules, making it suitable for * passing to standard system DNS APIs such as res_query(), or to the * special-purpose functions included in this API that take fullname parameters. * See "Notes on DNS Name Escaping" earlier in this file for more details.) * * hosttarget: The target hostname of the machine providing the service. This name can * be passed to functions like gethostbyname() to identify the host's IP address. * * port: The port, in network byte order, on which connections are accepted for this service. * * txtLen: The length of the txt record, in bytes. * * txtRecord: The service's primary txt record, in standard txt record format. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceResolveReply) ( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context ); /* DNSServiceResolve() Parameters * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the resolve operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Currently ignored, reserved for future use. * * interfaceIndex: The interface on which to resolve the service. If this resolve call is * as a result of a currently active DNSServiceBrowse() operation, then the * interfaceIndex should be the index reported in the DNSServiceBrowseReply * callback. If this resolve call is using information previously saved * (e.g. in a preference file) for later use, then use interfaceIndex 0, because * the desired service may now be reachable via a different physical interface. * See "Constants for specifying an interface index" for more details. * * name: The name of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * regtype: The type of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * domain: The domain of the service instance to be resolved, as reported to the * DNSServiceBrowseReply() callback. * * callBack: The function to be called when a result is found, or if the call * asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceResolve ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceResolve) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context /* may be NULL */ ); extern _DNSServiceResolve DNSServiceResolve; #endif /* */ /********************************************************************************************* * * Special Purpose Calls (most applications will not use these) * *********************************************************************************************/ /* DNSServiceCreateConnection() * * Create a connection to the daemon allowing efficient registration of * multiple individual records. * * * Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating * the reference (via DNSServiceRefDeallocate()) severs the * connection and deregisters all records registered on this connection. * * return value: Returns kDNSServiceErr_NoError on success, otherwise returns * an error code indicating the specific failure that occurred (in which * case the DNSServiceRef is not initialized). */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef * sdRef); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceCreateConnection) (DNSServiceRef * sdRef); extern _DNSServiceCreateConnection DNSServiceCreateConnection; #endif /* */ /* DNSServiceRegisterRecord * * Register an individual resource record on a connected DNSServiceRef. * * Note that name conflicts occurring for records registered via this call must be handled * by the client in the callback. * * * DNSServiceRegisterRecordReply() parameters: * * sdRef: The connected DNSServiceRef initialized by * DNSServiceDiscoveryConnect(). * * RecordRef: The DNSRecordRef initialized by DNSServiceRegisterRecord(). If the above * DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is * invalidated, and may not be used further. * * flags: Currently unused, reserved for future use. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred (including name conflicts.) * Other parameters are undefined if errorCode is nonzero. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceRegisterRecordReply) ( DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, void *context ); /* DNSServiceRegisterRecord() Parameters: * * sdRef: A DNSServiceRef initialized by DNSServiceCreateConnection(). * * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord(). * (To deregister ALL records registered on a single connected DNSServiceRef * and deallocate each of their corresponding DNSServiceRecordRefs, call * DNSServiceRefDealloocate()). * * flags: Possible values are kDNSServiceFlagsShared or kDNSServiceFlagsUnique * (see flag type definitions for details). * * interfaceIndex: If non-zero, specifies the interface on which to register the record * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Passing 0 causes the record to be registered on all interfaces. * See "Constants for specifying an interface index" for more details. * * fullname: The full domain name of the resource record. * * rrtype: The numerical type of the resource record (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN) * * rdlen: Length, in bytes, of the rdata. * * rdata: A pointer to the raw rdata, as it is to appear in the DNS record. * * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value. * * callBack: The function to be called when a result is found, or if the call * asynchronously fails (e.g. because of a name conflict.) * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSRecordRef is * not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, DNSServiceRegisterRecordReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceRegisterRecord) ( DNSServiceRef sdRef, DNSRecordRef * RecordRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, DNSServiceRegisterRecordReply callBack, void *context /* may be NULL */ ); extern _DNSServiceRegisterRecord DNSServiceRegisterRecord; #endif /* */ /* DNSServiceQueryRecord * * Query for an arbitrary DNS record. * * * DNSServiceQueryRecordReply() Callback Parameters: * * sdRef: The DNSServiceRef initialized by DNSServiceQueryRecord(). * * flags: Possible values are kDNSServiceFlagsMoreComing and * kDNSServiceFlagsAdd. The Add flag is NOT set for PTR records * with a ttl of 0, i.e. "Remove" events. * * interfaceIndex: The interface on which the query was resolved (the index for a given * interface is determined via the if_nametoindex() family of calls). * See "Constants for specifying an interface index" for more details. * * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will * indicate the failure that occurred. Other parameters are undefined if * errorCode is nonzero. * * fullname: The resource record's full domain name. * * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * rdlen: The length, in bytes, of the resource record rdata. * * rdata: The raw rdata of the resource record. * * ttl: The resource record's time to live, in seconds. * * context: The context pointer that was passed to the callout. * */ typedef void (DNSSD_API * DNSServiceQueryRecordReply) ( DNSServiceRef DNSServiceRef_, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context ); /* DNSServiceQueryRecord() Parameters: * * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError, * and the query operation will run indefinitely until the client * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate(). * * flags: Pass kDNSServiceFlagsLongLivedQuery to create a "long-lived" unicast * query in a non-local domain. Without setting this flag, unicast queries * will be one-shot - that is, only answers available at the time of the call * will be returned. By setting this flag, answers (including Add and Remove * events) that become available after the initial call is made will generate * callbacks. This flag has no effect on link-local multicast queries. * * interfaceIndex: If non-zero, specifies the interface on which to issue the query * (the index for a given interface is determined via the if_nametoindex() * family of calls.) Passing 0 causes the name to be queried for on all * interfaces. See "Constants for specifying an interface index" for more details. * * fullname: The full domain name of the resource record to be queried for. * * rrtype: The numerical type of the resource record to be queried for * (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * callBack: The function to be called when a result is found, or if the call * asynchronously fails. * * context: An application context pointer which is passed to the callback function * (may be NULL). * * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous * errors are delivered to the callback), otherwise returns an error code indicating * the error that occurred (the callback is never invoked and the DNSServiceRef * is not initialized.) */ #if ORIGINAL_DNSSD_INCLUDE DNSServiceErrorType DNSSD_API DNSServiceQueryRecord ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context /* may be NULL */ ); #else /* */ typedef DNSServiceErrorType DNSSD_API(*_DNSServiceQueryRecord) ( DNSServiceRef * sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context /* may be NULL */ ); extern _DNSServiceQueryRecord DNSServiceQueryRecord; #endif /* */ /* DNSServiceReconfirmRecord * * Instruct the daemon to verify the validity of a resource record that appears to * be out of date (e.g. because tcp connection to a service's target failed.) * Causes the record to be flushed from the daemon's cache (as well as all other * daemons' caches on the network) if the record is determined to be invalid. * * Parameters: * * flags: Currently unused, reserved for future use. * * interfaceIndex: If non-zero, specifies the interface of the record in question. * Passing 0 causes all instances of this record to be reconfirmed. * * fullname: The resource record's full domain name. * * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc) * * rrclass: The class of the resource record (usually kDNSServiceClass_IN). * * rdlen: The length, in bytes, of the resource record rdata. * * rdata: The raw rdata of the resource record. * */ #if ORIGINAL_DNSSD_INCLUDE void DNSSD_API DNSServiceReconfirmRecord ( DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata ); #else /* */ typedef void DNSSD_API(*_DNSServiceReconfirmRecord) ( DNSServiceFlags flags, uint32_t interfaceIndex, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata ); extern _DNSServiceReconfirmRecord DNSServiceReconfirmRecord; #endif /* */ /********************************************************************************************* * * General Utility Functions * *********************************************************************************************/ /* DNSServiceConstructFullName() * * Concatenate a three-part domain name (as returned by the above callbacks) into a * properly-escaped full domain name. Note that callbacks in the above functions ALREADY ESCAPE * strings where necessary. * * Parameters: * * fullName: A pointer to a buffer that where the resulting full domain name is to be written. * The buffer must be kDNSServiceMaxDomainName (1005) bytes in length to * accommodate the longest legal domain name without buffer overrun. * * service: The service name - any dots or backslashes must NOT be escaped. * May be NULL (to construct a PTR record name, e.g. * "_ftp._tcp.apple.com."). * * regtype: The service type followed by the protocol, separated by a dot * (e.g. "_ftp._tcp"). * * domain: The domain name, e.g. "apple.com.". Literal dots or backslashes, * if any, must be escaped, e.g. "1st\. Floor.apple.com." * * return value: Returns 0 on success, -1 on error. * */ #if ORIGINAL_DNSSD_INCLUDE int DNSSD_API DNSServiceConstructFullName ( char *fullName, const char *service, /* may be NULL */ const char *regtype, const char *domain ); #else /* */ typedef int DNSSD_API(*_DNSServiceConstructFullName) ( char *fullName, const char *service, /* may be NULL */ const char *regtype, const char *domain ); extern _DNSServiceConstructFullName DNSServiceConstructFullName; #endif /* */ /********************************************************************************************* * * TXT Record Construction Functions * *********************************************************************************************/ /* * A typical calling sequence for TXT record construction is something like: * * Client allocates storage for TXTRecord data (e.g. declare buffer on the stack) * TXTRecordCreate(); * TXTRecordSetValue(); * TXTRecordSetValue(); * TXTRecordSetValue(); * ... * DNSServiceRegister( ... TXTRecordGetLength(), TXTRecordGetBytesPtr() ... ); * TXTRecordDeallocate(); * Explicitly deallocate storage for TXTRecord data (if not allocated on the stack) */ /* TXTRecordRef * * Opaque internal data type. * Note: Represents a DNS-SD TXT record. */ typedef union _TXTRecordRef_t { char PrivateData[16]; char *ForceNaturalAlignment; } TXTRecordRef; /* TXTRecordCreate() * * Creates a new empty TXTRecordRef referencing the specified storage. * * If the buffer parameter is NULL, or the specified storage size is not * large enough to hold a key subsequently added using TXTRecordSetValue(), * then additional memory will be added as needed using malloc(). * * On some platforms, when memory is low, malloc() may fail. In this * case, TXTRecordSetValue() will return kDNSServiceErr_NoMemory, and this * error condition will need to be handled as appropriate by the caller. * * You can avoid the need to handle this error condition if you ensure * that the storage you initially provide is large enough to hold all * the key/value pairs that are to be added to the record. * The caller can precompute the exact length required for all of the * key/value pairs to be added, or simply provide a fixed-sized buffer * known in advance to be large enough. * A no-value (key-only) key requires (1 + key length) bytes. * A key with empty value requires (1 + key length + 1) bytes. * A key with non-empty value requires (1 + key length + 1 + value length). * For most applications, DNS-SD TXT records are generally * less than 100 bytes, so in most cases a simple fixed-sized * 256-byte buffer will be more than sufficient. * Recommended size limits for DNS-SD TXT Records are discussed in * * * Note: When passing parameters to and from these TXT record APIs, * the key name does not include the '=' character. The '=' character * is the separator between the key and value in the on-the-wire * packet format; it is not part of either the key or the value. * * txtRecord: A pointer to an uninitialized TXTRecordRef. * * bufferLen: The size of the storage provided in the "buffer" parameter. * * buffer: Optional caller-supplied storage used to hold the TXTRecord data. * This storage must remain valid for as long as * the TXTRecordRef. */ void DNSSD_API TXTRecordCreate ( TXTRecordRef * txtRecord, uint16_t bufferLen, void *buffer ); /* TXTRecordDeallocate() * * Releases any resources allocated in the course of preparing a TXT Record * using TXTRecordCreate()/TXTRecordSetValue()/TXTRecordRemoveValue(). * Ownership of the buffer provided in TXTRecordCreate() returns to the client. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * */ void DNSSD_API TXTRecordDeallocate ( TXTRecordRef * txtRecord ); /* TXTRecordSetValue() * * Adds a key (optionally with value) to a TXTRecordRef. If the "key" already * exists in the TXTRecordRef, then the current value will be replaced with * the new value. * Keys may exist in four states with respect to a given TXT record: * - Absent (key does not appear at all) * - Present with no value ("key" appears alone) * - Present with empty value ("key=" appears in TXT record) * - Present with non-empty value ("key=value" appears in TXT record) * For more details refer to "Data Syntax for DNS-SD TXT Records" in * * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * key: A null-terminated string which only contains printable ASCII * values (0x20-0x7E), excluding '=' (0x3D). Keys should be * 8 characters or less (not counting the terminating null). * * valueSize: The size of the value. * * value: Any binary value. For values that represent * textual data, UTF-8 is STRONGLY recommended. * For values that represent textual data, valueSize * should NOT include the terminating null (if any) * at the end of the string. * If NULL, then "key" will be added with no value. * If non-NULL but valueSize is zero, then "key=" will be * added with empty value. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_Invalid if the "key" string contains * illegal characters. * Returns kDNSServiceErr_NoMemory if adding this key would * exceed the available storage. */ DNSServiceErrorType DNSSD_API TXTRecordSetValue ( TXTRecordRef * txtRecord, const char *key, uint8_t valueSize, /* may be zero */ const void *value /* may be NULL */ ); /* TXTRecordRemoveValue() * * Removes a key from a TXTRecordRef. The "key" must be an * ASCII string which exists in the TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * key: A key name which exists in the TXTRecordRef. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_NoSuchKey if the "key" does not * exist in the TXTRecordRef. * */ DNSServiceErrorType DNSSD_API TXTRecordRemoveValue ( TXTRecordRef * txtRecord, const char *key ); /* TXTRecordGetLength() * * Allows you to determine the length of the raw bytes within a TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * return value: Returns the size of the raw bytes inside a TXTRecordRef * which you can pass directly to DNSServiceRegister() or * to DNSServiceUpdateRecord(). * Returns 0 if the TXTRecordRef is empty. * */ uint16_t DNSSD_API TXTRecordGetLength ( const TXTRecordRef * txtRecord ); /* TXTRecordGetBytesPtr() * * Allows you to retrieve a pointer to the raw bytes within a TXTRecordRef. * * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate(). * * return value: Returns a pointer to the raw bytes inside the TXTRecordRef * which you can pass directly to DNSServiceRegister() or * to DNSServiceUpdateRecord(). * */ const void *DNSSD_API TXTRecordGetBytesPtr ( const TXTRecordRef * txtRecord ); /********************************************************************************************* * * TXT Record Parsing Functions * *********************************************************************************************/ /* * A typical calling sequence for TXT record parsing is something like: * * Receive TXT record data in DNSServiceResolve() callback * if (TXTRecordContainsKey(txtLen, txtRecord, "key")) then do something * val1ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key1", &len1); * val2ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key2", &len2); * ... * bcopy(val1ptr, myval1, len1); * bcopy(val2ptr, myval2, len2); * ... * return; * * If you wish to retain the values after return from the DNSServiceResolve() * callback, then you need to copy the data to your own storage using bcopy() * or similar, as shown in the example above. * * If for some reason you need to parse a TXT record you built yourself * using the TXT record construction functions above, then you can do * that using TXTRecordGetLength and TXTRecordGetBytesPtr calls: * TXTRecordGetValue(TXTRecordGetLength(x), TXTRecordGetBytesPtr(x), key, &len); * * Most applications only fetch keys they know about from a TXT record and * ignore the rest. * However, some debugging tools wish to fetch and display all keys. * To do that, use the TXTRecordGetCount() and TXTRecordGetItemAtIndex() calls. */ /* TXTRecordContainsKey() * * Allows you to determine if a given TXT Record contains a specified key. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * key: A null-terminated ASCII string containing the key name. * * return value: Returns 1 if the TXT Record contains the specified key. * Otherwise, it returns 0. * */ int DNSSD_API TXTRecordContainsKey ( uint16_t txtLen, const void *txtRecord, const char *key ); /* TXTRecordGetValuePtr() * * Allows you to retrieve the value for a given key from a TXT Record. * * txtLen: The size of the received TXT Record * * txtRecord: Pointer to the received TXT Record bytes. * * key: A null-terminated ASCII string containing the key name. * * valueLen: On output, will be set to the size of the "value" data. * * return value: Returns NULL if the key does not exist in this TXT record, * or exists with no value (to differentiate between * these two cases use TXTRecordContainsKey()). * Returns pointer to location within TXT Record bytes * if the key exists with empty or non-empty value. * For empty value, valueLen will be zero. * For non-empty value, valueLen will be length of value data. */ const void *DNSSD_API TXTRecordGetValuePtr ( uint16_t txtLen, const void *txtRecord, const char *key, uint8_t * valueLen ); /* TXTRecordGetCount() * * Returns the number of keys stored in the TXT Record. The count * can be used with TXTRecordGetItemAtIndex() to iterate through the keys. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * return value: Returns the total number of keys in the TXT Record. * */ uint16_t DNSSD_API TXTRecordGetCount ( uint16_t txtLen, const void *txtRecord ); /* TXTRecordGetItemAtIndex() * * Allows you to retrieve a key name and value pointer, given an index into * a TXT Record. Legal index values range from zero to TXTRecordGetCount()-1. * It's also possible to iterate through keys in a TXT record by simply * calling TXTRecordGetItemAtIndex() repeatedly, beginning with index zero * and increasing until TXTRecordGetItemAtIndex() returns kDNSServiceErr_Invalid. * * On return: * For keys with no value, *value is set to NULL and *valueLen is zero. * For keys with empty value, *value is non-NULL and *valueLen is zero. * For keys with non-empty value, *value is non-NULL and *valueLen is non-zero. * * txtLen: The size of the received TXT Record. * * txtRecord: Pointer to the received TXT Record bytes. * * index: An index into the TXT Record. * * keyBufLen: The size of the string buffer being supplied. * * key: A string buffer used to store the key name. * On return, the buffer contains a null-terminated C string * giving the key name. DNS-SD TXT keys are usually * 8 characters or less. To hold the maximum possible * key name, the buffer should be 256 bytes long. * * valueLen: On output, will be set to the size of the "value" data. * * value: On output, *value is set to point to location within TXT * Record bytes that holds the value data. * * return value: Returns kDNSServiceErr_NoError on success. * Returns kDNSServiceErr_NoMemory if keyBufLen is too short. * Returns kDNSServiceErr_Invalid if index is greater than * TXTRecordGetCount()-1. */ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex ( uint16_t txtLen, const void *txtRecord, uint16_t index_, uint16_t keyBufLen, char *key, uint8_t * valueLen, const void **value ); #ifdef __APPLE_API_PRIVATE /* * Mac OS X specific functionality * 3rd party clients of this API should not depend on future support or availability of this routine */ /* DNSServiceSetDefaultDomainForUser() * * Set the default domain for the caller's UID. Future browse and registration * calls by this user that do not specify an explicit domain will browse and * register in this wide-area domain in addition to .local. In addition, this * domain will be returned as a Browse domain via domain enumeration calls. * * * Parameters: * * flags: Pass kDNSServiceFlagsAdd to add a domain for a user. Call without * this flag set to clear a previously added domain. * * domain: The domain to be used for the caller's UID. * * return value: Returns kDNSServiceErr_NoError on succeses, otherwise returns * an error code indicating the error that occurred */ DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser ( DNSServiceFlags flags, const char *domain ); #endif //__APPLE_API_PRIVATE // Some C compiler cleverness. We can make the compiler check certain things for us, // and report errors at compile-time if anything is wrong. The usual way to do this would // be to use a run-time "if" statement or the conventional run-time "assert" mechanism, but // then you don't find out what's wrong until you run the software. This way, if the assertion // condition is false, the array size is negative, and the complier complains immediately. struct DNS_SD_CompileTimeAssertionChecks { char assert0[(sizeof(union _TXTRecordRef_t) == 16) ? 1 : -1]; }; #ifdef __cplusplus } #endif /* */ #endif /* _DNS_SD_H */ owfs-2.8p15/module/owlib/src/include/compat_getopt.h0000664000175000017500000001354010750074144017450 00000000000000/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include "owfs_config.h" #ifndef _COMP_GETOPT_H #define _COMP_GETOPT_H /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_GETOPT /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #endif /* HAVE_GETOPT */ #ifndef HAVE_GETOPT_LONG /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* HAVE_GETOPT_LONG */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #ifndef HAVE_GETOPT /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt(int __argc, char *const *__argv, const char *__shortopts); #endif #ifndef HAVE_GETOPT_LONG extern int getopt_long(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); #endif #ifdef __cplusplus } #endif #endif /* _COMP_GETOPT_H */ owfs-2.8p15/module/owlib/src/include/ow_connection.h0000664000175000017500000001654611632033654017461 00000000000000/* $Id: ow_connection.h,v 1.244 2011/09/08 03:34:04 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_CONNECTION_H /* tedious wrapper */ #define OW_CONNECTION_H /* Jan 21, 2007 from the IANA: owserver 4304/tcp One-Wire Filesystem Server owserver 4304/udp One-Wire Filesystem Server # Paul Alfille January 2007 See: http://www.iana.org/assignments/port-numbers */ #define DEFAULT_SERVER_PORT "4304" #define DEFAULT_FTP_PORT "21" #define DEFAULT_HA7_PORT "80" #define DEFAULT_ENET_PORT "8080" #define DEFAULT_LINK_PORT "10001" #define DEFAULT_XPORT_CONTROL_PORT "9999" #define DEFAULT_XPORT_PORT "10001" #define DEFAULT_ETHERWEATHER_PORT "15862" #include "ow.h" #include "ow_counters.h" #include #include "ow_transaction.h" /* reset types */ #include "ow_reset.h" /* bus serach */ #include "ow_search.h" /* connect to a bus master */ #include "ow_detect.h" /* address for i2c or usb */ #include "ow_parse_address.h" /* w1 sequence defines */ #include "ow_w1_seq.h" #if OW_USB /* conditional inclusion of USB */ /* Special libusb 0.1x search */ #include "ow_usb_cycle.h" #endif /* OW_USB */ /* large enough for arrays of 2048 elements of ~49 bytes each */ #define MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE 100050 /* com port fifo info */ /* The UART_FIFO_SIZE defines the amount of bytes that are written before * reading the reply. Any positive value should work and 16 is probably low * enough to avoid losing bytes in even most extreme situations on all modern * UARTs, and values bigger than that will probably work on almost any * system... The value affects readout performance asymptotically, value of 1 * should give equivalent performance with the old implementation. * -- Jari Kirma * * Note: Each bit sent to the 1-wire net requeires 1 byte to be sent to * the uart. */ #define UART_FIFO_SIZE 160 /** USB bulk endpoint FIFO size Need one for each for read and write This is for alt setting "3" -- 64 bytes, 1msec polling */ #define USB_FIFO_EACH 64 #define USB_FIFO_READ 0 #define USB_FIFO_WRITE USB_FIFO_EACH #define USB_FIFO_SIZE ( USB_FIFO_EACH + USB_FIFO_EACH ) #define HA7_FIFO_SIZE 128 #define W1_FIFO_SIZE 128 #define LINK_FIFO_SIZE UART_FIFO_SIZE #define HA7E_FIFO_SIZE UART_FIFO_SIZE #define HA5_FIFO_SIZE UART_FIFO_SIZE #define LINKE_FIFO_SIZE 1500 #define I2C_FIFO_SIZE 1 #if USB_FIFO_SIZE > UART_FIFO_SIZE #define MAX_FIFO_SIZE USB_FIFO_SIZE #else #define MAX_FIFO_SIZE UART_FIFO_SIZE #endif /* Debugging interface to showing all bus traffic * You need to configure compile with * ./configure --enable-owtraffic * */ #include "ow_traffic.h" /* -------------------------------------------- */ /* Interface-specific routines ---------------- */ #include "ow_bus_routines.h" /* -------------------------------------------- */ /* Inbound connections (bus masters) ---------- */ #include "ow_connection_in.h" /* -------------------------------------------- */ /* Outbound connections (ownet clients) ---------- */ #include "ow_connection_out.h" /* This bug-fix/workaround function seem to be fixed now... At least on * the platforms I have tested it on... printf() in owserver/src/c/owserver.c * returned very strange result on c->busmode before... but not anymore */ enum bus_mode get_busmode(struct connection_in *c); int BusIsServer(struct connection_in *in); // mode bit flags for level #define MODE_NORMAL 0x00 #define MODE_STRONG5 0x01 #define MODE_PROGRAM 0x02 #define MODE_BREAK 0x04 // 1Wire Bus Speed Setting Constants #define ONEWIREBUSSPEED_REGULAR 0x00 #define ONEWIREBUSSPEED_FLEXIBLE 0x01 /* Only used for USB adapter */ #define ONEWIREBUSSPEED_OVERDRIVE 0x02 /* Serial port */ GOOD_OR_BAD COM_open(struct connection_in *in); GOOD_OR_BAD serial_open(struct connection_in *in); GOOD_OR_BAD tcp_open(struct connection_in *in); GOOD_OR_BAD COM_test( struct connection_in * connection ); void COM_set_standard( struct connection_in *connection) ; void COM_close(struct connection_in *in); void COM_free(struct connection_in *in); void serial_free(struct connection_in *in); void tcp_free(struct connection_in *in); void COM_flush( const struct connection_in *in); void COM_break(struct connection_in *in); GOOD_OR_BAD telnet_break(struct connection_in *in) ; GOOD_OR_BAD COM_change( struct connection_in *connection) ; GOOD_OR_BAD serial_change(struct connection_in *connection) ; GOOD_OR_BAD telnet_change(struct connection_in *in) ; GOOD_OR_BAD COM_write( const BYTE * data, size_t length, struct connection_in *connection); GOOD_OR_BAD COM_write_simple( const BYTE * data, size_t length, struct connection_in *connection); GOOD_OR_BAD telnet_write_binary( const BYTE * buf, const size_t size, struct connection_in *in); GOOD_OR_BAD COM_read( BYTE * data, size_t length, struct connection_in *connection); SIZE_OR_ERROR COM_read_with_timeout( BYTE * data, size_t length, struct connection_in *connection ) ; void COM_slurp( struct connection_in *in); GOOD_OR_BAD telnet_purge(struct connection_in *in) ; GOOD_OR_BAD telnet_read(BYTE * buf, const size_t size, struct connection_in *in) ; void FreeInAll(void); void RemoveIn( struct connection_in * conn ) ; void FreeOutAll(void); void DelIn(struct connection_in *in); struct connection_in *AllocIn(const struct connection_in *in); struct connection_in *LinkIn(struct connection_in *in); struct connection_in *NewIn(const struct connection_in *in); void Add_InFlight( GOOD_OR_BAD (*nomatch)(struct connection_in * trial,struct connection_in * existing), struct connection_in * new_in ); void Del_InFlight( GOOD_OR_BAD (*nomatch)(struct connection_in * trial,struct connection_in * existing), struct connection_in * new_in ); struct connection_in *find_connection_in(int nr); int SetKnownBus( int bus_number, struct parsedname * pn) ; struct connection_out *NewOut(void); /* Bonjour registration */ void ZeroConf_Announce(struct connection_out *out); void OW_Browse(struct connection_in *in); GOOD_OR_BAD TestConnection(const struct parsedname *pn); void ZeroAdd(const char * name, const char * type, const char * domain, const char * host, const char * service) ; void ZeroDel(const char * name, const char * type, const char * domain ) ; #define STAT_ADD1_BUS( err, in ) STATLOCK; ++((in)->bus_stat[err]) ; STATUNLOCK #endif /* OW_CONNECTION_H */ owfs-2.8p15/module/owlib/src/include/ow_opt.h0000644000175000017500000000562611731463643016124 00000000000000/* $Id: ow_opt.h,v 1.24 2012/03/17 00:28:29 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_OPT_H /* tedious wrapper */ #define OW_OPT_H /* command line options */ /* These are the owlib-specific options */ #define OWLIB_OPT "a:m:c:f:p:s:h::u::d:t:CFRKVPrw:" extern const struct option owopts_long[]; GOOD_OR_BAD owopt(const int c, const char *arg); GOOD_OR_BAD owopt_packed(const char *params); // All these command line arguments are after the printable ascii characters enum e_long_option { e_error_print = 257, e_error_level, e_debug, e_cache_size, e_fuse_opt, e_fuse_open_opt, e_max_clients, e_safemode, e_ha7, e_fake, e_link, e_ha3, e_ha4b, e_ha5, e_ha7e, e_tester, e_mock, e_etherweather, e_passive, e_i2c, e_xport, e_enet, e_w1_monitor, e_usb_monitor, e_browse, e_pressure_mbar, e_pressure_atm, e_pressure_mmhg, e_pressure_inhg, e_pressure_psi, e_pressure_Pa, e_pressure_6, e_pressure_7, e_announce, e_timeout_volatile, e_timeout_stable, e_timeout_directory, e_timeout_presence, e_timeout_serial, e_timeout_usb, e_timeout_network, e_timeout_server, e_timeout_ftp, e_timeout_ha7, e_timeout_w1, e_timeout_persistent_low, e_timeout_persistent_high, e_clients_persistent_low, e_clients_persistent_high, e_concurrent_connections, e_fatal_debug_file, e_baud, e_templow, e_temphigh, }; #endif /* OW_OPT_H */ owfs-2.8p15/module/owlib/src/include/ow_pressure.h0000664000175000017500000000260711324736501017162 00000000000000/* $Id: ow_pressure.h,v 1.1 2010/01/18 01:45:37 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* Cannot stand alone -- separated out of ow.h for clarity */ #ifndef OW_PRESSURE_H /* tedious wrapper */ #define OW_PRESSURE_H /* Global pressure scale up tp 8 */ enum pressure_type { pressure_mbar, pressure_atm, pressure_mmhg, pressure_inhg, pressure_psi, pressure_Pa, pressure_end_mark }; _FLOAT Pressure(_FLOAT P, const struct parsedname *pn); _FLOAT fromPressure(_FLOAT P, const struct parsedname *pn); const char *PressureScaleName(enum pressure_type p); #endif /* OW_PRESSURE_H */ owfs-2.8p15/module/owlib/src/include/ow_counters.h0000664000175000017500000001177511535564273017173 00000000000000/* $Id: ow_counters.h,v 1.15 2011/03/09 02:40:59 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 All the error and statistics counters are declared here, including handling macros */ /* Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_COUNTERS_H /* tedious wrapper */ #define OW_COUNTERS_H /* ----------------- */ /* -- Statistics --- */ /* ----------------- */ struct average { UINT max; UINT sum; UINT count; UINT current; }; struct cache_stats { UINT tries; UINT hits; UINT adds; UINT expires; UINT deletes; }; struct directory { UINT calls; UINT entries; }; #define AVERAGE_IN(pA) ++(pA)->current; ++(pA)->count; (pA)->sum+=(pA)->current; if ((pA)->current>(pA)->max)++(pA)->max; #define AVERAGE_OUT(pA) --(pA)->current; #define AVERAGE_MARK(pA) ++(pA)->count; (pA)->sum+=(pA)->current; #define AVERAGE_CLEAR(pA) (pA)->current=0; extern UINT cache_flips; extern UINT cache_adds; extern struct average new_avg; extern struct average old_avg; extern struct average store_avg; extern struct cache_stats cache_ext; extern struct cache_stats cache_int; extern struct cache_stats cache_dir; extern struct cache_stats cache_dev; extern struct cache_stats cache_pst; extern UINT read_calls; extern UINT read_cache; extern UINT read_cachebytes; extern UINT read_bytes; extern UINT read_array; extern UINT read_tries[3]; extern UINT read_success; extern struct average read_avg; extern UINT write_calls; extern UINT write_bytes; extern UINT write_array; extern UINT write_tries[3]; extern UINT write_success; extern struct average write_avg; extern struct directory dir_main; extern struct directory dir_dev; extern UINT dir_depth; extern struct average dir_avg; extern struct average all_avg; extern struct timeval max_delay; // ow_locks.c extern UINT total_bus_locks; // total number of locks extern UINT total_bus_unlocks; // total number of unlocks // ow_crc.c extern UINT CRC8_tries; extern UINT CRC8_errors; extern UINT CRC16_tries; extern UINT CRC16_errors; // ow_net.c extern UINT NET_accept_errors; extern UINT NET_connection_errors; extern UINT NET_read_errors; // ow_bus.c extern UINT BUS_readin_data_errors; extern UINT BUS_level_errors; extern UINT BUS_next_errors; extern UINT BUS_next_alarm_errors; extern UINT BUS_detect_errors; extern UINT BUS_bit_errors; extern UINT BUS_byte_errors; extern UINT BUS_echo_errors; extern UINT BUS_tcsetattr_errors; extern UINT BUS_status_errors; // ow_ds9097U.c extern UINT DS2480_read_fd_isset; extern UINT DS2480_read_null; extern UINT DS2480_read_read; extern UINT DS2480_level_docheck_errors; extern UINT DS2480_databit_errors; #define STAT_ADD1(x) STATLOCK ; ++x ; STATUNLOCK #endif /* OW_COUNTERS_H */ owfs-2.8p15/module/owlib/src/include/ow_2890.h0000664000175000017500000000104411310575610015703 00000000000000/* $Id: ow_2890.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2890_H #define OW_2890_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2890); #endif owfs-2.8p15/module/owlib/src/include/ow_lcd.h0000664000175000017500000000103611310575610016044 00000000000000/* $Id: ow_lcd.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_LCD_H #define OW_LCD_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(LCD); #endif owfs-2.8p15/module/owlib/src/include/ow_2404.h0000664000175000017500000000107211354511507015676 00000000000000/* $Id: ow_2404.h,v 1.6 2010/03/31 00:11:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2404_H #define OW_2404_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2404); #endif /* OW_2404_h */ owfs-2.8p15/module/owlib/src/include/compat_netdb.h0000664000175000017500000001426210750074145017245 00000000000000/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* All data returned by the network data base library are supplied in host order and returned in network order (suitable for use in system calls). */ #ifndef _COMPAT_NETDB_H #define _COMPAT_NETDB_H 1 #include #include "owfs_config.h" #ifdef HAVE_FEATURES_H #include #endif #ifndef __USE_GNU #define __USE_GNU #endif /* Doesn't exist for Solaris, make a test for it later */ /* #undef HAVE_SA_LEN */ #ifndef __HAS_IPV6__ #define __HAS_IPV6__ 0 #endif #ifndef __USE_POSIX #define __USE_POSIX #endif #ifndef __THROW #define __THROW #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifdef __USE_MISC /* This is necessary to make this include file properly replace the Sun version. */ # include #endif #ifdef HAVE_BITS_NETDB_H #include #endif /* Absolute file name for network data base files. */ #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" #ifndef __set_errno #define __set_errno(x) (errno = (x)) #endif #ifndef __set_h_errno #define __set_h_errno(x) (h_errno = (x)) #endif #ifndef HAVE_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif #ifndef HAVE_INET_PTON int inet_pton(int af, const char *src, void *dst); #endif #ifndef HAVE_GETADDRINFO /* Possible values left in `h_errno'. */ #define NETDB_INTERNAL -1 /* See errno. */ #define NETDB_SUCCESS 0 /* No problem. */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL. */ #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */ #define NO_DATA 4 /* Valid name, no data record of requested type. */ #define NO_ADDRESS NO_DATA /* No address, look for MX record. */ #ifdef __USE_XOPEN2K /* Highest reserved Internet port number. */ # define IPPORT_RESERVED 1024 #endif #ifdef __USE_GNU /* Scope delimiter for getaddrinfo(), getnameinfo(). */ # define SCOPE_DELIMITER '%' #endif /* Extension from POSIX.1g. */ #ifdef __USE_POSIX /* Structure to contain information about address of a service provider. */ struct addrinfo { int ai_flags; /* Input flags. */ int ai_family; /* Protocol family for socket. */ int ai_socktype; /* Socket type. */ int ai_protocol; /* Protocol for socket. */ socklen_t ai_addrlen; /* Length of socket address. */ struct sockaddr *ai_addr; /* Socket address for socket. */ char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; # ifdef __USE_GNU /* Lookup mode. */ # define GAI_WAIT 0 # define GAI_NOWAIT 1 # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ # define AI_CANONNAME 0x0002 /* Request for canonical name. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ /* Error values for `getaddrinfo' function. */ # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ # define EAI_NODATA -5 /* No address associated with NAME. */ # define EAI_FAMILY -6 /* `ai_family' not supported. */ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ # define EAI_MEMORY -10 /* Memory allocation failure. */ # define EAI_SYSTEM -11 /* System error returned in `errno'. */ # ifdef __USE_GNU # define EAI_INPROGRESS -100 /* Processing request in progress. */ # define EAI_CANCELED -101 /* Request canceled. */ # define EAI_NOTCANCELED -102 /* Request not canceled. */ # define EAI_ALLDONE -103 /* All requests done. */ # define EAI_INTR -104 /* Interrupted by a signal. */ # endif # define NI_MAXHOST 1025 # define NI_MAXSERV 32 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ # define NI_NOFQDN 4 /* Only return nodename portion. */ # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ /* Translate name of a service location and/or a service name to set of socket addresses. */ extern int getaddrinfo(__const char *__restrict __name, __const char *__restrict __service, __const struct addrinfo *__restrict __req, struct addrinfo **__restrict __pai) __THROW; /* Free `addrinfo' structure AI including associated storage. */ extern void freeaddrinfo(struct addrinfo *__ai) __THROW; /* Convert error return from getaddrinfo() to a string. */ extern const char *gai_strerror(int __ecode) __THROW; #endif /* HAVE_GETADDRINFO */ #endif /* POSIX */ #endif /* COMPAT_NETDB_H */ owfs-2.8p15/module/owlib/src/include/ow_busnumber.h0000664000175000017500000000654511363740313017320 00000000000000/* $Id: ow_busnumber.h,v 1.1 2010/04/22 03:21:47 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_BUSNUMBER_H /* tedious wrapper */ #define OW_BUSNUMBER_H typedef int INDEX_OR_ERROR ; #define INDEX_BAD -1 #define INDEX_DEFAULT 0 #define INDEX_VALID(bus_nr) ( (bus_nr) != INDEX_BAD ) #define INDEX_NOT_VALID(bus_nr) ( (bus_nr) == INDEX_BAD ) #endif /* OW_BUSNUMBER_H */ owfs-2.8p15/module/owlib/src/include/ow_none.h0000664000175000017500000000112411310575610016237 00000000000000/* $Id: ow_none.h,v 1.4 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_NONE_H #define OW_NONE_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Prototypes ----------- */ /* ------- Structures ----------- */ extern struct filetype NoDev[]; #endif owfs-2.8p15/module/owlib/src/include/ow_1993.h0000664000175000017500000000114611310575610015711 00000000000000/* $Id: ow_1993.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1993_H #define OW_1993_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1992); DeviceHeader(DS1993); DeviceHeader(DS1995); DeviceHeader(DS1996); #endif owfs-2.8p15/module/owlib/src/include/ow_device.h0000664000175000017500000000757711542515655016573 00000000000000/* $Id: ow_device.h,v 1.8 2011/03/24 01:17:33 alfille Exp $ OW -- One-Wire filesystem LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_DEVICE_H /* tedious wrapper */ #define OW_DEVICE_H /* Define our understanding of integers, floats, ... */ #include "ow_localtypes.h" #include "ow_parsedname.h" /* Several different structures: device -- one for each type of 1-wire device filetype -- one for each type of file parsedname -- translates a path into usable form */ /* --------------------------------------------------------- */ /* Predeclare struct filetype */ struct filetype; /* -------------------------------- */ /* Devices -- types of 1-wire chips */ /* device structure corresponds to 1-wire device also to virtual devices, like statistical groupings and interfaces (LINK, DS2408, ... ) devices have a list or properties that appear as files under the device directory, they correspond to device features (memory, name, temperature) and bound the allowable files in a device directory */ /* supports RESUME command */ #define DEV_resume 0x0001 /* can trigger an alarm */ #define DEV_alarm 0x0002 /* support OVERDRIVE */ #define DEV_ovdr 0x0004 /* responds to simultaneous temperature convert 0x44 */ #define DEV_temp 0x8000 /* responds to simultaneous voltage convert 0x3C */ #define DEV_volt 0x4000 /* supports CHAIN command */ #define DEV_chain 0x2000 #include "ow_generic_read.h" #include "ow_generic_write.h" struct device { const char *family_code; char *readable_name; uint32_t flags; int count_of_filetypes; struct filetype *filetype_array; struct generic_read * g_read ; struct generic_write * g_write ; }; #define DeviceHeader( chip ) extern struct device d_##chip /* Entries for struct device */ /* Cannot set the 3rd element (number of filetypes) at compile time because filetype arrays aren;t defined at this point */ #define COUNT_OF_FILETYPES(filetype_array) ((int)(sizeof(filetype_array)/sizeof(struct filetype))) #define DeviceEntryExtended( code , chip , flags, gread, gwrite ) struct device d_##chip = {#code,#chip,flags,COUNT_OF_FILETYPES(chip),chip,gread,gwrite} #define DeviceEntry( code , chip, gread, gwrite ) DeviceEntryExtended( code, chip, 0, gread, gwrite ) /* Device tree for matching names */ /* Bianry tree implementation */ /* A separate root for each device type: real, statistics, settings, system, structure */ extern void *Tree[ePN_max_type]; /* Bad bad C library */ /* implementation of tfind, tsearch returns an opaque structure */ /* you have to know that the first element is a pointer to your data */ struct device_opaque { struct device *key; void *other; }; /* Must be sorted for bsearch */ //extern struct device * Devices[] ; //extern size_t nDevices ; extern struct device UnknownDevice; extern struct device RemoteDevice; // returned from remote DIR listing. extern struct device *DeviceSimultaneous; extern struct device *DeviceThermostat; /* ---- end device --------------------- */ #endif /* OW_DEVICE_H */ owfs-2.8p15/module/owlib/src/include/ow_sibling.h0000664000175000017500000000515511405502352016735 00000000000000/* $Id: ow_sibling.h,v 1.3 2010/06/14 19:37:14 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 \ LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, // --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_SIBLING_H /* tedious wrapper */ #define OW_SIBLING_H ZERO_OR_ERROR FS_r_sibling_F(_FLOAT *F, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_r_sibling_U( UINT *U, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_r_sibling_Y( INT *Y, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_r_sibling_binary(char * data, size_t * size, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_sibling_binary(char * data, size_t size, off_t offset, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_sibling_bitwork(UINT set, UINT mask, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_sibling_F(_FLOAT F, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_sibling_U( UINT U, const char * sibling, struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_sibling_Y( INT Y, const char * sibling, struct one_wire_query *owq) ; void FS_del_sibling(const char * sibling, struct one_wire_query *owq) ; #endif /* OW_SIBLING_H */ owfs-2.8p15/module/owlib/src/include/ow_mutexes.h0000644000175000017500000002310511742172216016777 00000000000000/* $Id: ow_mutexes.h,v 1.25 2012/04/14 03:52:46 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h and only separated out for clarity */ #ifndef OW_MUTEXES_H /* tedious wrapper */ #define OW_MUTEXES_H #if OW_MT #include #define DEFAULT_THREAD_ATTR NULL #endif /* OW_MT */ extern struct mutexes { pthread_mutex_t stat_mutex; pthread_mutex_t controlflags_mutex; pthread_mutex_t fstat_mutex; pthread_mutex_t simul_mutex; pthread_mutex_t dir_mutex; pthread_mutex_t libusb_mutex; pthread_mutex_t typedir_mutex; pthread_mutex_t externaldir_mutex; pthread_mutex_t namefind_mutex; pthread_mutex_t aliasfind_mutex; pthread_mutex_t aliaslist_mutex; pthread_mutex_t externalcount_mutex; pthread_mutexattr_t mattr; // mutex attribute -- used for all mutexes my_rwlock_t lib; my_rwlock_t cache; my_rwlock_t persistent_cache; #ifdef __UCLIBC__ pthread_mutex_t uclibc_mutex; #endif /* __UCLIBC__ */ } Mutex; #if OW_MT #define _MUTEX_ATTR_INIT(at) my_pthread_mutexattr_init( &(at) ) #define _MUTEX_ATTR_SET(at,typ) my_pthread_mutexattr_settype( &(at) , typ ) #define _MUTEX_ATTR_DESTROY(at) my_pthread_mutexattr_destroy( &(at) ) #define _MUTEX_INIT(mut) my_pthread_mutex_init( &(mut) , &(Mutex.mattr) ) #define _MUTEX_DESTROY(mut) my_pthread_mutex_destroy( &(mut) ) #define _MUTEX_LOCK(mut) my_pthread_mutex_lock( &(mut) ) #define _MUTEX_UNLOCK(mut) my_pthread_mutex_unlock( &(mut) ) #define RWLOCK_INIT(rw) my_rwlock_init( &(rw) ) #define RWLOCK_DESTROY(rw) my_rwlock_destroy( &(rw) ) #define RWLOCK_WLOCK(mut) my_rwlock_write_lock( &(mut) ) #define RWLOCK_WUNLOCK(mut) my_rwlock_write_unlock( &(mut) ) #define RWLOCK_RLOCK(mut) my_rwlock_read_lock( &(mut) ) #define RWLOCK_RUNLOCK(mut) my_rwlock_read_unlock( &(mut) ) #define LIB_WLOCK RWLOCK_WLOCK( Mutex.lib ) #define LIB_WUNLOCK RWLOCK_WUNLOCK( Mutex.lib ) #define LIB_RLOCK RWLOCK_RLOCK( Mutex.lib ) #define LIB_RUNLOCK RWLOCK_RUNLOCK( Mutex.lib ) #define CACHE_WLOCK RWLOCK_WLOCK( Mutex.cache ) #define CACHE_WUNLOCK RWLOCK_WUNLOCK( Mutex.cache ) #define CACHE_RLOCK RWLOCK_RLOCK( Mutex.cache ) #define CACHE_RUNLOCK RWLOCK_RUNLOCK( Mutex.cache ) #define PERSISTENT_WLOCK RWLOCK_WLOCK( Mutex.persistent_cache ) #define PERSISTENT_WUNLOCK RWLOCK_WUNLOCK( Mutex.persistent_cache ) #define PERSISTENT_RLOCK RWLOCK_RLOCK( Mutex.persistent_cache ) #define PERSISTENT_RUNLOCK RWLOCK_RUNLOCK( Mutex.persistent_cache ) #define CONNIN_WLOCK RWLOCK_WLOCK( Inbound_Control.lock ) #define CONNIN_WUNLOCK RWLOCK_WUNLOCK( Inbound_Control.lock ) #define CONNIN_RLOCK RWLOCK_RLOCK( Inbound_Control.lock ) #define CONNIN_RUNLOCK RWLOCK_RUNLOCK( Inbound_Control.lock ) #define MONITOR_WLOCK RWLOCK_WLOCK( Inbound_Control.monitor_lock ) #define MONITOR_WUNLOCK RWLOCK_WUNLOCK( Inbound_Control.monitor_lock ) #define MONITOR_RLOCK RWLOCK_RLOCK( Inbound_Control.monitor_lock ) #define MONITOR_RUNLOCK RWLOCK_RUNLOCK( Inbound_Control.monitor_lock ) #define STATLOCK _MUTEX_LOCK( Mutex.stat_mutex ) #define STATUNLOCK _MUTEX_UNLOCK(Mutex.stat_mutex ) #define CONTROLFLAGSLOCK _MUTEX_LOCK( Mutex.controlflags_mutex ) #define CONTROLFLAGSUNLOCK _MUTEX_UNLOCK(Mutex.controlflags_mutex ) #define FSTATLOCK _MUTEX_LOCK( Mutex.fstat_mutex ) #define FSTATUNLOCK _MUTEX_UNLOCK(Mutex.fstat_mutex ) #define SIMULLOCK _MUTEX_LOCK( Mutex.simul_mutex ) #define SIMULUNLOCK _MUTEX_UNLOCK(Mutex.simul_mutex ) #define DIRLOCK _MUTEX_LOCK( Mutex.dir_mutex ) #define DIRUNLOCK _MUTEX_UNLOCK(Mutex.dir_mutex ) #define LIBUSBLOCK _MUTEX_LOCK( Mutex.libusb_mutex ) #define LIBUSBUNLOCK _MUTEX_UNLOCK(Mutex.libusb_mutex ) #define TYPEDIRLOCK _MUTEX_LOCK( Mutex.typedir_mutex) #define TYPEDIRUNLOCK _MUTEX_UNLOCK(Mutex.typedir_mutex) #define EXTERNALDIRLOCK _MUTEX_LOCK( Mutex.externaldir_mutex) #define EXTERNALDIRUNLOCK _MUTEX_UNLOCK(Mutex.externaldir_mutex) #define NAMEFINDLOCK _MUTEX_LOCK( Mutex.namefind_mutex) #define NAMEFINDUNLOCK _MUTEX_UNLOCK(Mutex.namefind_mutex) #define ALIASFINDLOCK _MUTEX_LOCK( Mutex.aliasfind_mutex) #define ALIASFINDUNLOCK _MUTEX_UNLOCK(Mutex.aliasfind_mutex) #define ALIASLISTLOCK _MUTEX_LOCK( Mutex.aliaslist_mutex) #define ALIASLISTUNLOCK _MUTEX_UNLOCK(Mutex.aliaslist_mutex) #define EXTERNALCOUNTLOCK _MUTEX_LOCK( Mutex.externalcount_mutex) #define EXTERNALCOUNTUNLOCK _MUTEX_UNLOCK(Mutex.externalcount_mutex) #define BUSLOCK(pn) BUS_lock(pn) #define BUSUNLOCK(pn) BUS_unlock(pn) #define BUSLOCKIN(in) BUS_lock_in(in) #define BUSUNLOCKIN(in) BUS_unlock_in(in) #ifdef __UCLIBC__ #define UCLIBCLOCK _MUTEX_LOCK( Mutex.uclibc_mutex) #define UCLIBCUNLOCK _MUTEX_UNLOCK(Mutex.uclibc_mutex) #else /* __UCLIBC__ */ #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #endif /* __UCLIBC__ */ #define DETACH_THREAD pthread_detach(pthread_self()) #else /* OW_MT */ #define _MUTEX_ATTR_DESTROY(at) return_ok() #define _MUTEX_INIT(mut) (void) mut #define _MUTEX_DESTROY(mut) (void) mut #define _MUTEX_LOCK(mut) return_ok() #define _MUTEX_UNLOCK(mut) return_ok() #define LIB_WLOCK return_ok() #define LIB_WUNLOCK return_ok() #define LIB_RLOCK return_ok() #define LIB_RUNLOCK return_ok() #define CACHE_WLOCK return_ok() #define CACHE_WUNLOCK return_ok() #define CACHE_RLOCK return_ok() #define CACHE_RUNLOCK return_ok() #define PERSISTENT_WLOCK return_ok() #define PERSISTENT_WUNLOCK return_ok() #define PERSISTENT_RLOCK return_ok() #define PERSISTENT_RUNLOCK return_ok() #define CONNIN_WLOCK return_ok() #define CONNIN_WUNLOCK return_ok() #define CONNIN_RLOCK return_ok() #define CONNIN_RUNLOCK return_ok() #define MONITOR_WLOCK return_ok() #define MONITOR_WUNLOCK return_ok() #define MONITOR_RLOCK return_ok() #define MONITOR_RUNLOCK return_ok() #define STATLOCK return_ok() #define STATUNLOCK return_ok() #define CONTROLFLAGSLOCK return_ok() #define CONTROLFLAGSUNLOCK return_ok() #define FSTATLOCK return_ok() #define FSTATUNLOCK return_ok() #define SIMULLOCK return_ok() #define SIMULUNLOCK return_ok() #define DIRLOCK return_ok() #define DIRUNLOCK return_ok() #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #define LIBUSBLOCK return_ok() #define LIBUSBUNLOCK return_ok() #define TYPEDIRLOCK return_ok() #define TYPEDIRUNLOCK return_ok() #define EXTERNALDIRLOCK return_ok() #define EXTERNALDIRUNLOCK return_ok() #define NAMEFINDLOCK return_ok() #define NAMEFINDUNLOCK return_ok() #define ALIASFINDLOCK return_ok() #define ALIASFINDUNLOCK return_ok() #define ALIASLISTLOCK return_ok() #define ALIASLISTUNLOCK return_ok() #define EXTERNALCOUNTLOCK return_ok() #define EXTERNALCOUNTUNLOCK return_ok() #define UCLIBCLOCK return_ok() #define UCLIBCUNLOCK return_ok() #define BUSLOCK(pn) return_ok() #define BUSUNLOCK(pn) return_ok() #define BUSLOCKIN(in) return_ok() #define BUSUNLOCKIN(in) return_ok() #define DETACH_THREAD do {} while(0) #endif /* OW_MT */ #endif /* OW_MUTEXES_H */ owfs-2.8p15/module/owlib/src/include/ow_settings.h0000644000175000017500000000123711654103312017140 00000000000000/* $Id: ow_settings.h,v 1.9 2011/11/01 23:54:50 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_SETTINGS_H #define OW_SETTINGS_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(set_timeout); DeviceHeader(set_units); DeviceHeader(set_alias); DeviceHeader(set_return_code); #endif /* OW_SETTINGS_H */ owfs-2.8p15/module/owlib/src/include/ow_2804.h0000664000175000017500000000104511310575610015677 00000000000000/* $Id: ow_2804.h,v 1.4 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2804_H #define OW_2804_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS28E04); #endif owfs-2.8p15/module/owlib/src/include/ow_1921.h0000664000175000017500000000104311310575610015674 00000000000000/* $Id: ow_1921.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1921_H #define OW_1921_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(DS1921); #endif owfs-2.8p15/module/owlib/src/include/ow_arg.h0000644000175000017500000000507711741156523016070 00000000000000/* $Id: ow_arg.h,v 1.7 2012/04/11 01:24:35 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 \ LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, // --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_ARG_H /* tedious wrapper */ #define OW_ARG_H GOOD_OR_BAD ARG_Net(const char *arg); GOOD_OR_BAD ARG_Server(const char *arg); GOOD_OR_BAD ARG_USB(const char *arg); GOOD_OR_BAD ARG_Device(const char *arg); GOOD_OR_BAD ARG_Generic(const char *arg); GOOD_OR_BAD ARG_Serial(const char *arg); GOOD_OR_BAD ARG_Parallel(const char *arg); GOOD_OR_BAD ARG_I2C(const char *arg); GOOD_OR_BAD ARG_HA5( const char *arg); GOOD_OR_BAD ARG_HA7(const char *arg); GOOD_OR_BAD ARG_HA7E(const char *arg); GOOD_OR_BAD ARG_ENET(const char *arg); GOOD_OR_BAD ARG_EtherWeather(const char *arg); GOOD_OR_BAD ARG_External(const char *arg); GOOD_OR_BAD ARG_Xport(const char *arg); GOOD_OR_BAD ARG_Fake(const char *arg); GOOD_OR_BAD ARG_Tester(const char *arg); GOOD_OR_BAD ARG_Mock(const char *arg); GOOD_OR_BAD ARG_Link(const char *arg); GOOD_OR_BAD ARG_W1_monitor(void); GOOD_OR_BAD ARG_USB_monitor(const char *arg); GOOD_OR_BAD ARG_Browse(void); GOOD_OR_BAD ARG_Passive(char *adapter_type_name, const char *arg); #endif /* OW_ARG_H */ owfs-2.8p15/module/owlib/src/include/ow_detect.h0000644000175000017500000000774611741156523016574 00000000000000/* $Id: ow_detect.h,v 1.9 2012/04/11 01:24:35 alfille Exp $ Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_DETECT_H /* tedious wrapper */ #define OW_DETECT_H GOOD_OR_BAD Server_detect(struct connection_in *in); GOOD_OR_BAD Zero_detect(struct connection_in *in); GOOD_OR_BAD DS2480_detect(struct connection_in *in); #if OW_PARPORT GOOD_OR_BAD DS1410_detect(struct connection_in *in); #endif /* OW_PARPORT */ GOOD_OR_BAD DS9097_detect(struct connection_in *in); GOOD_OR_BAD LINK_detect(struct connection_in *in); GOOD_OR_BAD HA7E_detect(struct connection_in *in); GOOD_OR_BAD OWServer_Enet_detect(struct connection_in *in); GOOD_OR_BAD HA5_detect(struct connection_in *in); GOOD_OR_BAD BadAdapter_detect(struct connection_in *in); GOOD_OR_BAD LINKE_detect(struct connection_in *in); GOOD_OR_BAD Fake_detect(struct connection_in *in); GOOD_OR_BAD Tester_detect(struct connection_in *in); GOOD_OR_BAD Mock_detect(struct connection_in *in); GOOD_OR_BAD EtherWeather_detect(struct connection_in *in); GOOD_OR_BAD Browse_detect(struct connection_in *in); GOOD_OR_BAD W1_monitor_detect(struct connection_in *in); GOOD_OR_BAD External_detect(struct connection_in *in); #if OW_HA7 GOOD_OR_BAD HA7_detect(struct connection_in *in); GOOD_OR_BAD FS_FindHA7(void); #endif /* OW_HA7 */ #if OW_W1 GOOD_OR_BAD W1_detect(struct connection_in * in) ; GOOD_OR_BAD W1_Browse( void ) ; #endif /* OW_W1 */ #if OW_I2C GOOD_OR_BAD DS2482_detect(struct connection_in *in); #endif /* OW_I2C */ #if OW_USB GOOD_OR_BAD DS9490_detect(struct connection_in *in); GOOD_OR_BAD USB_monitor_detect(struct connection_in *in) ; #endif /* OW_USB */ #endif /* OW_DETECT_H */ owfs-2.8p15/module/owlib/src/include/ow_connection_out.h0000664000175000017500000000361111441421241020324 00000000000000/* $Id: ow_connection_out.h,v 1.2 2010/09/07 11:31:45 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_CONNECTION_OUT_H /* tedious wrapper */ #define OW_CONNECTION_OUT_H /* Outbound connections (to web address or ownet client) */ /* Called in ow_connection.h */ /* Network connection structure */ struct connection_out { struct connection_out *next; void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor); char *name; char *host; char *service; int index; struct addrinfo *ai; struct addrinfo *ai_ok; FILE_DESCRIPTOR_OR_ERROR file_descriptor; struct { char *type; // for zeroconf char *domain; // for zeroconf char *name; // zeroconf name } zero ; pthread_t tid; #if OW_ZERO DNSServiceRef sref0; DNSServiceRef sref1; #endif }; extern struct outbound_control { int active ; // how many "bus" entries are currently in linked list int next_index ; // increasing sequence number struct connection_out * head ; // head of a linked list of "bus" entries } Outbound_Control ; // Single global struct -- see ow_connect.c #endif /* OW_CONNECTION_OUT_H */ owfs-2.8p15/module/owlib/src/include/ow_1821.h0000664000175000017500000000176511310575610015706 00000000000000/* $Id: ow_1821.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor LICENSE (As of version 2.5p4 2-Oct-2006) owlib: LGPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): LGPL v2 owperl: GPL v2 owtcl: GPL v2 or later at your discretion owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" */ #ifndef OW_1821_H #define OW_1821_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(DS1821); #endif /* OW_1821_h */ owfs-2.8p15/module/owlib/src/include/ow_channel.h0000644000175000017500000000245411707143413016717 00000000000000/* $Id: ow_channel.h,v 1.3 2012/01/23 02:33:47 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_CHANNEL_H /* tedious wrapper */ #define OW_CHANNEL_H /* included in ow_connection.h as the bus-master specific portion of the connection_in structure */ void OW_channel_init( struct connection_in * in ) ; void OW_channel_close( struct connection_in * in ) ; void OW_channel_lock( struct connection_in * in ) ; void OW_channel_unlock( struct connection_in * in ) ; #endif /* OW_CHANNEL_H */ owfs-2.8p15/module/owlib/src/include/ow_2436.h0000664000175000017500000000104411310575610015677 00000000000000/* $Id: ow_2436.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2436_H #define OW_2436_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2436); #endif owfs-2.8p15/module/owlib/src/include/ow_1977.h0000664000175000017500000000107211310575610015711 00000000000000/* $Id: ow_1977.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1977_H #define OW_1977_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1977); #endif /* OW_1977_H */ owfs-2.8p15/module/owlib/src/include/ow_1954.h0000664000175000017500000000104411310575610015703 00000000000000/* $Id: ow_1954.h,v 1.2 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1954_H #define OW_1954_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1954); #endif owfs-2.8p15/module/owlib/src/include/i2c-dev.h0000664000175000017500000002354410750074145016042 00000000000000/* i2c-dev.h - i2c-bus driver, char device interface Copyright (C) 1995-97 Simon G. Vogl Copyright (C) 1998-99 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id: i2c-dev.h,v 1.6 2008/01/30 13:15:17 d1mag Exp $ */ #ifndef LIB_I2CDEV_H #define LIB_I2CDEV_H #ifdef HAVE_LINUX_TYPES_H #include #else #ifndef __u8 typedef unsigned char __u8; #endif #ifndef __u16 typedef unsigned int __u16; #endif #ifndef __s32 typedef signed long __s32; #endif #endif #include /* -- i2c.h -- */ /* * I2C Message - used for pure i2c transaction, also from /dev interface */ struct i2c_msg { __u16 addr; /* slave address */ unsigned short flags; #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ #define I2C_M_RD 0x01 #define I2C_M_NOSTART 0x4000 #define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_IGNORE_NAK 0x1000 #define I2C_M_NO_RD_ACK 0x0800 short len; /* msg length */ char *buf; /* pointer to msg data */ }; /* To determine what functionality is present */ #define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_10BIT_ADDR 0x00000002 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ I2C_FUNC_SMBUS_WRITE_BYTE) #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ I2C_FUNC_SMBUS_WRITE_BYTE_DATA) #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ I2C_FUNC_SMBUS_WRITE_WORD_DATA) #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) /* * Data for SMBus Messages */ #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ #define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ union i2c_smbus_data { __u8 byte; __u16 word; __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ /* and one more for PEC */ }; /* smbus_access read or write markers */ #define I2C_SMBUS_READ 1 #define I2C_SMBUS_WRITE 0 /* SMBus transaction types (size parameter in the above functions) Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ #define I2C_SMBUS_QUICK 0 #define I2C_SMBUS_BYTE 1 #define I2C_SMBUS_BYTE_DATA 2 #define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_BLOCK_DATA 5 #define I2C_SMBUS_I2C_BLOCK_DATA 6 #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ /* ----- commands for the ioctl like i2c_command call: * note that additional calls are defined in the algorithm and hw * dependent layers - these can be listed here, or see the * corresponding header files. */ /* -> bit-adapter specific ioctls */ #define I2C_RETRIES 0x0701 /* number of times a device address */ /* should be polled when not */ /* acknowledging */ #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ /* this is for i2c-dev.c */ #define I2C_SLAVE 0x0703 /* Change slave address */ /* Attn.: Slave address is 7 or 10 bits */ #define I2C_SLAVE_FORCE 0x0706 /* Change slave address */ /* Attn.: Slave address is 7 or 10 bits */ /* This changes the address, even if it */ /* is already taken! */ #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ #define I2C_FUNCS 0x0705 /* Get the adapter functionality */ #define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only) */ #define I2C_PEC 0x0708 /* != 0 for SMBus PEC */ #define I2C_SMBUS 0x0720 /* SMBus-level access */ /* -- i2c.h -- */ /* Note: 10-bit addresses are NOT supported! */ /* This is the structure as used in the I2C_SMBUS ioctl call */ struct i2c_smbus_ioctl_data { char read_write; __u8 command; int size; union i2c_smbus_data *data; }; /* This is the structure as used in the I2C_RDWR ioctl call */ struct i2c_rdwr_ioctl_data { struct i2c_msg *msgs; /* pointers to i2c_msgs */ int nmsgs; /* number of i2c_msgs */ }; static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, int size, union i2c_smbus_data *data) { struct i2c_smbus_ioctl_data args; args.read_write = read_write; args.command = command; args.size = size; args.data = data; return ioctl(file, I2C_SMBUS, &args); } static inline __s32 i2c_smbus_write_quick(int file, __u8 value) { return i2c_smbus_access(file, value, 0, I2C_SMBUS_QUICK, NULL); } static inline __s32 i2c_smbus_read_byte(int file) { union i2c_smbus_data data; if (i2c_smbus_access(file, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) return -1; else return 0x0FF & data.byte; } static inline __s32 i2c_smbus_write_byte(int file, __u8 value) { return i2c_smbus_access(file, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); } static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command) { union i2c_smbus_data data; if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data)) return -1; else return 0x0FF & data.byte; } static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value) { union i2c_smbus_data data; data.byte = value; return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data); } static inline __s32 i2c_smbus_read_word_data(int file, __u8 command) { union i2c_smbus_data data; if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data)) return -1; else return 0x0FFFF & data.word; } static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value) { union i2c_smbus_data data; data.word = value; return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data); } static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value) { union i2c_smbus_data data; data.word = value; if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_PROC_CALL, &data)) return -1; else return 0x0FFFF & data.word; } /* Returns the number of read bytes */ static inline __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 * values) { union i2c_smbus_data data; int i; if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_BLOCK_DATA, &data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i - 1] = data.block[i]; return data.block[0]; } } static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, __u8 * values) { union i2c_smbus_data data; int i; if (length > 32) length = 32; for (i = 1; i <= length; i++) data.block[i] = values[i - 1]; data.block[0] = length; return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data); } /* Returns the number of read bytes */ static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 * values) { union i2c_smbus_data data; int i; if (i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i - 1] = data.block[i]; return data.block[0]; } } static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length, __u8 * values) { union i2c_smbus_data data; int i; if (length > 32) length = 32; for (i = 1; i <= length; i++) data.block[i] = values[i - 1]; data.block[0] = length; return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_I2C_BLOCK_DATA, &data); } /* Returns the number of read bytes */ static inline __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length, __u8 * values) { union i2c_smbus_data data; int i; if (length > 32) length = 32; for (i = 1; i <= length; i++) data.block[i] = values[i - 1]; data.block[0] = length; if (i2c_smbus_access(file, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_PROC_CALL, &data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i - 1] = data.block[i]; return data.block[0]; } } #endif /* LIB_I2CDEV_H */ owfs-2.8p15/module/owlib/src/include/ow_debug.h0000664000175000017500000002064211441421241016367 00000000000000/* $Id: ow_debug.h,v 1.30 2010/09/07 11:31:45 alfille Exp $ Debug and error messages Meant to be included in ow.h Separated just for readability */ /* OWFS source code 1-wire filesystem for linux {c} 2006 Paul H Alfille License GPL2.0 */ #ifndef OW_DEBUG_H #define OW_DEBUG_H #include #include "owfs_config.h" #ifdef HAVE_SYS_UIO_H #include #endif #include /* module/ownet/c/src/include/ow_debug.h & module/owlib/src/include/ow_debug.h are identical except this define */ //#define OWNETC_OW_DEBUG 1 /* error functions */ enum e_err_level { e_err_default, e_err_connect, e_err_call, e_err_data, e_err_detail, e_err_debug, e_err_beyond, }; enum e_err_type { e_err_type_level, e_err_type_error, }; enum e_err_print { e_err_print_mixed, e_err_print_syslog, e_err_print_console, }; void err_msg(enum e_err_type errnoflag, enum e_err_level level, const char * file, int line, const char * func, const char *fmt, ...); void _Debug_Bytes(const char *title, const unsigned char *buf, int length); void fatal_error(const char * file, int line, const char * func, const char *fmt, ...); static inline int return_ok(void) { return 0; } extern int log_available; #if OW_DEBUG #define LEVEL_DEFAULT(...) if (Globals.error_level>=e_err_default) {\ err_msg(e_err_type_level,e_err_default,__FILE__,__LINE__,__func__,__VA_ARGS__); } #define LEVEL_CONNECT(...) if (Globals.error_level>=e_err_connect) {\ err_msg(e_err_type_level,e_err_connect,__FILE__,__LINE__,__func__,__VA_ARGS__); } #define LEVEL_CALL(...) if (Globals.error_level>=e_err_call) {\ err_msg(e_err_type_level,e_err_call, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define LEVEL_DATA(...) if (Globals.error_level>=e_err_data) {\ err_msg(e_err_type_level,e_err_data, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define LEVEL_DETAIL(...) if (Globals.error_level>=e_err_detail) {\ err_msg(e_err_type_level,e_err_detail, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define LEVEL_DEBUG(...) if (Globals.error_level>=e_err_debug) {\ err_msg(e_err_type_level,e_err_debug, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_DEFAULT(...) if (Globals.error_level>=e_err_default) {\ err_msg(e_err_type_error,e_err_default,__FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_CONNECT(...) if (Globals.error_level>=e_err_connect) {\ err_msg(e_err_type_error,e_err_connect,__FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_CALL(...) if (Globals.error_level>=e_err_call) {\ err_msg(e_err_type_error,e_err_call, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_DATA(...) if (Globals.error_level>=e_err_data) {\ err_msg(e_err_type_error,e_err_data, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_DETAIL(...) if (Globals.error_level>=e_err_detail) {\ err_msg(e_err_type_error,e_err_detail, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define ERROR_DEBUG(...) if (Globals.error_level>=e_err_debug) {\ err_msg(e_err_type_error,e_err_debug, __FILE__,__LINE__,__func__,__VA_ARGS__); } #define FATAL_ERROR(...) fatal_error(__FILE__, __LINE__, __func__, __VA_ARGS__) #define Debug_OWQ(owq) if (Globals.error_level>=e_err_debug) { _print_owq(owq); } #define Debug_Bytes(title,buf,length) if (Globals.error_level>=e_err_beyond) { _Debug_Bytes(title,buf,length) ; } #else /* not OW_DEBUG */ #define LEVEL_DEFAULT(...) do { } while (0) #define LEVEL_CONNECT(...) do { } while (0) #define LEVEL_CALL(...) do { } while (0) #define LEVEL_DATA(...) do { } while (0) #define LEVEL_DETAIL(...) do { } while (0) #define LEVEL_DEBUG(...) do { } while (0) #define ERROR_DEFAULT(...) do { } while (0) #define ERROR_CONNECT(...) do { } while (0) #define ERROR_CALL(...) do { } while (0) #define ERROR_DATA(...) do { } while (0) #define ERROR_DETAIL(...) do { } while (0) #define ERROR_DEBUG(...) do { } while (0) #define FATAL_ERROR(...) do { } while (0) #define Debug_Bytes(title,buf,length) do { } while (0) #define Debug_OWQ(owq) do { } while (0) #endif /* OW_DEBUG */ /* Make sure strings are safe for printf */ #define SAFESTRING(x) ((x) ? (x):"") /* Easy way to show 64bit serial numbers */ #define SNformat "%.2X %.2X %.2X %.2X %.2X %.2X %.2X %.2X" #define SNvar(sn) (sn)[0],(sn)[1],(sn)[2],(sn)[3],(sn)[4],(sn)[5],(sn)[6],(sn)[7] #if OW_MT /* Need to define those functions to get FILE and LINE information */ extern const char mutex_init_failed[]; #define my_pthread_mutex_init(mutex, attr) do {\ int mrc = pthread_mutex_init(mutex, attr); \ if(mrc != 0) { FATAL_ERROR( mutex_init_failed, mrc, strerror(mrc)); }} while(0) extern const char mutex_destroy_failed[]; #define my_pthread_mutex_destroy(mutex) do {\ int mrc = pthread_mutex_destroy(mutex); \ if(mrc != 0) { FATAL_ERROR( mutex_destroy_failed, mrc, strerror(mrc)); }} while(0) extern const char mutex_lock_failed[]; #define my_pthread_mutex_lock(mutex) do {\ int mrc = pthread_mutex_lock(mutex); \ if(mrc != 0) { FATAL_ERROR( mutex_lock_failed, mrc, strerror(mrc)); }} while (0) extern const char mutex_unlock_failed[]; #define my_pthread_mutex_unlock(mutex) do {\ int mrc = pthread_mutex_unlock(mutex); \ if(mrc != 0) { FATAL_ERROR( mutex_unlock_failed, mrc, strerror(mrc)); }} while (0) extern const char mutexattr_init_failed[]; #define my_pthread_mutexattr_init(attr) do {\ int mrc = pthread_mutexattr_init(attr); \ if(mrc != 0) { FATAL_ERROR( mutexattr_init_failed, mrc, strerror(mrc)); }} while (0) extern const char mutexattr_destroy_failed[]; #define my_pthread_mutexattr_destroy(attr) do {\ int mrc = pthread_mutexattr_destroy(attr); \ if(mrc != 0) { FATAL_ERROR( mutexattr_destroy_failed, mrc, strerror(mrc)); }} while (0) extern const char mutexattr_settype_failed[]; #define my_pthread_mutexattr_settype(attr, typ) do {\ int mrc = pthread_mutexattr_settype(attr, typ); \ if(mrc != 0) { FATAL_ERROR( mutexattr_settype_failed, mrc, strerror(mrc)); }} while (0) extern const char cond_timedwait_failed[]; #define my_pthread_cond_timedwait(cond, mutex, abstime) do {\ int mrc = pthread_cond_timedwait(cond, mutex, abstime); \ if(mrc != 0) { FATAL_ERROR( cond_timedwait_failed, mrc, strerror(mrc)); }} while (0) extern const char cond_wait_failed[]; #define my_pthread_cond_wait(cond, mutex) do {\ int mrc = pthread_cond_wait(cond, mutex); \ if(mrc != 0) { FATAL_ERROR( cond_wait_failed, mrc, strerror(mrc)); }} while (0) extern const char cond_signal_failed[]; #define my_pthread_cond_signal(cond) do {\ int mrc = pthread_cond_signal(cond); \ if(mrc != 0) { FATAL_ERROR( cond_signal_failed, mrc, strerror(mrc)); }} while (0) extern const char cond_init_failed[]; #define my_pthread_cond_init(cond, attr) do {\ int mrc = pthread_cond_init(cond, attr); \ if(mrc != 0) { FATAL_ERROR( cond_init_failed, mrc, strerror(mrc)); }} while (0) extern const char cond_destroy_failed[]; #define my_pthread_cond_destroy(cond) do {\ int mrc = pthread_cond_destroy(cond); \ if(mrc != 0) { FATAL_ERROR( cond_destroy_failed, mrc, strerror(mrc)); }} while (0) //extern const char rwlock_init_failed[]; //extern const char rwlock_read_lock_failed[]; //extern const char rwlock_read_unlock_failed[]; #else /* not OW_MT */ #define my_pthread_mutex_init(mutex, attr) do {} while(0) #define my_pthread_mutex_destroy(mutex) do {} while(0) #define my_pthread_mutex_lock(mutex) do {} while (0) #define my_pthread_mutex_unlock(mutex) do {} while (0) #define my_pthread_mutexattr_init(attr) do {} while (0) #define my_pthread_mutexattr_destroy(attr) do {} while (0) #define my_pthread_mutexattr_settype(attr, typ) do {} while (0) #define my_pthread_cond_timedwait(cond, mutex, abstime) do {} while (0) #define my_pthread_cond_wait(cond, mutex) do {} while (0) #define my_pthread_cond_signal(cond) do {} while (0) #define my_pthread_cond_init(cond, attr) do {} while (0) #define my_pthread_cond_destroy(cond) do {} while (0) #endif /* OW_MT */ #endif /* OW_DEBUG_H */ owfs-2.8p15/module/owlib/src/include/ow_2408.h0000664000175000017500000000104411310575610015676 00000000000000/* $Id: ow_2408.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2408_H #define OW_2408_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2408); #endif owfs-2.8p15/module/owlib/src/include/ow_dirblob.h0000664000175000017500000000344411240676621016732 00000000000000/* $Id: ow_dirblob.h,v 1.9 2009/08/13 02:42:25 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #ifndef OW_DIRBLOB_H /* tedious wrapper */ #define OW_DIRBLOB_H struct dirblob { int troubled; int allocated; int devices; BYTE *snlist; }; void DirblobClear(struct dirblob *db); void DirblobInit(struct dirblob *db); int DirblobPure(const struct dirblob *db); void DirblobPoison(struct dirblob *db); int DirblobElements(const struct dirblob *db); int DirblobAdd(const BYTE * sn, struct dirblob *db); int DirblobGet(int dev, BYTE * sn, const struct dirblob *db); int DirblobSearch(BYTE * sn, const struct dirblob *db); int DirblobRecreate( BYTE * snlist, int size, struct dirblob *db); #endif /* OW_DIRBLOB_H */ owfs-2.8p15/module/owlib/src/include/ow_bitfield.h0000664000175000017500000000225311612066404017067 00000000000000/* $Id: ow_bitfield.h,v 1.1 2011/07/21 18:16:36 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille */ #ifndef OW_BITFIELD_H /* tedious wrapper */ #define OW_BITFIELD_H #include "ow_localreturns.h" // struct bitfield { "alias_link", number_of_bits, shift_left, } struct bitfield { ASCII * link ; // name of property unsigned int size ; // number of bits unsigned int shift ; // bits to shift over } ; ZERO_OR_ERROR FS_r_bitfield(struct one_wire_query *owq) ; ZERO_OR_ERROR FS_w_bitfield(struct one_wire_query *owq) ; #endif /* OW_BITFIELD_H */ owfs-2.8p15/module/owlib/src/include/ow_bae.h0000664000175000017500000000105311310575610016030 00000000000000/* $Id: ow_bae.h,v 1.2 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_BAE_H #define OW_BAE_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(BAE); #endif /* OW_BAE */ owfs-2.8p15/module/owlib/src/include/ow_connection_in.h0000644000175000017500000001254311741156523020140 00000000000000/* $Id: ow_connection_in.h,v 1.22 2012/04/11 01:24:35 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_CONNECTION_IN_H /* tedious wrapper */ #define OW_CONNECTION_IN_H /* struct connection_in (for each bus master) as part of ow_connection.h */ // For forward references struct connection_in; /* -------------------------------------------- */ /* bUS-MASTER-specific routines ---------------- */ #include "ow_master.h" #define CHANGED_USB_SPEED 0x001 #define CHANGED_USB_SLEW 0x002 #define CHANGED_USB_LOW 0x004 #define CHANGED_USB_OFFSET 0x008 //enum server_type { srv_unknown, srv_direct, srv_client, src_ /* Network connection structure */ enum bus_mode { bus_unknown = 0, bus_serial, bus_xport, bus_passive, bus_usb, bus_usb_monitor, bus_parallel, bus_server, bus_zero, bus_browse, bus_i2c, bus_ha7net, bus_ha5, bus_ha7e, bus_enet, bus_fake, bus_tester, bus_mock, bus_link, bus_etherweather, bus_bad, bus_w1, bus_w1_monitor, bus_xport_control, bus_external, }; enum adapter_type { adapter_DS9097 = 0, adapter_DS1410 = 1, adapter_DS9097U2 = 2, adapter_DS9097U = 3, adapter_LINK = 7, adapter_DS9490 = 8, adapter_tcp = 9, adapter_Bad = 10, adapter_LINK_10, adapter_LINK_11, adapter_LINK_12, adapter_LINK_13, adapter_LINK_14, adapter_LINK_other, adapter_LINK_E, adapter_DS2482_100, adapter_DS2482_800, adapter_HA7NET, adapter_HA5, adapter_HA7E, adapter_ENET, adapter_EtherWeather, adapter_fake, adapter_tester, adapter_mock, adapter_w1, adapter_w1_monitor, adapter_browse_monitor, adapter_xport, adapter_usb_monitor, adapter_external, }; enum e_reconnect { reconnect_bad = -1, reconnect_ok = 0, reconnect_error = 2, }; enum e_anydevices { anydevices_no = 0 , anydevices_yes , anydevices_unknown , }; enum e_bus_stat { e_bus_reconnects, e_bus_reconnect_errors, e_bus_locks, e_bus_unlocks, e_bus_errors, e_bus_resets, e_bus_reset_errors, e_bus_short_errors, e_bus_program_errors, e_bus_pullup_errors, e_bus_timeouts, e_bus_read_errors, e_bus_write_errors, e_bus_detect_errors, e_bus_open_errors, e_bus_close_errors, e_bus_search_errors1, e_bus_search_errors2, e_bus_search_errors3, e_bus_status_errors, e_bus_select_errors, e_bus_try_overdrive, e_bus_failed_overdrive, e_bus_stat_last_marker }; // Add serial/tcp/telnet abstraction #include "ow_communication.h" struct connection_in { struct connection_in *next; INDEX_OR_ERROR index; // char *name; // FILE_DESCRIPTOR_OR_PERSISTENT file_descriptor; // Serial / tcp / telnet / i2c abstraction struct communication soc ; // Com port data: // speed_t baud; // baud rate in the form of B9600 // struct termios oldSerialTio; /*old serial port settings */ // enum { flow_none, flow_soft, flow_hard, } flow_control ; // struct timeval timeout ; // for serial or tcp read pthread_mutex_t bus_mutex; pthread_mutex_t dev_mutex; void *dev_db; // dev-lock tree enum e_reconnect reconnect_state; struct timeval last_lock; /* statistics */ UINT bus_stat[e_bus_stat_last_marker]; struct timeval bus_time; enum bus_mode busmode; struct interface_routines iroutines; enum adapter_type Adapter; char *adapter_name; enum e_anydevices AnyDevices; int overdrive; int flex ; int changed_bus_settings; int ds2404_found; int ProgramAvailable; size_t last_root_devs; struct ds2409_hubs branch; // Branch currently selected size_t bundling_length; struct { // Channel info for bus masters that share a common comminucation channel */ char channel ; pthread_mutex_t all_channel_lock; // second level mutex for the entire chip */ struct connection_in *head; struct communication * psoc ; } channel_info ; union master_union master; }; #define SOC( connection ) ( &( (connection)->soc) ) #define NO_CONNECTION NULL /* Defines for flow control */ #define flow_first ( (Globals.serial_hardflow) ? flow_hard : flow_none ) #define flow_second ( (Globals.serial_hardflow) ? flow_none : flow_first ) extern struct inbound_control { int active ; // how many "bus" entries are currently in linked list int next_index ; // increasing sequence number struct connection_in * head ; // head of a linked list of "bus" entries my_rwlock_t monitor_lock; // allow monitor processes my_rwlock_t lock; // RW lock of linked list int next_fake ; // count of fake buses int next_tester ; // count tester buses int next_mock ; // count mock buses struct connection_in * w1_monitor ; struct connection_in * external ; } Inbound_Control ; // Single global struct -- see ow_connect.c // Channel-specific routines #include "ow_channel.h" #endif /* OW_CONNECTION_IN_H */ owfs-2.8p15/module/owlib/src/include/ow.h0000644000175000017500000002340711731463643015237 00000000000000/* $Id: ow.h,v 1.323 2012/03/12 22:18:30 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_H /* tedious wrapper */ #define OW_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif // Define this to avoid some VALGRIND warnings... (just for testing) // Warning: This will partially remove the multithreaded support since ow_net.c // will wait for a thread to complete before executing a new one. //#define VALGRIND 1 #define _FILE_OFFSET_BITS 64 #ifdef HAVE_FEATURES_H #include #endif /* HAVE_FEATURES_H */ #ifdef HAVE_FEATURE_TESTS_H #include #endif /* HAVE_FEATURE_TESTS_H */ #ifdef HAVE_SYS_TYPES_H #ifdef __FreeBSD__ #define __BSD_VISIBLE 1 #endif /* __FreeBSD__ */ #include /* for stat */ #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_TIMES_H #include /* for times */ #endif /* HAVE_SYS_TIMES_H */ #include #include #include #ifdef STRING_WITH_STRINGS # include # include /* for strcasecmp */ #else # ifdef HAVE_STRING_H # include # else # ifdef HAVE_STRINGS_H # include /* for strcasecmp */ # endif # endif #endif #include #include #ifdef HAVE_STDINT_H #include /* for bit twiddling */ #if OW_CYGWIN #define _MSL_STDINT_H #endif /* OW_CYGWIN */ #endif /* HAVE_STDINT_H */ #include #include #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif #ifndef __USE_XOPEN #define __USE_XOPEN /* for strptime fuction */ #include #undef __USE_XOPEN /* for strptime fuction */ #else /* __USE_XOPEN */ #include #endif /* __USE_XOPEN */ #ifdef HAVE_TERMIOS_H #include #endif /* HAVE_TERMIOS_H */ #include #ifdef HAVE_SYSLOG_H #include #endif /* HAVE_SYSLOG_H */ #ifdef HAVE_GETOPT_H #include /* for long options */ #endif /* HAVE_GETOPT_H */ #ifdef HAVE_SYS_UIO_H #include #endif /* Include gettimeofday and all the timerX macros */ #include "ow_timer.h" #define NOW_TIME time(NULL) #ifdef HAVE_SYS_STAT_H #include /* for stat */ #endif /* HAVE_SYS_STAT_H */ #ifdef HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif #ifdef HAVE_NETDB_H #include /* for getaddrinfo */ #endif /* HAVE_NETDB_H */ #ifdef HAVE_SYS_MKDEV_H #include /* for major() */ #endif /* HAVE_SYS_MKDEV_H */ #include // for offsetof() /* Can't include search.h when compiling owperl on Fedora Core 1. */ #ifndef SKIP_SEARCH_H #ifndef __USE_GNU #define __USE_GNU #include #undef __USE_GNU #else /* __USE_GNU */ #include #endif /* __USE_GNU */ #endif /* SKIP_SEARCH_H */ /* If no getline, use our version */ #ifndef HAVE_GETLINE ssize_t getline (char **lineptr, size_t *n, FILE *stream) ; #endif /* HAVE_GETLINE */ /* Parport enabled uses two flags (one a holdover from the embedded work) */ #ifdef USE_NO_PARPORT #undef OW_PARPORT #endif /* USE_NO_PARPORT */ /* Include some compatibility functions */ #include "compat.h" /* Debugging and error messages separated out for readability */ #include "ow_debug.h" #ifndef PATH_MAX #define PATH_MAX 2048 #endif /* Some errnos are not defined for MacOSX and gcc3.3 or openbsd */ #ifndef EBADMSG #define EBADMSG ENOMSG #endif /* EBADMSG */ #ifndef EPROTO #define EPROTO EIO #endif /* EPROTO */ #ifndef ENOTSUP #define ENOTSUP EOPNOTSUPP #endif /* ENOTSUP */ /* Bytes in a 1-wire address */ #define SERIAL_NUMBER_SIZE 8 /* Allocation wrappers for debugging */ #include "ow_alloc.h" /* BYTE manipulation macros */ #include "ow_bitwork.h" /* Define our understanding of integers, floats, ... */ #include "ow_localtypes.h" /* Define our understanding of bus numbers ... */ #include "ow_busnumber.h" /* Define our understanding of function returns ... */ #include "ow_localreturns.h" /* Define our understanding of file descriptors ... */ #include "ow_fd.h" /* Include sone byte conversion convenience routines */ #include "ow_integer.h" /* Directory blob separated out for readability */ #include "ow_dirblob.h" /* Directory blob (strings) separated out for readability */ #include "ow_charblob.h" /* memory blob used for bundled transactions */ #include "ow_memblob.h" /* We use our own read-write locks */ #include "rwlock.h" /* Many mutexes separated out for readability */ #include "ow_mutexes.h" #if OW_ZERO /* Zeroconf / Bonjour */ #include "ow_dl.h" #include "ow_dnssd.h" #if !OW_CYGWIN #include "ow_avahi.h" #endif /* OW_CYGWIN */ #endif /* OW_ZERO */ /* OW -- One Wire Globals variables -- each invokation will have it's own data */ /* command line options */ #include "ow_opt.h" /* Several different structures: device -- one for each type of 1-wire device filetype -- one for each type of file parsedname -- translates a path into usable form */ /* --------------------------------------------------------- */ /* Filetypes -- directory entries for each 1-wire chip found */ /* predeclare connection_in/out */ struct connection_in; struct connection_out; /* Maximum length of a file or directory name, and extension */ #define OW_NAME_MAX (32) #define OW_EXT_MAX (6) #define OW_FULLNAME_MAX (OW_NAME_MAX+OW_EXT_MAX) #define OW_DEFAULT_LENGTH (128) #include "ow_filetype.h" /* ------------------------------------------- */ /* -------------------------------- */ /* Devices -- types of 1-wire chips */ /* */ #include "ow_device.h" /* Parsedname -- path converted into components */ #include "ow_parsedname.h" /* "Object-type" structure for the anctual owfs query -- holds name, flags, values, and path */ #include "ow_onewirequery.h" /* Delay for clearing buffer */ #define WASTE_TIME (2) /* device display format */ enum deviceformat { fdi, fi, fdidc, fdic, fidc, fic }; /* OWSERVER messages */ #include "ow_message.h" /* Globals information (for local control) */ /* Separated out into ow_global.h for readability */ #include "ow_global.h" /* State information for the program */ /* Separated out into ow_stateinfo.h for readability */ #include "ow_stateinfo.h" /* -------------------------------------------- */ /* Prototypes */ /* Separated out to ow_functions.h for clarity */ #include "ow_arg.h" #include "ow_functions.h" /* Temerature scale handling */ #include "ow_temperature.h" /* Pressure scale handling */ #include "ow_pressure.h" /* Program control */ #include "ow_programs.h" /* Return and error codes */ #include "ow_return_code.h" #endif /* OW_H */ owfs-2.8p15/module/owlib/src/include/w1_netlink.h0000644000175000017500000000355411664034371016663 00000000000000/* $Id: w1_netlink.h,v 1.6 2011/11/26 00:55:21 alfille Exp $ Much thanks to Evgeniy Polyakov This file itself is a snapshop version of netlink.h by Evgeniy Polyakov */ /* * w1_netlink.h * * Copyright (c) 2003 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __W1_NETLINK_H #define __W1_NETLINK_H //#include #ifndef CN_W1_IDX #define CN_W1_IDX 4 #define CN_W1_VAL 1 #endif #pragma pack(push) /* push current alignment to stack */ #pragma pack(1) /* set alignment to 1 byte boundary */ enum w1_netlink_message_types { W1_SLAVE_ADD = 0, W1_SLAVE_REMOVE, W1_MASTER_ADD, W1_MASTER_REMOVE, W1_MASTER_CMD, W1_SLAVE_CMD, W1_LIST_MASTERS, }; struct w1_netlink_msg { __u8 type; __u8 status; __u16 len; union { __u8 id[8]; struct w1_mst { __u32 id; __u32 res; } mst; } id; __u8 data[0]; }; enum w1_commands { W1_CMD_READ = 0 , W1_CMD_WRITE , W1_CMD_SEARCH, W1_CMD_ALARM_SEARCH, W1_CMD_TOUCH, W1_CMD_RESET, W1_CMD_MAX, } ; struct w1_netlink_cmd { __u8 cmd; __u8 res; __u16 len; __u8 data[0]; }; #pragma pack(pop) /* restore original alignment from stack */ #endif /* __W1_NETLINK_H */ owfs-2.8p15/module/owlib/src/include/ow_alloc.h0000644000175000017500000000541111756247317016411 00000000000000/* $Id: ow_alloc.h,v 1.8 2012/05/20 20:06:39 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. --------------------------------------------------------------------------- */ // Define for full memmory allocation debugging // #define OW_ALLOC_DEBUG #ifndef OW_ALLOC_H /* tedious wrapper */ #define OW_ALLOC_H #if OW_ALLOC_DEBUG // Special wrapper functions to check memory allocation #define owmalloc(size) OWmalloc( __FILE__, __LINE__, __func__, size ) #define owcalloc(nmemb,size) OWcalloc( __FILE__, __LINE__, __func__, nmemb, size ) #define owfree(ptr) OWfree( __FILE__, __LINE__, __func__, ptr ) #define owrealloc(ptr,size) OWrealloc(__FILE__, __LINE__, __func__, ptr, size ) #define owstrdup(s) OWstrdup( __FILE__, __LINE__, __func__, s ) #define owfree_func OWtreefree void *OWcalloc( const char * file, int line, const char * func, size_t nmemb, size_t size ); void *OWmalloc( const char * file, int line, const char * func, size_t size); void OWfree( const char * file, int line, const char * func, void *ptr); void *OWrealloc(const char * file, int line, const char * func, void *ptr, size_t size); char *OWstrdup( const char * file, int line, const char * func, const char *s); void OWtreefree(void *ptr); #else /* OW_ALLOC_DEBUG */ // Standard C library definitions #define owmalloc(size) malloc(size) #define owcalloc(nmemb,size) calloc(nmemb,size) #define owfree(ptr) free(ptr) #define owrealloc(ptr,size) realloc(ptr,size) #define owstrdup(s) strdup(s) #define owfree_func free #endif /* OW_ALLOC_DEBUG */ #define SAFEFREE(p) do { if ( (p)!= NULL ) { owfree(p) ; p=NULL; } } while (0) #define SAFETDESTROY(p,f) do { if ( (p)!=NULL ) { tdestroy(p,f) ; p=NULL; } } while (0) #endif /* OW_ALLOC_H */ owfs-2.8p15/module/owlib/src/include/ow_message.h0000644000175000017500000000502611674132256016737 00000000000000/* $Id: ow_message.h,v 1.14 2011/12/20 16:15:42 alfille Exp $ Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* definitions and stuctures for the owserver messages */ /* This file doesn't stand alone, it must be included in ow.h */ #ifndef OW_MESSAGE_H /* tedious wrapper */ #define OW_MESSAGE_H /* Unique token for owserver loop checks */ union antiloop { struct { pid_t pid; clock_t clock; } simple; BYTE uuid[16]; }; /* Server (Socket-based) interface */ enum msg_classification { msg_error, msg_nop, msg_read, msg_write, msg_dir, msg_size, // No longer used, leave here for compatibility msg_presence, msg_dirall, msg_get, msg_dirallslash, msg_getslash, }; /* message to owserver */ struct server_msg { int32_t version; int32_t payload; int32_t type; int32_t control_flags; int32_t size; int32_t offset; }; /* message to client */ struct client_msg { int32_t version; int32_t payload; int32_t ret; int32_t control_flags; int32_t size; int32_t offset; }; union address { struct sockaddr sock; char text[120]; }; struct serverpackage { const ASCII *path; BYTE *data; size_t datasize; BYTE *tokenstring; size_t tokens; }; // Current version of the protocol #define OWSERVER_PROTOCOL_VERSION 0 // lower 16 bits is token size (only FROM owserver of course) #define Servertokens(tokens) ((tokens)&0xFFFF) #define MakeServertokens(tokens) (tokens) // bit 17 is FROM server flag #define ServermessageMASK (((int32_t)1)<<16) #define MakeServermessage ServermessageMASK #define isServermessage(version) (((version) & ServermessageMASK) == ServermessageMASK) //owserver protocol #define ServerprotocolMASK ((0xFF)<<17) #define Serverprotocol(version) (((version) & ServerprotocolMASK) >> 17 ) #define MakeServerprotocol(protocol) ((protocol) << 17) #endif /* OW_MESSAGE_H */ owfs-2.8p15/module/owlib/src/include/ow_cache.h0000664000175000017500000001312411547741164016361 00000000000000/* $Id: ow_cache.h,v 1.41 2011/04/09 02:20:36 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OWCACHE_H /* tedious wrapper */ #define OWCACHE_H /* Internal properties -- used by some devices */ /* in passing to store state information */ struct internal_prop { char *name; enum fc_change change; }; enum simul_type { simul_temp, simul_volt, simul_end }; #if OW_CACHE #define Make_SlaveSpecificTag(tag,change) static char ip_name_##tag[] = #tag ; static struct internal_prop ip_##tag = { ip_name_##tag , change } #define SlaveSpecificTag(tag) (& ip_##tag) extern struct internal_prop ipSimul[] ; /* Cache and Storage functions */ void Cache_Open(void); void Cache_Close(void); void Cache_Clear(void); GOOD_OR_BAD OWQ_Cache_Add(const struct one_wire_query *owq); GOOD_OR_BAD Cache_Add_Dir(const struct dirblob *db, const struct parsedname *pn); GOOD_OR_BAD Cache_Add_Device(const int bus_nr, const BYTE *sn); GOOD_OR_BAD Cache_Add_SlaveSpecific(const void *data, const size_t datasize, const struct internal_prop *ip, const struct parsedname *pn); GOOD_OR_BAD Cache_Add_Alias(const ASCII *name, const BYTE * sn) ; GOOD_OR_BAD Cache_Add_Simul(const enum simul_type type, const struct parsedname *pn); void Cache_Add_Alias_Bus(const ASCII * alias_name, INDEX_OR_ERROR bus); GOOD_OR_BAD OWQ_Cache_Get(struct one_wire_query *owq); GOOD_OR_BAD Cache_Get(void *data, size_t * dsize, const struct parsedname *pn); GOOD_OR_BAD Cache_Get_Dir(struct dirblob *db, const struct parsedname *pn); GOOD_OR_BAD Cache_Get_Device(void *bus_nr, const struct parsedname *pn); GOOD_OR_BAD Cache_Get_SlaveSpecific(void *data, size_t dsize, const struct internal_prop *ip, const struct parsedname *pn); ASCII * Cache_Get_Alias(const BYTE * sn) ; GOOD_OR_BAD Cache_Get_Simul_Time(enum simul_type type, time_t * dwell_time, const struct parsedname * pn); INDEX_OR_ERROR Cache_Get_Alias_Bus(const ASCII * alias_name) ; GOOD_OR_BAD Cache_Get_Alias_SN(const ASCII * alias_name, BYTE * sn ); void OWQ_Cache_Del(struct one_wire_query *owq); void OWQ_Cache_Del_ALL(struct one_wire_query *owq); void OWQ_Cache_Del_BYTE(struct one_wire_query *owq); void OWQ_Cache_Del_parts(struct one_wire_query *owq); void Cache_Del_Dir(const struct parsedname *pn); void Cache_Del_Device(const struct parsedname *pn); void Cache_Del_Internal(const struct internal_prop *ip, const struct parsedname *pn); void Cache_Del_Simul(enum simul_type type, const struct parsedname *pn) ; void Cache_Del_Mixed_Aggregate(const struct parsedname *pn); void Cache_Del_Mixed_Individual(const struct parsedname *pn); void Cache_Del_Alias_Bus(const ASCII * alias_name); void Cache_Del_Alias(const BYTE * sn); void Aliaslist( struct memblob * mb ) ; #else /* OW_CACHE */ #define Make_SlaveSpecificTag(tag, change) #define SlaveSpecificTag(tag) NULL #define Cache_Open( void ) #define Cache_Close( void ) #define Cache_Clear( void ) #define Cache_Add_Dir(db,pn ) (gbBAD) #define Cache_Add_Device(bus_nr,sn ) (gbBAD) #define Cache_Add_SlaveSpecific(data,datasize,ip,pn ) (gbBAD) #define OWQ_Cache_Add( owq ) (gbBAD) #define Cache_Add_Alias(name, sn) (gbBAD) #define Cache_Add_Simul(type,pn) (gbBAD) #define Cache_Add_Alias_Bus(name,bus) (1) #define Cache_Get(data,dsize,pn ) (gbBAD) #define Cache_Get_Dir(db,pn ) (gbBAD) #define OWQ_Cache_Get( owq ) (gbBAD) #define Cache_Get_Device(bus_nr,pn ) (gbBAD) #define Cache_Get_SlaveSpecific(data,dsize,ip,pn ) (gbBAD) #define Cache_Get_Alias(sn) (gbBAD) #define Cache_Get_SerialNumber(name, sn) (gbBAD) #define Cache_Get_Simul_Time(type,time,pn) (1) #define Cache_Get_Alias_Bus(name) (INDEX_BAD) #define Cache_Get_Alias_SN(name,sn) (gbBAD) #define Cache_Del(pn ) (1) #define Cache_Del_Dir(pn ) (1) #define Cache_Del_Device(pn ) (1) #define Cache_Del_Internal(ip,pn ) (1) #define OWQ_Cache_Del( owq ) (1) #define OWQ_Cache_Del_ALL( owq) (1) #define OWQ_Cache_Del_BYTE( owq) (1) #define OWQ_Cache_Del_parts( owq) (1) #define Cache_Del_Simul(type,pn) (1) #define Cache_Del_Mixed_Aggregate(pn) (1) #define Cache_Del_Mixed_Individual(pn) (1) #define Cache_Del_Alias_Bus(name) (1) #define Cache_Del_Alias(sn) (1) #define Cache_Del_Alias(sn) (1) #define Aliaslist(mb) #endif /* OW_CACHE */ #endif /* OWCACHE_H */ owfs-2.8p15/module/owlib/src/include/ow_eeef.h0000664000175000017500000000200111310575610016177 00000000000000/* $Id: ow_eeef.h,v 1.2 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor LICENSE (As of version 2.5p4 2-Oct-2006) owlib: LGPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): LGPL v2 owperl: GPL v2 owtcl: GPL v2 or later at your discretion owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" */ #ifndef OW_EEEF_H #define OW_EEEF_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(HobbyBoards_EE); DeviceHeader(HobbyBoards_EF); #endif owfs-2.8p15/module/owlib/src/include/Makefile.in0000664000175000017500000004504411756250027016506 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owlib/src/include DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = \ compat_getopt.h \ compat.h \ i2c-dev.h \ compat_netdb.h \ connector.h \ ow.h \ ow_1820.h \ ow_1821.h \ ow_1921.h \ ow_1923.h \ ow_1954.h \ ow_1963.h \ ow_1977.h \ ow_1991.h \ ow_1993.h \ ow_2401.h \ ow_2404.h \ ow_2405.h \ ow_2406.h \ ow_2408.h \ ow_2409.h \ ow_2413.h \ ow_2415.h \ ow_2423.h \ ow_2430.h \ ow_2433.h \ ow_2436.h \ ow_2438.h \ ow_2450.h \ ow_2502.h \ ow_2505.h \ ow_2760.h \ ow_2804.h \ ow_2890.h \ ow_alloc.h \ ow_arg.h \ ow_avahi.h \ ow_bae.h \ ow_bitfield.h \ ow_bitwork.h \ ow_busnumber.h \ ow_bus_routines.h \ ow_cache.h \ ow_channel.h \ ow_charblob.h \ ow_codes.h \ ow_communication.h \ ow_connection.h \ ow_connection_in.h \ ow_connection_out.h\ ow_counters.h \ ow_debug.h \ ow_detect.h \ ow_device.h \ ow_devices.h \ ow_dirblob.h \ ow_dl.h \ ow_dnssd.h \ ow_eds.h \ ow_eeef.h \ ow_example_slave.h \ ow_external.h \ ow_fd.h \ ow_filetype.h \ ow_functions.h \ ow_generic_read.h \ ow_generic_write.h \ ow_global.h \ ow_integer.h \ ow_interface.h \ ow_localtypes.h \ ow_localreturns.h \ ow_lcd.h \ ow_master.h \ ow_memblob.h \ ow_message.h \ ow_mutexes.h \ ow_none.h \ ow_onewirequery.h \ ow_opt.h \ ow_parse_address.h \ ow_parsedname.h \ ow_parse_sn.h \ ow_pid.h \ ow_pressure.h \ ow_programs.h \ ow_reset.h \ ow_return_code.h \ ow_settings.h \ ow_search.h \ ow_sibling.h \ ow_simultaneous.h \ ow_standard.h \ ow_stateinfo.h \ ow_stats.h \ ow_stub.h \ ow_system.h \ ow_temperature.h \ ow_thermocouple.h \ ow_timer.h \ ow_traffic.h \ ow_transaction.h \ ow_usb_cycle.h \ ow_usb_msg.h \ ow_visibility.h \ ow_w1.h \ ow_w1_seq.h \ rwlock.h \ netlink.h \ w1_netlink.h \ sem.h \ telnet.h 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 module/owlib/src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owlib/src/include/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): 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 $(HEADERS) 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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 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 -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: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean 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-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owlib/src/include/ow_avahi.h0000664000175000017500000002417111427405365016407 00000000000000/* $Id: ow_avahi.h,v 1.6 2010/08/08 01:40:05 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ // Some of this code taken from the Avahi project (legally) // The following header is in those header files: /*** This file is part of avahi. avahi 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. avahi 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 avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ // Note that although these headers are LGPL v2.1+, the rest of OWFS is GPL v2 #ifndef OW_AVAHI_H #define OW_AVAHI_H #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #if defined(__GNUC__) && (__GNUC__ >= 4) #define AVAHI_GCC_SENTINEL __attribute__ ((sentinel)) #else /** Macro for usage of GCC's sentinel compilation warnings */ #define AVAHI_GCC_SENTINEL #endif #ifdef __GNUC__ #define AVAHI_GCC_UNUSED __attribute__ ((unused)) #else /** Macro for not used parameter */ #define AVAHI_GCC_UNUSED #endif typedef enum { EnumDummy, } Enum ; struct AvahiClient ; typedef struct AvahiClient AvahiClient; /** States of a server object */ typedef enum { AVAHI_SERVER_INVALID, AVAHI_SERVER_REGISTERING, AVAHI_SERVER_RUNNING, AVAHI_SERVER_COLLISION, AVAHI_SERVER_FAILURE } AvahiServerState; /** States of an entry group object */ typedef enum { AVAHI_ENTRY_GROUP_UNCOMMITED, AVAHI_ENTRY_GROUP_REGISTERING, AVAHI_ENTRY_GROUP_ESTABLISHED, AVAHI_ENTRY_GROUP_COLLISION, AVAHI_ENTRY_GROUP_FAILURE } AvahiEntryGroupState; /** States of a client object, a superset of AvahiServerState */ typedef enum { AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, AVAHI_CLIENT_FAILURE = 100, AVAHI_CLIENT_CONNECTING = 101 } AvahiClientState; typedef enum { AVAHI_PUBLISH_UNIQUE = 1, AVAHI_PUBLISH_NO_PROBE = 2, AVAHI_PUBLISH_NO_ANNOUNCE = 4, AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /** \cond fulldocs */ AVAHI_PUBLISH_NO_REVERSE = 16, AVAHI_PUBLISH_NO_COOKIE = 32, /** \endcond */ AVAHI_PUBLISH_UPDATE = 64, /** \cond fulldocs */ AVAHI_PUBLISH_USE_WIDE_AREA = 128, AVAHI_PUBLISH_USE_MULTICAST = 256 /** \endcond */ } AvahiPublishFlags; typedef enum { AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, AVAHI_CLIENT_NO_FAIL = 2 } AvahiClientFlags; /** An I/O watch object */ typedef struct AvahiWatch AvahiWatch; /** The function prototype for the callback of an AvahiClient */ typedef void (*AvahiClientCallback) ( AvahiClient *s, AvahiClientState state /**< The new state of the client */, void* userdata /**< The user data that was passed to avahi_client_new() */ ); /** Called when the timeout is reached */ typedef void (*AvahiTimeoutCallback)(void *, void *); /** Called whenever an I/O event happens on an I/O watch */ typedef void (*AvahiWatchCallback)(void *, int, Enum, void *); typedef struct { void* userdata; void* (*watch_new)(const void *, int, Enum, AvahiWatchCallback, void *); void (*watch_update)(void *, Enum); Enum (*watch_get_events)(void *); void (*watch_free)(void *); void* (*timeout_new)(const void *, const struct timeval *, AvahiTimeoutCallback callback, void *); void (*timeout_update)(void *, const struct timeval *tv); void (*timeout_free)(void *t); } AvahiPoll; /** Creates a new client instance */ AvahiClient* (*avahi_client_new) ( const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback, void *userdata, int *error ); void (*avahi_client_free)(AvahiClient *client); int (*avahi_client_errno) (AvahiClient*); typedef struct AvahiEntryGroup AvahiEntryGroup; typedef void (*AvahiEntryGroupCallback) ( AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata ); struct AvahiEntryGroup { char *path; AvahiEntryGroupState state; int state_valid; AvahiClient *client; AvahiEntryGroupCallback callback; void *userdata; AvahiEntryGroup* groups; }; AvahiEntryGroup* (*avahi_entry_group_new) ( AvahiClient* c, AvahiEntryGroupCallback callback, void *userdata ); int (*avahi_entry_group_commit) (AvahiEntryGroup*); int (*avahi_entry_group_reset) (AvahiEntryGroup*); int (*avahi_entry_group_is_empty) (AvahiEntryGroup*); typedef enum { AVAHI_PROTO_INET = 0, /**< IPv4 */ AVAHI_PROTO_INET6 = 1, /**< IPv6 */ AVAHI_PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */ } AvahiProtocol; typedef enum { AVAHI_IF_UNSPEC = -1 /**< Unspecified/all interface(s) */ } AvahiIfIndex; int (*avahi_entry_group_add_service)( AvahiEntryGroup *group, AvahiIfIndex interface, AvahiProtocol protocol, AvahiPublishFlags flag, const char *name, const char *type, const char *domain, const char *host, uint16_t port, ... ) AVAHI_GCC_SENTINEL; typedef struct AvahiSimplePoll AvahiSimplePoll; typedef int (*AvahiPollFunc)(void *, unsigned int, int, void *); struct AvahiSimplePoll { AvahiPoll api; AvahiPollFunc poll_func; void *poll_func_userdata; struct pollfd* pollfds; int n_pollfds, max_pollfds, rebuild_pollfds; int watch_req_cleanup, timeout_req_cleanup; int quit; int events_valid; int n_watches; AvahiWatch* watches; void* timeouts; int wakeup_pipe[2]; int wakeup_issued; int prepared_timeout; enum { STATE_INIT, STATE_PREPARING, STATE_PREPARED, STATE_RUNNING, STATE_RAN, STATE_DISPATCHING, STATE_DISPATCHED, STATE_QUIT, STATE_FAILURE } state; }; /** Create a new main loop object */ AvahiSimplePoll *(*avahi_simple_poll_new)(void); /** Free a main loop object */ void (*avahi_simple_poll_free)(AvahiSimplePoll *s); const AvahiPoll* (*avahi_simple_poll_get)(AvahiSimplePoll *s); void (*avahi_simple_poll_quit)(AvahiSimplePoll *s); int (*avahi_simple_poll_loop)(AvahiSimplePoll *s); const char *(*avahi_strerror)(int error); struct AvahiClient { const AvahiPoll *poll_api; void * poll; //DBusConnection *bus; int error; AvahiClientState state; AvahiClientFlags flags; /* Cache for some seldom changing server data */ char *version_string, *host_name, *host_name_fqdn, *domain_name; uint32_t local_service_cookie; int local_service_cookie_valid; AvahiClientCallback callback; void *userdata; AvahiEntryGroup * groups; void * domain_browsers; void * service_browsers; void * service_type_browsers; void * service_resolvers; void * host_name_resolvers; void * address_resolvers; void * record_browsers; }; const char * (* avahi_client_get_domain_name)( AvahiClient *) ; /* Browsing-specific */ typedef enum { AVAHI_BROWSER_NEW, AVAHI_BROWSER_REMOVE, AVAHI_BROWSER_CACHE_EXHAUSTED, AVAHI_BROWSER_ALL_FOR_NOW, AVAHI_BROWSER_FAILURE } AvahiBrowserEvent; /** Type of callback event when resolving */ typedef enum { AVAHI_RESOLVER_FOUND, AVAHI_RESOLVER_FAILURE } AvahiResolverEvent; typedef enum { AVAHI_LOOKUP_RESULT_CACHED = 1, AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, AVAHI_LOOKUP_RESULT_MULTICAST = 4, AVAHI_LOOKUP_RESULT_LOCAL = 8, AVAHI_LOOKUP_RESULT_OUR_OWN = 16, AVAHI_LOOKUP_RESULT_STATIC = 32 } AvahiLookupResultFlags; struct AvahiServiceBrowser ; typedef struct AvahiServiceBrowser AvahiServiceBrowser; typedef void (*AvahiServiceBrowserCallback) ( AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void *userdata); struct AvahiServiceBrowser { char *path; AvahiClient *client; AvahiServiceBrowserCallback callback; void *userdata; AvahiServiceBrowser *service_browsers_next; AvahiServiceBrowser *service_browsers_prev ; char *type, *domain; AvahiIfIndex interface; AvahiProtocol protocol; }; typedef struct AvahiServiceResolver AvahiServiceResolver; /** An IPv4 address */ typedef struct AvahiIPv4Address { uint32_t address; /**< Address data in network byte order. */ } AvahiIPv4Address; /** An IPv6 address */ typedef struct AvahiIPv6Address { uint8_t address[16]; /**< Address data */ } AvahiIPv6Address; /** Protocol (address family) independent address structure */ typedef struct AvahiAddress { AvahiProtocol proto; /**< Address family */ union { AvahiIPv6Address ipv6; /**< Address when IPv6 */ AvahiIPv4Address ipv4; /**< Address when IPv4 */ uint8_t data[1]; /**< Type-independent data field */ } data; } AvahiAddress; AvahiServiceBrowser* (*avahi_service_browser_new) ( AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *type, const char *domain, int flags, AvahiServiceBrowserCallback callback, void *userdata); /** Cleans up and frees an AvahiServiceBrowser object */ int (*avahi_service_browser_free) (AvahiServiceBrowser *); int (*avahi_service_resolver_free)(AvahiServiceResolver *r); typedef void (*AvahiServiceResolverCallback) ( AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *a, uint16_t port, void *txt, AvahiLookupResultFlags flags, void *userdata); AvahiServiceResolver * (*avahi_service_resolver_new)( AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiProtocol aprotocol, AvahiLookupResultFlags flags, AvahiServiceResolverCallback callback, void *userdata); /**********************************************/ /* Prototypes */ struct connection_out ; GOOD_OR_BAD OW_Load_avahi_library(void) ; void OW_Free_avahi_library(void) ; void *OW_Avahi_Announce( void * v ) ; void *OW_Avahi_Browse(void * v) ; #endif /* OW_AVAHI_H */ owfs-2.8p15/module/owlib/src/include/ow_stats.h0000644000175000017500000000135611654103312016440 00000000000000/* $Id: ow_stats.h,v 1.10 2011/11/01 23:54:50 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_STATS_H #define OW_STATS_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(stats_cache); DeviceHeader(stats_read); DeviceHeader(stats_write); DeviceHeader(stats_directory); DeviceHeader(stats_errors); DeviceHeader(stats_thread); DeviceHeader(stats_return_code); #endif /* OW_STATS */ owfs-2.8p15/module/owlib/src/include/ow_2760.h0000664000175000017500000000135211310575610015701 00000000000000/* $Id: ow_2760.h,v 1.7 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2760_H #define OW_2760_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2720); DeviceHeader(DS2740); DeviceHeader(DS2751); DeviceHeader(DS2755); DeviceHeader(DS2756); DeviceHeader(DS2760); DeviceHeader(DS2770); DeviceHeader(DS2780); DeviceHeader(DS2781); #endif /* OW_2760_H */ owfs-2.8p15/module/owlib/src/include/ow_localtypes.h0000664000175000017500000000710511363047211017463 00000000000000/* $Id: ow_localtypes.h,v 1.5 2010/04/19 12:37:29 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_LOCALTYPES_H /* tedious wrapper */ #define OW_LOCALTYPES_H #include /* Floating point */ /* I hate to do this, making everything a double */ /* The compiler complains mercilessly, however */ /* 1-wire really is low precision -- float is more than enough */ /* FLOAT and DATE collides with cygwin windows include-files. */ typedef double _FLOAT; typedef time_t _DATE; typedef unsigned char BYTE; typedef char ASCII; typedef unsigned int UINT; typedef int INT; #endif /* OW_LOCALTYPES_H */ owfs-2.8p15/module/owlib/src/include/ow_stub.h0000664000175000017500000000110210021014055016236 00000000000000/* $Id: ow_stub.h,v 1.2 2004/03/02 05:14:21 vtt Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_STUB_H #define OW_STUB_H // VT: NOTE: This file serves the only purpose: so it can be checked by the // packages that depend on this package. Other header files can't be used // because they demand presence of config.h, or, rather, defined CONFIG_H. #endif owfs-2.8p15/module/owlib/src/include/ow_functions.h0000644000175000017500000002272111740167566017332 00000000000000/* $Id: ow_functions.h,v 1.96 2012/04/08 01:52:54 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 \ LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, // --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_FUNCTION_H /* tedious wrapper */ #define OW_FUNCTION_H #include "ow_parse_sn.h" // sub-includes /* Prototypes */ #define READ_FUNCTION( fname ) static int fname( struct one_wire_query * owq ) #define WRITE_FUNCTION( fname ) static int fname( struct one_wire_query * owq ) /* Prototypes for owlib.c -- libow overall control */ void LibSetup(enum enum_program_type op); GOOD_OR_BAD LibStart(void); void HandleSignals(void); void LibStop(void); void LibClose(void); GOOD_OR_BAD EnterBackground(void); /* Initial sorting or the device and filetype lists */ void DeviceSort(void); void DeviceDestroy(void); /* Pasename processing -- URL/path comprehension */ int filetype_cmp(const void *name, const void *ex); ZERO_OR_ERROR FS_ParsedNamePlus(const char *path, const char *file, struct parsedname *pn); ZERO_OR_ERROR FS_ParsedNamePlusExt(const char *path, const char *file, int extension, enum ag_index alphanumeric, struct parsedname *pn); ZERO_OR_ERROR FS_ParsedNamePlusText(const char *path, const char *file, const char *extension, struct parsedname *pn); ZERO_OR_ERROR FS_ParsedName(const char *fn, struct parsedname *pn); ZERO_OR_ERROR FS_ParsedName_BackFromRemote(const char *fn, struct parsedname *pn); void FS_ParsedName_destroy(struct parsedname *pn); void FS_ParsedName_Placeholder( struct parsedname * pn ) ; size_t FileLength(const struct parsedname *pn); size_t FullFileLength(const struct parsedname *pn); INDEX_OR_ERROR CheckPresence(struct parsedname *pn); INDEX_OR_ERROR ReCheckPresence(struct parsedname *pn); INDEX_OR_ERROR RemoteAlias(struct parsedname *pn); void FS_devicename(char *buffer, const size_t length, const BYTE * sn, const struct parsedname *pn); void FS_devicefind(const char *code, struct parsedname *pn); struct device * FS_devicefindhex(BYTE f, struct parsedname *pn); const char *FS_DirName(const struct parsedname *pn); /* Utility functions */ BYTE CRC8(const BYTE * bytes, const size_t length); BYTE CRC8seeded(const BYTE * bytes, const size_t length, const UINT seed); BYTE CRC8compute(const BYTE * bytes, const size_t length, const UINT seed); int CRC16(const BYTE * bytes, const size_t length); int CRC16seeded(const BYTE * bytes, const size_t length, const UINT seed); BYTE char2num(const char *s); BYTE string2num(const char *s); char num2char(const BYTE n); void num2string(char *s, const BYTE n); void string2bytes(const char *str, BYTE * b, const int bytes); void bytes2string(char *str, const BYTE * b, const int bytes); int UT_getbit(const BYTE * buf, const int loc); int UT_get2bit(const BYTE * buf, const int loc); void UT_setbit(BYTE * buf, const int loc, const int bit); void UT_set2bit(BYTE * buf, const int loc, const int bits); void UT_fromDate(const _DATE D, BYTE * data); _DATE UT_toDate(const BYTE * date); void Test_and_Close( FILE_DESCRIPTOR_OR_ERROR * file_descriptor ) ; void Test_and_Close_Pipe( FILE_DESCRIPTOR_OR_ERROR * pipe_fd ) ; void Init_Pipe( FILE_DESCRIPTOR_OR_ERROR * pipe_fd ) ; /* Cache and Storage functions */ #include "ow_cache.h" void FS_LoadDirectoryOnly(struct parsedname *pn_directory, const struct parsedname *pn_original); GOOD_OR_BAD FS_Test_Simultaneous( enum simul_type type, UINT delay, const struct parsedname * pn) ; GOOD_OR_BAD FS_poll_convert(const struct parsedname *pn); // ow_locks.c void LockSetup(void); ZERO_OR_ERROR DeviceLockGet(struct parsedname *pn); void DeviceLockRelease(struct parsedname *pn); /* 1-wire lowlevel */ void UT_delay(const UINT len); void UT_delay_us(const unsigned long len); ZERO_OR_ERROR tcp_read(FILE_DESCRIPTOR_OR_ERROR file_descriptor, BYTE * buffer, size_t n, const struct timeval *ptv, size_t * actual_read); void tcp_read_flush(FILE_DESCRIPTOR_OR_ERROR file_descriptor); GOOD_OR_BAD tcp_wait(FILE_DESCRIPTOR_OR_ERROR file_descriptor, const struct timeval *ptv); ssize_t udp_read(FILE_DESCRIPTOR_OR_ERROR file_descriptor, void *vptr, size_t n, const struct timeval * ptv, struct sockaddr_in *from, socklen_t *fromlen) ; GOOD_OR_BAD ClientAddr(char *sname, char * default_port, struct connection_in *in); FILE_DESCRIPTOR_OR_ERROR ClientConnect(struct connection_in *in); void FreeClientAddr(struct connection_in *in); void ServerProcess(void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor)); GOOD_OR_BAD ServerOutSetup(struct connection_out *out); GOOD_OR_BAD ReadAliasFile(const ASCII * file) ; GOOD_OR_BAD Test_and_Add_Alias( char * name, BYTE * sn ) ; speed_t COM_MakeBaud( int raw_baud ) ; int COM_BaudRate( speed_t B_baud ) ; void COM_BaudRestrict( speed_t * B_baud, ... ) ; void FS_help(const char *arg); INDEX_OR_ERROR ServerPresence( struct parsedname *pn); SIZE_OR_ERROR ServerRead(struct one_wire_query *owq); ZERO_OR_ERROR ServerWrite(struct one_wire_query *owq); ZERO_OR_ERROR ServerDir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn, uint32_t * flags); /* High-level callback functions */ ZERO_OR_ERROR FS_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, struct parsedname *pn); ZERO_OR_ERROR FS_dir_remote(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn, uint32_t * flags); void FS_dir_entry_aliased(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn) ; SIZE_OR_ERROR FS_write(const char *path, const char *buf, const size_t size, const off_t offset); SIZE_OR_ERROR FS_write_postparse(struct one_wire_query *owq); ZERO_OR_ERROR FS_write_local(struct one_wire_query *owq); SIZE_OR_ERROR FS_get(const char *path, char **return_buffer, size_t * buffer_length) ; SIZE_OR_ERROR FS_read(const char *path, char *buf, const size_t size, const off_t offset); SIZE_OR_ERROR FS_read_postparse(struct one_wire_query *owq); ZERO_OR_ERROR FS_read_fake(struct one_wire_query *owq); ZERO_OR_ERROR FS_read_tester(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_aggregate_all(struct one_wire_query *owq); SIZE_OR_ERROR FS_read_local( struct one_wire_query *owq); size_t FileLength_vascii(struct one_wire_query *owq); ZERO_OR_ERROR FS_r_external( struct one_wire_query * owq ) ; ZERO_OR_ERROR FS_w_external( struct one_wire_query * owq ) ; #include "ow_sibling.h" ZERO_OR_ERROR FS_fstat(const char *path, struct stat *stbuf); ZERO_OR_ERROR FS_fstat_postparse(struct stat *stbuf, const struct parsedname *pn); /* iteration functions for splitting writes to buffers */ GOOD_OR_BAD COMMON_readwrite_paged(struct one_wire_query *owq, size_t page, size_t pagelen, GOOD_OR_BAD (*readwritefunc) (BYTE *, size_t, off_t, struct parsedname *)); GOOD_OR_BAD COMMON_OWQ_readwrite_paged(struct one_wire_query *owq, size_t page, size_t pagelen, GOOD_OR_BAD (*readwritefunc) (struct one_wire_query *, size_t, size_t)); ZERO_OR_ERROR COMMON_r_date( struct one_wire_query * owq ) ; ZERO_OR_ERROR COMMON_w_date( struct one_wire_query * owq ) ; GOOD_OR_BAD COMMON_read_memory_F0(struct one_wire_query *owq, size_t page, size_t pagesize); GOOD_OR_BAD COMMON_read_memory_crc16_A5(struct one_wire_query *owq, size_t page, size_t pagesize); GOOD_OR_BAD COMMON_read_memory_crc16_AA(struct one_wire_query *owq, size_t page, size_t pagesize); GOOD_OR_BAD COMMON_read_memory_toss_counter(struct one_wire_query *owq, size_t page, size_t pagesize); GOOD_OR_BAD COMMON_read_memory_plus_counter(BYTE * extra, size_t page, size_t pagesize, struct parsedname *pn); ZERO_OR_ERROR COMMON_write_eprom_mem_owq(struct one_wire_query * owq) ; ZERO_OR_ERROR COMMON_offset_process( ZERO_OR_ERROR (*func) (struct one_wire_query *), struct one_wire_query * owq, off_t shift_offset) ; void BUS_lock(const struct parsedname *pn); void BUS_unlock(const struct parsedname *pn); void BUS_lock_in(struct connection_in *in); void BUS_unlock_in(struct connection_in *in); /* API wrappers for swig and owcapi */ void API_setup(enum enum_program_type opt); GOOD_OR_BAD API_init(const char *command_line); void API_set_error_level(const char *params); void API_set_error_print(const char *params); void API_finish(void); int API_access_start(void); void API_access_end(void); #endif /* OW_FUNCTION_H */ owfs-2.8p15/module/owlib/src/include/ow_2433.h0000664000175000017500000000112211310575610015671 00000000000000/* $Id: ow_2433.h,v 1.6 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2433_H #define OW_2433_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2431); DeviceHeader(DS2433); DeviceHeader(DS28EC20); #endif owfs-2.8p15/module/owlib/src/include/ow_w1_seq.h0000664000175000017500000000126311425675574016524 00000000000000/* $Id: ow_w1_seq.h,v 1.1 2010/08/03 02:14:20 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" */ #ifndef OW_W1_SEQ_H /* tedious wrapper */ #define OW_W1_SEQ_H typedef int SEQ_OR_ERROR ; #define SEQ_BAD -1 #define SEQ_INIT 0 #endif /* OW_W1_SEQ_H */ owfs-2.8p15/module/owlib/src/include/ow_visibility.h0000664000175000017500000000270211444440157017477 00000000000000/* $Id: ow_visibility.h,v 1.3 2010/09/16 16:06:07 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille */ #ifndef OW_VISIBILITY_H /* tedious wrapper */ #define OW_VISIBILITY_H #define NO_READ_FUNCTION NULL #define NO_WRITE_FUNCTION NULL enum e_visibility { visible_never, visible_not_now, visible_now, visible_always, } ; enum e_visibility AlwaysVisible( const struct parsedname * pn ) ; #define VISIBLE AlwaysVisible enum e_visibility NeverVisible( const struct parsedname * pn ) ; #define INVISIBLE NeverVisible #define VISIBILE_PRESENT INVISIBLE GOOD_OR_BAD GetVisibilityCache( int * visibility_parameter, const struct parsedname * pn ) ; void SetVisibilityCache( int visibility_parameter, const struct parsedname * pn ) ; enum e_visibility FS_visible( const struct parsedname * pn ) ; #endif /* OW_VISIBILITY_H */ owfs-2.8p15/module/owlib/src/include/ow_eds.h0000664000175000017500000000105511527101723016056 00000000000000/* $Id: ow_eds.h,v 1.2 2011/02/17 02:11:31 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_EDS_H #define OW_EDS_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(EDS); #endif /* OW_EDS_H */ owfs-2.8p15/module/owlib/src/include/ow_temperature.h0000664000175000017500000000273211324736501017646 00000000000000/* $Id: ow_temperature.h,v 1.1 2010/01/18 01:45:37 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* Cannot stand alone -- separated out of ow.h for clarity */ #ifndef OW_TEMPERATURE_H /* tedious wrapper */ #define OW_TEMPERATURE_H /* Global temperature scale */ enum temp_type { temp_celsius, temp_fahrenheit, temp_kelvin, temp_rankine, }; _FLOAT Temperature(_FLOAT C, const struct parsedname *pn); _FLOAT TemperatureGap(_FLOAT C, const struct parsedname *pn); _FLOAT fromTemperature(_FLOAT T, const struct parsedname *pn); _FLOAT fromTempGap(_FLOAT T, const struct parsedname *pn); const char *TemperatureScaleName(enum temp_type t); #endif /* OW_TEMPERATURE_H */ owfs-2.8p15/module/owlib/src/include/ow_bitwork.h0000664000175000017500000000550411611711275016772 00000000000000/* $Id: ow_bitwork.h,v 1.2 2011/07/21 02:45:17 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* CAnn stand alone -- separated out of ow.h for clarity */ #ifndef OW_BITWORK_H /* tedious wrapper */ #define OW_BITWORK_H #define BYTE_MASK(x) ( (unsigned char) ((x)&0xFF) ) #define BYTE_INVERSE(x) BYTE_MASK((x)^0xFF) #define LOW_HIGH_ADDRESS(x) BYTE_MASK(x),BYTE_MASK((x)>>8) #endif /* OW_BITWORK_H */ owfs-2.8p15/module/owlib/src/include/ow_dl.h0000664000175000017500000000141611427405365015713 00000000000000/* $Id: ow_dl.h,v 1.7 2010/08/08 01:40:05 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 All the error and statistics counters are declared here, including handling macros */ #ifndef OW_DL_H #define OW_DL_H #include #include "owfs_config.h" #if OW_ZERO #if OW_CYGWIN #include typedef HMODULE DLHANDLE; #elif defined(HAVE_DLOPEN) #include typedef void *DLHANDLE; #endif /* OW_CYGWIN */ DLHANDLE DL_open(const char *pathname); void *DL_sym(DLHANDLE handle, const char *name); int DL_close(DLHANDLE handle); char *DL_error(void); #else /* OW_ZERO */ typedef void *DLHANDLE; #endif /* OW_ZERO */ extern DLHANDLE libdnssd; extern DLHANDLE avahi_client ; extern DLHANDLE avahi_common ; #endif owfs-2.8p15/module/owlib/src/include/ow_2409.h0000664000175000017500000000104411310575610015677 00000000000000/* $Id: ow_2409.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2409_H #define OW_2409_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2409); #endif owfs-2.8p15/module/owlib/src/include/ow_programs.h0000664000175000017500000000334511562366032017146 00000000000000/* $Id: ow_programs.h,v 1.1 2011/05/11 01:53:30 alfille Exp $ Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* control over users of owlib -- the programs */ /* This file doesn't stand alone, it must be included in ow.h */ #ifndef OW_PROGRAMS_H /* tedious wrapper */ #define OW_PROGRAMS_H extern void set_signal_handlers(void (*exit_handler) (int signo, siginfo_t * info, void *context)); void set_exit_signal_handlers(void (*exit_handler) (int signo, siginfo_t * info, void *context)); #ifndef SI_FROMUSER #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) #endif #ifndef SI_FROMKERNEL #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) #endif #if OW_MT extern int main_threadid_init ; extern pthread_t main_threadid; #define IS_MAINTHREAD ( (main_threadid_init==1) && (main_threadid == pthread_self()) ) #else #define IS_MAINTHREAD 1 #endif /* Exit handler */ void exit_handler(int signo, siginfo_t * info, void *context) ; void ow_exit(int exit_code) ; #endif /* OW_PROGRAMS_H */ owfs-2.8p15/module/owlib/src/include/connector.h0000664000175000017500000000477211663574325016616 00000000000000/* * connector.h * * 2004-2005 Copyright (c) Evgeniy Polyakov * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CONNECTOR_H #define __CONNECTOR_H #include #include "owfs_config.h" #ifdef HAVE_ASM_TYPES_H #include #endif #define CN_IDX_CONNECTOR 0xffffffff #define CN_VAL_CONNECTOR 0xffffffff /* * Process Events connector unique ids -- used for message routing */ #define CN_IDX_PROC 0x1 #define CN_VAL_PROC 0x1 #define CN_IDX_CIFS 0x2 #define CN_VAL_CIFS 0x1 #define CN_W1_IDX 0x3 /* w1 communication */ #define CN_W1_VAL 0x1 #define CN_IDX_V86D 0x4 #define CN_VAL_V86D_UVESAFB 0x1 #define CN_NETLINK_USERS 5 /* * Maximum connector's message size. */ #define CONNECTOR_MAX_MSG_SIZE 16384 /* * idx and val are unique identifiers which * are used for message routing and * must be registered in connector.h for in-kernel usage. */ #pragma pack(push) /* push current alignment to stack */ #pragma pack(1) /* set alignment to 1 byte boundary */ struct cb_id { __u32 idx; __u32 val; }; struct cn_msg { struct cb_id id; __u32 seq; __u32 ack; __u16 len; /* Length of the following data */ __u16 flags; __u8 data[0]; }; /* * Notify structure - requests notification about * registering/unregistering idx/val in range [first, first+range]. */ struct cn_notify_req { __u32 first; __u32 range; }; /* * Main notification control message * *_notify_num - number of appropriate cn_notify_req structures after * this struct. * group - notification receiver's idx. * len - total length of the attached data. */ struct cn_ctl_msg { __u32 idx_notify_num; __u32 val_notify_num; __u32 group; __u32 len; __u8 data[0]; }; #pragma pack(pop) /* restore original alignment from stack */ #endif /* __CONNECTOR_H */ owfs-2.8p15/module/owlib/src/include/ow_parse_address.h0000664000175000017500000000574711605331711020135 00000000000000/* $Id: ow_parse_address.h,v 1.4 2011/07/07 13:25:29 alfille Exp $ Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_PARSE_ADDRESS_H /* tedious wrapper */ #define OW_PARSE_ADDRESS_H struct address_entry { enum { address_none, address_alpha, address_all, address_numeric, address_dottedquad, } type ; char * alpha ; int number ; } ; typedef int ADDRESS_OR_FLAG ; struct address_pair { int entries ; struct address_entry first ; struct address_entry second ; struct address_entry third ; } ; void Parse_Address( char * address, struct address_pair * ap ) ; void Free_Address( struct address_pair * ap ) ; #endif /* OW_PARSE_ADDRESS_H */ owfs-2.8p15/module/owlib/src/include/ow_2401.h0000664000175000017500000000130011310575610015662 00000000000000/* $Id: ow_2401.h,v 1.7 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2401_H #define OW_2401_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* DS2401 Simple ID device */ /* Also needed for all others */ /* ------- Prototypes ----------- */ /* All from ow_xxxx.c file */ /* ------- Structures ----------- */ DeviceHeader(DS2401); DeviceHeader(DS1420); #endif owfs-2.8p15/module/owlib/src/include/ow_thermocouple.h0000664000175000017500000000147410750074145020022 00000000000000/* $Id: ow_thermocouple.h,v 1.2 2008/01/30 13:15:17 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_THERMOCOUPLE_H #define OW_THERMOCOUPLE_H #include "ow_localtypes.h" // for _FLOAT enum e_thermocouple_type { e_type_b, e_type_e, e_type_j, e_type_k, e_type_n, e_type_r, e_type_s, e_type_t, e_type_last, }; _FLOAT ThermocoupleTemperature(_FLOAT mV_reading, _FLOAT temperature_coldjunction, enum e_thermocouple_type etype); _FLOAT Thermocouple_range_low(enum e_thermocouple_type etype); _FLOAT Thermocouple_range_high(enum e_thermocouple_type etype); #endif /* OW_THERMOCOUPLE_H */ owfs-2.8p15/module/owlib/src/include/ow_stateinfo.h0000664000175000017500000000573711377034702017317 00000000000000/* $Id: ow_stateinfo.h,v 1.7 2010/05/25 20:57:38 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* CAnn stand alone -- separated out of ow.h for clarity */ #ifndef OW_STATEINFO_H /* tedious wrapper */ #define OW_STATEINFO_H enum lib_state { lib_state_pre, lib_state_setup, lib_state_started, lib_state_active, lib_state_finished, }; /* Globals information (for local control) */ struct stateinfo { enum lib_state owlib_state; int lock_setup_done; time_t start_time; time_t dir_time; int shutting_down; }; extern struct stateinfo StateInfo; #endif /* OW_STATEINFO_H */ owfs-2.8p15/module/owlib/src/include/ow_onewirequery.h0000664000175000017500000001075611455142436020057 00000000000000/* $Id: ow_onewirequery.h,v 1.37 2010/10/12 20:29:18 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 */ // encapsulation or parameters for read, write and directory #ifndef OW_ONEWIREQUERY_H /* tedious wrapper */ #define OW_ONEWIREQUERY_H enum owq_cleanup { owq_cleanup_none = 0, owq_cleanup_owq = 0x01, owq_cleanup_pn = 0x02, owq_cleanup_buffer = 0x04, owq_cleanup_rbuffer = 0x08, owq_cleanup_array = 0x10, // unrelated flag owq_simultaneous = 0x1000, } ; union value_object { int I; unsigned int U; _FLOAT F; _DATE D; int Y; //boolean size_t length; union value_object *array; }; struct one_wire_query { char *buffer; //char *read_buffer; //const char *write_buffer; size_t size; off_t offset; struct parsedname pn; enum owq_cleanup cleanup; union value_object val; }; #define NO_ONE_WIRE_QUERY NULL #define OWQ_pn(owq) ((owq)->pn) #define OWQ_buffer(owq) ((owq)->buffer) #define OWQ_read_buffer(owq) ((owq)->read_buffer) #define OWQ_write_buffer(owq) ((owq)->write_buffer) #define OWQ_size(owq) ((owq)->size) #define OWQ_offset(owq) ((owq)->offset) #define OWQ_cleanup(owq) ((owq)->cleanup) #define OWQ_val(owq) ((owq)->val) #define OWQ_array(owq) (((owq)->val).array) #define PN(owq) (&OWQ_pn(owq)) #define OWQ_I(owq) ((OWQ_val(owq)).I) #define OWQ_U(owq) ((OWQ_val(owq)).U) #define OWQ_F(owq) ((OWQ_val(owq)).F) #define OWQ_D(owq) ((OWQ_val(owq)).D) #define OWQ_Y(owq) ((OWQ_val(owq)).Y) #define OWQ_length(owq) ((OWQ_val(owq)).length) #define OWQ_array_I(owq,i) ((OWQ_array(owq)[i]).I) #define OWQ_array_U(owq,i) ((OWQ_array(owq)[i]).U) #define OWQ_array_F(owq,i) ((OWQ_array(owq)[i]).F) #define OWQ_array_D(owq,i) ((OWQ_array(owq)[i]).D) #define OWQ_array_Y(owq,i) ((OWQ_array(owq)[i]).Y) #define OWQ_array_length(owq,i) ((OWQ_array(owq)[i]).length) #define OWQ_explode(owq) (BYTE *)OWQ_buffer(owq),OWQ_size(owq),OWQ_offset(owq),PN(owq) #define OWQ_SIMUL_SET(owq) (((owq)->cleanup) |= owq_simultaneous ) #define OWQ_SIMUL_CLR(owq) (((owq)->cleanup) &= (~owq_simultaneous) ) #define OWQ_SIMUL_TEST(owq) ((((owq)->cleanup) & owq_simultaneous) != 0 ) //#define OWQ_allocate_struct_and_pointer( owq_name ) struct one_wire_query struct_##owq_name ; struct one_wire_query * owq_name = & struct_##owq_name // perhaps it would be nice to clear the memory try trace errors. OWQ_allocate_struct_and_pointer() needs to be defined as the last local variable now... // "owq_name->cleanup = owq_cleanup_none" is needed at least... but why not clear the whole struct just to make sure it never happens again. #define OWQ_allocate_struct_and_pointer( owq_name ) struct one_wire_query struct_##owq_name ; struct one_wire_query * owq_name = & struct_##owq_name; memset(&struct_##owq_name, 0, sizeof(struct one_wire_query)); GOOD_OR_BAD OWQ_create(const char *path, struct one_wire_query *owq); GOOD_OR_BAD OWQ_create_plus(const char *path, const char *file, struct one_wire_query *owq); void OWQ_destroy(struct one_wire_query *owq); struct one_wire_query * OWQ_create_from_path(const char *path) ; struct one_wire_query * OWQ_create_sibling(const char *sibling, struct one_wire_query *owq_original) ; GOOD_OR_BAD OWQ_allocate_read_buffer(struct one_wire_query * owq ) ; GOOD_OR_BAD OWQ_allocate_write_buffer( const char * write_buffer, size_t buffer_length, off_t offset, struct one_wire_query * owq ) ; void OWQ_assign_read_buffer(char *buffer, size_t size, off_t offset, struct one_wire_query *owq) ; void OWQ_assign_write_buffer(const char *buffer, size_t size, off_t offset, struct one_wire_query *owq) ; struct one_wire_query * OWQ_create_separate( int extension, struct one_wire_query * owq_aggregate ) ; struct one_wire_query * OWQ_create_aggregate( struct one_wire_query * owq_single ); void OWQ_create_temporary(struct one_wire_query *owq_temporary, char *buffer, size_t size, off_t offset, struct parsedname *pn); ZERO_OR_ERROR OWQ_format_output_offset_and_size(const char *string, size_t length, struct one_wire_query *owq); ZERO_OR_ERROR OWQ_format_output_offset_and_size_z(const char *string, struct one_wire_query *owq); struct one_wire_query * ALLtoBYTE( struct one_wire_query *owq_all ); struct one_wire_query * BYTEtoALL( struct one_wire_query *owq_byte ); int OWQ_parse_input(struct one_wire_query *owq); SIZE_OR_ERROR OWQ_parse_output(struct one_wire_query *owq); void _print_owq(struct one_wire_query *owq); #endif /* OW_ONEWIREQUERY_H */ owfs-2.8p15/module/owlib/src/include/ow_2438.h0000664000175000017500000000107211310575610015702 00000000000000/* $Id: ow_2438.h,v 1.6 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2438_H #define OW_2438_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2437); DeviceHeader(DS2438); #endif owfs-2.8p15/module/owlib/src/include/ow_global.h0000644000175000017500000001207211741146660016551 00000000000000/* $Id: ow_global.h,v 1.35 2012/03/30 02:54:28 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* CAnn stand alone -- separated out of ow.h for clarity */ #ifndef OW_GLOBAL_H /* tedious wrapper */ #define OW_GLOBAL_H #include "ow_temperature.h" #include "ow_pressure.h" // some improbably sub-absolute-zero number #define GLOBAL_UNTOUCHED_TEMP_LIMIT (-999.) #define DEFAULT_USB_SCAN_INTERVAL 10 /* seconds */ enum zero_support { zero_unknown, zero_none, zero_bonjour, zero_avahi, } ; enum enum_program_type { program_type_filesystem, program_type_server, program_type_httpd, program_type_ftpd, program_type_external, program_type_tcl, program_type_swig, program_type_clibrary, program_option_sensor, program_option_property, }; /* Globals information (for local control) */ struct global { int announce_off; // use zeroconf? ASCII *announce_name; enum temp_type temp_scale; enum pressure_type pressure_scale ; enum deviceformat format ; enum enum_program_type program_type; int allow_external ; // allow this program to call external programs for read/write -- dangerous int allow_other ; ASCII *progname; union antiloop Token; int uncached ; // all requests are from /uncached directory int unaliased ; // all requests are from /unaliased (no alias substitution on results) int want_background; int now_background; int error_level; int error_print; int fatal_debug; int concurrent_connections; ASCII *fatal_debug_file; int readonly; int max_clients; // for ftp size_t cache_size; // max cache size (or 0 for no max) ; int one_device; // Single device, use faster ROM comands /* Special parameter to trigger William Robison timings */ int altUSB; int usb_flextime; int serial_flextime; int serial_reverse; // reverse polarity ? int serial_hardflow ; // hardware flow control /* timeouts -- order must match ow_opt.c values for correct indexing */ int timeout_volatile; int timeout_stable; int timeout_directory; int timeout_presence; int timeout_serial; // serial read and write use the same timeout currently int timeout_usb; int timeout_network; int timeout_server; int timeout_ftp; int timeout_ha7; int timeout_w1; int timeout_persistent_low; int timeout_persistent_high; int clients_persistent_low; int clients_persistent_high; int usb_scan_interval ; int pingcrazy; int no_dirall; int no_get; int no_persistence; int eightbit_serial; enum zero_support zero ; int i2c_APU ; int i2c_PPM ; int baud ; _FLOAT templow ; _FLOAT temphigh ; }; extern struct global Globals; // generic value for ignorable function returns extern int ignore_result ; void SetLocalControlFlags( void ) ; #endif /* OW_GLOBAL_H */ owfs-2.8p15/module/owlib/src/include/ow_memblob.h0000664000175000017500000000637511535564167016750 00000000000000/* $Id: ow_memblob.h,v 1.6 2011/03/09 02:39:51 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #ifndef OW_MEMBLOB_H /* tedious wrapper */ #define OW_MEMBLOB_H struct memblob { int troubled; size_t allocated; size_t increment; size_t used; BYTE *memory_storage; }; int MemblobPure(struct memblob *mb) ; void MemblobClear(struct memblob *mb); void MemblobInit(struct memblob *mb, size_t increment); int MemblobAdd(const BYTE * data, size_t length, struct memblob *mb); int MemblobAddChar(BYTE character, size_t length, struct memblob *mb); BYTE * MemblobData(struct memblob * mb); size_t MemblobLength(struct memblob * mb); void MemblobTrim(size_t nchars, struct memblob * mb); #endif /* OW_MEMBLOB_H */ owfs-2.8p15/module/owlib/src/include/ow_2415.h0000664000175000017500000000107211310575610015675 00000000000000/* $Id: ow_2415.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2415_H #define OW_2415_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2415); DeviceHeader(DS2417); #endif owfs-2.8p15/module/owlib/src/include/ow_return_code.h0000644000175000017500000000523111667513706017627 00000000000000/* $Id: ow_return_code.h,v 1.6 2011/12/06 22:31:34 alfille Exp $ OW -- One-Wire filesystem LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_RETURN_CODE_H /* tedious wrapper */ #define OW_RETURN_CODE_H #include "ow_debug.h" // Not stand-alone but part of ow_h extern char * return_code_strings[] ; // Fragile: return_code_out_of_bounds is set to the last entry in the error (return_code) list // it's defined in ow_return_code.c #define return_code_out_of_bounds 210 extern int return_code_calls[] ; #define N_RETURN_CODES (return_code_out_of_bounds+1) #define RETURN_CODE_INIT(pn) do { (pn)->return_code = 0 ; ++return_code_calls[0]; } while (0) ; #define RETURN_IF_ERROR(pn) if ( (pn)->return_code != 0 ) { return ; } #ifndef __FILE__ #define __FILE__ "" #endif #ifndef __LINE__ #define __LINE__ "" #endif #ifndef __func__ #define __func__ "" #endif /* Set return code into the proper place in parsedname strcture */ #define RETURN_CODE_SET(rc,pn) return_code_set_scalar( rc, pn, __FILE__, __LINE__, __func__ ) /* Set return code into an integer */ #define RETURN_CODE_SET_SCALAR(i,rc) return_code_set_scalar( rc, &(i), __FILE__, __LINE__, __func__ ) /* Unconditional return with return code */ #define RETURN_CODE_RETURN(rc) do { int i ; RETURN_CODE_SET_SCALAR(i,rc) ; return -i; } while(0) ; /* Conditional return with return code */ #define RETURN_CODE_ERROR_RETURN(rc) do { int i ; RETURN_CODE_SET_SCALAR(i,rc) ; if ( i != 0 ) { return -i; } } while(0) ; void return_code_set( int rc, struct parsedname * pn, const char * d_file, int d_line, const char * d_func ) ; void return_code_set_scalar( int rc, int * pi, const char * d_file, int d_line, const char * d_func ) ; void Return_code_setup(void) ; #endif /* OW_RETURN_CODE_H */ owfs-2.8p15/module/owlib/src/include/ow_simultaneous.h0000664000175000017500000000113511310575610020032 00000000000000/* $Id: ow_simultaneous.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_SIMULTANEOUS_H #define OW_SIMULTANEOUS_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(simultaneous); #endif /* OW_SIMULTANEOUS */ owfs-2.8p15/module/owlib/src/include/ow_transaction.h0000664000175000017500000001352511501267164017641 00000000000000/* $Id: ow_transaction.h,v 1.13 2010/12/13 00:53:08 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_TRANSACTION_H /* tedious wrapper */ #define OW_TRANSACTION_H enum transaction_type { trxn_select, trxn_match, trxn_bitmatch, trxn_modify, trxn_bitmodify, trxn_compare, trxn_bitcompare, trxn_read, trxn_bitread, trxn_blind, trxn_power, trxn_bitpower, trxn_program, trxn_reset, trxn_crc8, trxn_crc8seeded, trxn_crc16, trxn_crc16seeded, trxn_end, trxn_verify, trxn_nop, trxn_delay, trxn_udelay, }; struct transaction_log { const BYTE *out; BYTE *in; size_t size; enum transaction_type type; }; #define TRXN_NVERIFY { NULL, NULL, _1W_SEARCH_ROM, trxn_verify, } #define TRXN_AVERIFY { NULL, NULL, _1W_CONDITIONAL_SEARCH_ROM, trxn_verify, } #define TRXN_START { NULL, NULL, 0, trxn_select, } #define TRXN_END { NULL, NULL, 0, trxn_end, } #define TRXN_RESET { NULL, NULL, 0, trxn_reset, } #define TRXN_WRITE(writedata,length) { writedata, NULL, length, trxn_match, } #define TRXN_WRITE_BITS(writedata,length) { writedata, NULL, length, trxn_bitmatch, } #define TRXN_READ(readdata,length) { NULL, readdata, length, trxn_read, } #define TRXN_READ_BITS(readdata,length) { NULL, readdata, length, trxn_bitread, } #define TRXN_MODIFY(writedata,readdata,length) { writedata, readdata, length, trxn_modify, } #define TRXN_MODIFY_BITS(writedata,readdata,length) { writedata, readdata, length, trxn_bitmodify, } #define TRXN_COMPARE(data1, data2, length) { data1, data2, length, trxn_compare } #define TRXN_COMPARE_BITS(data1, data2, length) { data1, data2, length, trxn_bitcompare } #define TRXN_CRC8(data,length) { data, NULL, length, trxn_crc8, } #define TRXN_CRC16(data,length) { data, NULL, length, trxn_crc16, } #define TRXN_CRC16_seeded(data,length,seed) { data, seed, length, trxn_crc16, } #define TRXN_BLIND(writedata,length) { writedata, NULL, length, trxn_blind, } #define TRXN_POWER(byte_pointer, msec) { byte_pointer, byte_pointer, msec, trxn_power, } #define TRXN_POWER_BIT(byte_pointer, msec) { byte_pointer, byte_pointer, msec, trxn_bitpower, } #define TRXN_DELAY(msec) { NULL, NULL, msec, trxn_delay } #define TRXN_WRITE1(writedata) TRXN_WRITE(writedata,1) #define TRXN_READ1(readdata) TRXN_READ(readdata,1) #define TRXN_WRITE2(writedata) TRXN_WRITE(writedata,2) #define TRXN_READ2(readdata) TRXN_READ(readdata,2) #define TRXN_WRITE3(writedata) TRXN_WRITE(writedata,3) #define TRXN_READ3(readdata) TRXN_READ(readdata,3) #define TRXN_WR_CRC16(pointer,writelength,readlength) \ TRXN_WRITE((BYTE *)pointer,writelength), \ TRXN_READ(((BYTE *)pointer)+(writelength),readlength+2), \ TRXN_CRC16((BYTE *)pointer,writelength+readlength+2) #define TRXN_WR_CRC16_SEEDED(pointer,seed, writelength,readlength) \ TRXN_WRITE((BYTE *)pointer,writelength), \ TRXN_READ(((BYTE *)pointer)+(writelength),readlength+2), \ TRXN_CRC16_seeded((BYTE *)pointer, writelength+readlength+2, (BYTE *) (seed) ) #define TRXN_PROGRAM { NULL, NULL, 0, trxn_program, } GOOD_OR_BAD BUS_transaction(const struct transaction_log *tl, const struct parsedname *pn); GOOD_OR_BAD BUS_transaction_nolock(const struct transaction_log *tl, const struct parsedname *pn); #endif /* OW_TRANSACTION_H */ owfs-2.8p15/module/owlib/src/include/ow_timer.h0000664000175000017500000001314011440235033016415 00000000000000/* $Id: ow_timer.h,v 1.1 2010/09/03 18:10:35 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_TIMER_H /* tedious wrapper */ #define OW_TIMER_H #ifdef HAVE_SYS_TIME_H #include /* for gettimeofday */ #endif /* HAVE_SYS_TIME_H */ /* These macros doesn't exist for Solaris */ /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ #ifndef timerisset # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #endif #ifndef timerclear # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) #endif #ifndef timercmp # define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) #endif #ifndef timeradd # define timeradd(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 >= 1000000) \ { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ } while (0) #endif #ifndef 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 #define timernow( ptv ) gettimeofday( ptv, NULL ) #define timercpy( pdest, psrc ) do { (pdest)->tv_sec = (psrc)->tv_sec ; (pdest)->tv_usec = (psrc)->tv_usec ; } while (0) #define TVformat "%d.%06d seconds" #define TVvar(ptv) (ptv)->tv_sec,(ptv)->tv_usec #define TVfloat( ptv ) ( ( (double) (ptv)->tv_sec ) + ( (double) (ptv)->tv_usec ) * .000001 ) #endif /* OW_TIMER_H */ owfs-2.8p15/module/owlib/src/include/ow_example_slave.h0000664000175000017500000000114011673763537020146 00000000000000/* $Id: ow_example_slave.h,v 1.1 2011/12/20 01:39:43 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_EXAMPLE_SLAVE_H #define OW_EXAMPLE_SLAVE_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(Example_slave); #endif /* OW_EXAMPLE_SLAVE_H */ owfs-2.8p15/module/owlib/src/include/ow_w1.h0000644000175000017500000000430211672005460015630 00000000000000/* $Id: ow_w1.h,v 1.32 2011/12/14 02:34:24 alfille Exp $ W! Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov */ #if OW_W1 #ifndef OW_W1_H #define OW_W1_H #ifdef HAVE_STDINT_H #include #endif #include "netlink.h" #include "connector.h" #include "w1_netlink.h" // for some local types #include "ow_fd.h" #include "ow_localreturns.h" #include "ow_w1_seq.h" #define W1_NLM_LENGTH 16 #define W1_CN_LENGTH 20 #define W1_W1M_LENGTH 12 #define W1_W1C_LENGTH 4 enum Netlink_Read_Status { nrs_complete = 0 , nrs_bad_send, nrs_nodev, nrs_timeout, nrs_error, } ; struct connection_in ; struct parsedname ; GOOD_OR_BAD w1_bind( struct connection_in * in ) ; void RemoveW1Bus( int bus_master ) ; void AddW1Bus( int bus_master ) ; SEQ_OR_ERROR W1_send_msg( struct connection_in * in, struct w1_netlink_msg *msg, struct w1_netlink_cmd *cmd, const unsigned char * data) ; GOOD_OR_BAD W1PipeSelect_timeout( FILE_DESCRIPTOR_OR_ERROR file_descriptor ) ; void * W1_Dispatch( void * v ) ; SEQ_OR_ERROR w1_list_masters( void ) ; #define MAKE_NL_SEQ( bus, seq ) ((uint32_t)(( ((bus) & 0xFFFF) << 16 ) | ((seq) & 0xFFFF))) #define NL_SEQ( seq ) ((uint32_t)((seq) & 0xFFFF)) #define NL_BUS( seq ) ((uint32_t)(((seq) >> 16 ) & 0xFFFF)) struct netlink_parse { struct nlmsghdr * nlm ; struct cn_msg * cn ; struct w1_netlink_msg * w1m ; struct w1_netlink_cmd * w1c ; unsigned char * data ; int data_size ; __u8 follow[0] ; } ; //void * w1_master_command(struct netlink_parse * nlp) ; void * w1_master_command(void * v) ; void w1_parse_master_list(struct netlink_parse * nlp); GOOD_OR_BAD Netlink_Parse_Get( struct netlink_parse * nlp ) ; GOOD_OR_BAD Netlink_Parse_Buffer( struct netlink_parse * nlp ) ; void Netlink_Print( struct nlmsghdr * nlm, struct cn_msg * cn, struct w1_netlink_msg * w1m, struct w1_netlink_cmd * w1c, unsigned char * data, int length ) ; enum Netlink_Read_Status W1_Process_Response( void (* nrs_callback)( struct netlink_parse * nlp, void *v, const struct parsedname * pn), SEQ_OR_ERROR seq, void * v, const struct parsedname * pn ) ; #endif /* OW_W1_H */ #endif /* OW_W1 */ owfs-2.8p15/module/owlib/src/include/Makefile.am0000644000175000017500000000634311731463643016475 00000000000000noinst_HEADERS = \ compat_getopt.h \ compat.h \ i2c-dev.h \ compat_netdb.h \ connector.h \ ow.h \ ow_1820.h \ ow_1821.h \ ow_1921.h \ ow_1923.h \ ow_1954.h \ ow_1963.h \ ow_1977.h \ ow_1991.h \ ow_1993.h \ ow_2401.h \ ow_2404.h \ ow_2405.h \ ow_2406.h \ ow_2408.h \ ow_2409.h \ ow_2413.h \ ow_2415.h \ ow_2423.h \ ow_2430.h \ ow_2433.h \ ow_2436.h \ ow_2438.h \ ow_2450.h \ ow_2502.h \ ow_2505.h \ ow_2760.h \ ow_2804.h \ ow_2890.h \ ow_alloc.h \ ow_arg.h \ ow_avahi.h \ ow_bae.h \ ow_bitfield.h \ ow_bitwork.h \ ow_busnumber.h \ ow_bus_routines.h \ ow_cache.h \ ow_channel.h \ ow_charblob.h \ ow_codes.h \ ow_communication.h \ ow_connection.h \ ow_connection_in.h \ ow_connection_out.h\ ow_counters.h \ ow_debug.h \ ow_detect.h \ ow_device.h \ ow_devices.h \ ow_dirblob.h \ ow_dl.h \ ow_dnssd.h \ ow_eds.h \ ow_eeef.h \ ow_example_slave.h \ ow_external.h \ ow_fd.h \ ow_filetype.h \ ow_functions.h \ ow_generic_read.h \ ow_generic_write.h \ ow_global.h \ ow_integer.h \ ow_interface.h \ ow_localtypes.h \ ow_localreturns.h \ ow_lcd.h \ ow_master.h \ ow_memblob.h \ ow_message.h \ ow_mutexes.h \ ow_none.h \ ow_onewirequery.h \ ow_opt.h \ ow_parse_address.h \ ow_parsedname.h \ ow_parse_sn.h \ ow_pid.h \ ow_pressure.h \ ow_programs.h \ ow_reset.h \ ow_return_code.h \ ow_settings.h \ ow_search.h \ ow_sibling.h \ ow_simultaneous.h \ ow_standard.h \ ow_stateinfo.h \ ow_stats.h \ ow_stub.h \ ow_system.h \ ow_temperature.h \ ow_thermocouple.h \ ow_timer.h \ ow_traffic.h \ ow_transaction.h \ ow_usb_cycle.h \ ow_usb_msg.h \ ow_visibility.h \ ow_w1.h \ ow_w1_seq.h \ rwlock.h \ netlink.h \ w1_netlink.h \ sem.h \ telnet.h clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owlib/src/include/ow_parse_sn.h0000644000175000017500000000345511740167566017137 00000000000000/* $Id: ow_parse_sn.h,v 1.2 2012/04/08 01:52:54 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 \ LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, // --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ /* Cannot stand alone -- part of ow.h but separated for clarity */ #ifndef OW_PARSE_SN_H /* tedious wrapper */ #define OW_PARSE_SN_H enum parse_serialnumber { sn_valid, sn_invalid, sn_not_sn, } ; enum parse_serialnumber Parse_SerialNumber(char *sn_char, BYTE * sn) ; #endif /* OW_PARSE_SN_H */ owfs-2.8p15/module/owlib/src/include/compat.h0000664000175000017500000001133210750074144016063 00000000000000/* $Id: compat.h,v 1.10 2008/01/30 13:15:16 d1mag Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- */ #ifndef COMPAT_H #define COMPAT_H #include #include "owfs_config.h" #ifdef HAVE_FEATURES_H #include #endif #include "compat_netdb.h" #include "compat_getopt.h" #ifndef HAVE_STRSEP char *strsep(char **stringp, const char *delim); #endif #if defined(__UCLIBC__) #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) <= 0x000913) #undef HAVE_TDESTROY #else /* Older than 0.9.19 */ #define HAVE_TDESTROY 1 #endif /* Older than 0.9.19 */ #else #endif /* __UCLIBC__ */ #ifndef HAVE_TDESTROY void tdestroy(void *vroot, void (*freefct) (void *)); #endif #ifndef __COMPAR_FN_T # define __COMPAR_FN_T typedef int (*__compar_fn_t) (__const void *, __const void *); #endif #ifndef HAVE_TSEARCH void *tsearch(__const void *__key, void **__rootp, __compar_fn_t __compar); #endif #ifndef HAVE_TFIND void *tfind(__const void *__key, void *__const * __rootp, __compar_fn_t __compar); #endif #ifndef HAVE_TDELETE void *tdelete(__const void *__restrict __key, void **__restrict __rootp, __compar_fn_t __compar); #endif #if defined(_SEARCH_H) || defined(_SEARCH_H_) /* VISIT is always defined in search.h on MacOSX. */ #else typedef enum { preorder, postorder, endorder, leaf } VISIT; #endif /* SEARCH_H */ #ifndef __ACTION_FN_T # define __ACTION_FN_T typedef void (*__action_fn_t) (__const void *__nodep, VISIT __value, int __level); #endif #ifndef HAVE_TWALK void twalk(__const void *__root, __action_fn_t __action); #endif #ifdef __UCLIBC__ #if defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) && defined(__UCLIBC_SUBLEVEL__) #if ((__UCLIBC_MAJOR__<<16) + (__UCLIBC_MINOR__<<8) + (__UCLIBC_SUBLEVEL__)) <= 0x000913 /* Since syslog will hang forever with uClibc-0.9.19 if syslogd is not * running, then we don't use it unless we really wants it * WRT45G usually have syslogd running. uClinux-dist might not have it. */ #ifndef USE_SYSLOG #define syslog(a,...) { /* ignore_syslog */ } #define openlog(a,...) { /* ignore_openlog */ } #define closelog() { /* ignore_closelog */ } #endif #endif /* __UCLIBC__ */ #endif /* __UCLIBC__ */ #endif /* __UCLIBC__ */ #endif owfs-2.8p15/module/owlib/src/include/ow_2405.h0000664000175000017500000000104411310575610015673 00000000000000/* $Id: ow_2405.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2405_H #define OW_2405_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2405); #endif owfs-2.8p15/module/owlib/src/include/ow_1963.h0000664000175000017500000000107411310575610015706 00000000000000/* $Id: ow_1963.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1963_H #define OW_1963_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1963S); DeviceHeader(DS1963L); #endif owfs-2.8p15/module/owlib/src/include/ow_localreturns.h0000664000175000017500000000256111547216310020024 00000000000000/* $Id: ow_localreturns.h,v 1.13 2011/04/07 02:09:12 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" */ #ifndef OW_LOCALRETURNS_H /* tedious wrapper */ #define OW_LOCALRETURNS_H typedef int SIZE_OR_ERROR ; typedef int ZERO_OR_ERROR ; typedef enum { gbGOOD, gbBAD, gbOTHER, } GOOD_OR_BAD ; // OTHER breaks the encapsulation a bit. #define GOOD(x) ((x)==gbGOOD) #define BAD(x) ((x)!=gbGOOD) #define GB_to_Z_OR_E(x) GOOD(x)?0:-EINVAL #define RETURN_BAD_IF_BAD(x) if ( BAD(x) ) { return gbBAD; } #define RETURN_GOOD_IF_GOOD(x) if (GOOD(x) ) { return gbGOOD; } #define RETURN_ERROR_IF_BAD(x) if ( BAD(x) ) { return -EINVAL; } /* Use this every place we call a void * function (unless the return value is really used). */ #define VOID_RETURN NULL #endif /* OW_LOCALRETURNS_H */ owfs-2.8p15/module/owlib/src/include/ow_1991.h0000664000175000017500000000107211310575610015705 00000000000000/* $Id: ow_1991.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_1991_H #define OW_1991_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS1991); DeviceHeader(DS1425); #endif owfs-2.8p15/module/owlib/src/include/ow_2505.h0000664000175000017500000000115011310575610015672 00000000000000/* $Id: ow_2505.h,v 1.5 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_2505_H #define OW_2505_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* ------- Structures ----------- */ DeviceHeader(DS2505); DeviceHeader(DS1985U); DeviceHeader(DS2506); DeviceHeader(DS1986U); #endif owfs-2.8p15/module/owlib/src/include/ow_parsedname.h0000644000175000017500000001723711737723155017445 00000000000000/* $Id: ow_parsedname.h,v 1.46 2012/04/07 02:29:01 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille */ #ifndef OW_PARSEDNAME_H /* tedious wrapper */ #define OW_PARSEDNAME_H /* Define our understanding of integers, floats, ... */ #include "ow_localtypes.h" /* predeclare some structures */ struct connection_in; struct device; struct filetype; struct devloc ; /* Maximum length of a file or directory name, and extension */ #define OW_NAME_MAX (32) #define OW_EXT_MAX (6) #define OW_FULLNAME_MAX (OW_NAME_MAX+OW_EXT_MAX) #define OW_DEFAULT_LENGTH (128) /* Parsedname -- path converted into components */ /* Parsed name is the primary structure interpreting a owfs systrem call. It is the interpretation of the owfs file name, or the owhttpd URL. It contains everything but the operation requested. The operation (read, write or directory is in the extended URL or the actual callback function requested). */ /* Parsed name has several components: sn is the serial number of the device dev and ft are pointers to device and filetype members corresponding to the element ds2409_hubs and ds2409_depth interpret the route through DS2409 branch controllers filetype and extension correspond to property (filetype) details subdir points to in-device groupings */ #define NO_PARSEDNAME NULL #define NO_PATH NULL /* LocalControlFlags information (for remote control) */ /* bit0: cacheenabled bit1: return bus-list */ /* presencecheck */ /* tempscale */ /* device format */ extern int32_t LocalControlFlags; // flag to pn->selected_connection->branch.branch to force select from root dir enum eBranch { eBranch_bad = 0xFF, eBranch_main = 0x00, eBranch_aux = 0x01, }; struct ds2409_hubs { BYTE sn[SERIAL_NUMBER_SIZE]; BYTE branch; }; #define EXTENSION_BYTE -2 #define EXTENSION_ALL -1 #define EXTENSION_ALL_SEPARATE -1 #define EXTENSION_ALL_MIXED -1 #define EXTENSION_ALL_AGGREGATE -1 #define NO_FILETYPE NULL #define NO_SUBDIR NULL #define NO_DEVICE NULL enum ePN_type { ePN_root, ePN_real, ePN_statistics, ePN_system, ePN_settings, ePN_structure, ePN_interface, ePN_max_type, }; extern char *ePN_name[]; // must match ePN_type enum ePS_state { ePS_normal = 0x0000, ePS_uncached = 0x0001, ePS_alarm = 0x0002, ePS_text = 0x0004, ePS_bus = 0x0008, ePS_buslocal = 0x0010, ePS_busanylocal = 0x0020, ePS_busremote = 0x0040, ePS_busveryremote = 0x0080, ePS_reconnection = 0x0100, ePS_unaliased = 0x0200, ePS_json = 0x0400, }; struct parsedname { char path[2*PATH_MAX+2]; // full device name char path_to_server[PATH_MAX+2]; // path without first bus char * device_name ; // for external name struct connection_in *known_bus; // where this device is located enum ePN_type type; // real? settings? ... enum ePS_state state; // alarm? BYTE sn[SERIAL_NUMBER_SIZE]; // 64-bit serial number struct device *selected_device; // 1-wire device struct filetype *selected_filetype; // device property int extension; // numerical extension (for array values) or -1 char * sparse_name; // text extension for a spare array value struct filetype *subdir; // in-device grouping int dirlength ; // Length of just directory part of path UINT ds2409_depth; // DS2409 branching depth struct ds2409_hubs *bp; // DS2409 branching route struct connection_in *selected_connection; // which bus is assigned to this item uint32_t control_flags; // more state info, packed for network transmission struct devlock *lock; // pointer to a device-specific lock int return_code ; // return (error) code int tokens; // for anti-loop work BYTE *tokenstring; // List of tokens from owservers passed }; /* ---- end Parsedname ----------------- */ #define SHOULD_RETURN_BUS_LIST ( (UINT) 0x00000002 ) #define PERSISTENT_MASK ( (UINT) 0x00000004 ) #define PERSISTENT_BIT 2 #define ALIAS_REQUEST ( (UINT) 0x00000008 ) #define SAFEMODE ( (UINT) 0x00000010 ) #define UNCACHED ( (UINT) 0x00000020 ) #define OWNET ( (UINT) 0x00000100 ) #define TEMPSCALE_MASK ( (UINT) 0x00030000 ) #define TEMPSCALE_BIT 16 #define PRESSURESCALE_MASK ( (UINT) 0x001C0000 ) #define PRESSURESCALE_BIT 18 #define DEVFORMAT_MASK ( (UINT) 0xFF000000 ) #define DEVFORMAT_BIT 24 #define IsPersistent(ppn) ( ((ppn)->control_flags & PERSISTENT_MASK) ) #define SetPersistent(ppn,b) UT_Setbit(((ppn)->control_flags),PERSISTENT_BIT,(b)) #define TemperatureScale(ppn) ( (enum temp_type) (((ppn)->control_flags & TEMPSCALE_MASK) >> TEMPSCALE_BIT) ) #define PressureScale(ppn) ( (enum pressure_type) (((ppn)->control_flags & PRESSURESCALE_MASK) >> PRESSURESCALE_BIT) ) #define SGTemperatureScale(sg) ( (enum temp_type)(((sg) & TEMPSCALE_MASK) >> TEMPSCALE_BIT) ) #define SGPressureScale(sg) ( (enum pressure_type)(((sg) & PRESSURESCALE_MASK) >> PRESSURESCALE_BIT) ) #define DeviceFormat(ppn) ( (enum deviceformat) (((ppn)->control_flags & DEVFORMAT_MASK) >> DEVFORMAT_BIT) ) #define IsDir( pn ) ( ((pn)->selected_device)==NO_DEVICE \ || ((pn)->selected_filetype)==NO_FILETYPE \ || ((pn)->selected_filetype)->format==ft_subdir \ || ((pn)->selected_filetype)->format==ft_directory ) #define NotUncachedDir(pn) ( (((pn)->state)&ePS_uncached) == 0 ) #define IsUncachedDir(pn) ( ! NotUncachedDir(pn) ) #define IsStructureDir(pn) ( ((pn)->type) == ePN_structure ) #define IsInterfaceDir(pn) ( ((pn)->type) == ePN_interface ) #define NotAlarmDir(pn) ( (((pn)->state)&ePS_alarm) == 0 ) #define IsAlarmDir(pn) ( ! NotAlarmDir(pn) ) #define NotRealDir(pn) ( ((pn)->type) != ePN_real ) #define IsRealDir(pn) ( ((pn)->type) == ePN_real ) #define NotReconnect(pn) ( (((pn)->state)&ePS_reconnection) == 0 ) #define ClearReconnect(pn) do { ((pn)->state)&=~ePS_reconnection; } while(0) #define SetReconnect(pn) do { ((pn)->state)|=ePS_reconnection; } while(0) #define InSafeMode(pn) ( (((pn)->control_flags) & SAFEMODE ) != 0 ) #define KnownBus(pn) ((((pn)->state) & ePS_bus) != 0 ) #define UnsetKnownBus(pn) do { (pn)->state &= ~ePS_bus; \ (pn)->known_bus=NULL; \ (pn)->selected_connection=NO_CONNECTION; \ } while(0) #define ShouldReturnBusList(ppn) ( ((ppn)->control_flags & SHOULD_RETURN_BUS_LIST) ) #define SpecifiedVeryRemoteBus(pn) ((((pn)->state) & ePS_busveryremote) != 0 ) #define SpecifiedRemoteBus(pn) ((((pn)->state) & ePS_busremote) != 0 ) #define SpecifiedLocalBus(pn) ((((pn)->state) & ePS_buslocal) != 0 ) #define SpecifiedBus(pn) ( SpecifiedLocalBus(pn) || SpecifiedRemoteBus(pn) ) #define RootNotBranch(pn) (((pn)->ds2409_depth)==0) enum parse_enum { parse_first, parse_done, parse_error, parse_real, parse_branch, parse_nonreal, parse_prop, parse_subprop }; #endif /* OW_PARSEDNAME_H */ owfs-2.8p15/module/owlib/src/include/ow_1820.h0000664000175000017500000000207311310575610015676 00000000000000/* $Id: ow_1820.h,v 1.8 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor LICENSE (As of version 2.5p4 2-Oct-2006) owlib: LGPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): LGPL v2 owperl: GPL v2 owtcl: GPL v2 or later at your discretion owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" */ #ifndef OW_1820_H #define OW_1820_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(DS18S20); DeviceHeader(DS18B20); DeviceHeader(DS1822); DeviceHeader(DS1825); DeviceHeader(DS28EA00); #endif owfs-2.8p15/module/owlib/src/include/ow_interface.h0000664000175000017500000000121111310575610017235 00000000000000/* $Id: ow_interface.h,v 1.3 2009/12/12 02:10:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #ifndef OW_INTERFACE_H #define OW_INTERFACE_H #ifndef OWFS_CONFIG_H #error Please make sure owfs_config.h is included *before* this header file #endif #include "ow_standard.h" /* -------- Structures ---------- */ DeviceHeader(interface_settings); DeviceHeader(interface_statistics); #endif /* OW_INTERFACE_H */ owfs-2.8p15/module/owlib/src/include/telnet.h0000664000175000017500000001342711506505132016076 00000000000000/* $Id: telnet.h,v 1.1 2010/12/29 01:09:46 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 */ #ifndef OW_TELNET_H /* tedious wrapper */ #define OW_TELNET_H // Defnitions for telnet protocol // Mostly lifted from arpa/telnet.h // Added RFC2217 COM PORT CONTROL /* * Definitions for the TELNET protocol. */ // added TELNET_ prefix #define TELNET_IAC 255 /* interpret as command: */ #define TELNET_DONT 254 /* you are not to use option */ #define TELNET_DO 253 /* please, you use option */ #define TELNET_WONT 252 /* I won't use option */ #define TELNET_WILL 251 /* I will use option */ #define TELNET_SB 250 /* interpret as subnegotiation */ #define TELNET_GA 249 /* you may reverse the line */ #define TELNET_EL 248 /* erase the current line */ #define TELNET_EC 247 /* erase the current character */ #define TELNET_AYT 246 /* are you there */ #define TELNET_AO 245 /* abort output--but let prog finish */ #define TELNET_IP 244 /* interrupt process--permanently */ #define TELNET_BREAK 243 /* break */ #define TELNET_DM 242 /* data mark--for connect. cleaning */ #define TELNET_NOP 241 /* nop */ #define TELNET_SE 240 /* end sub negotiation */ #define TELNET_EOR 239 /* end of record (transparent mode) */ #define TELNET_ABORT 238 /* Abort process */ #define TELNET_SUSP 237 /* Suspend process */ #define TELNET_EOF 236 /* End of file: EOF is already used... */ #define TELNET_SYNCH 242 /* for telfunc calls */ /* telnet options */ #define TELOPT_BINARY 0 /* 8-bit data path */ #define TELOPT_ECHO 1 /* echo */ #define TELOPT_RCP 2 /* prepare to reconnect */ #define TELOPT_SGA 3 /* suppress go ahead */ #define TELOPT_NAMS 4 /* approximate message size */ #define TELOPT_STATUS 5 /* give status */ #define TELOPT_TM 6 /* timing mark */ #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ #define TELOPT_NAOL 8 /* negotiate about output line width */ #define TELOPT_NAOP 9 /* negotiate about output page size */ #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ #define TELOPT_XASCII 17 /* extended ascii character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ #define TELOPT_SUPDUP 21 /* supdup protocol */ #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ #define TELOPT_SNDLOC 23 /* send location */ #define TELOPT_TTYPE 24 /* terminal type */ #define TELOPT_EOR 25 /* end or record */ #define TELOPT_TUID 26 /* TACACS user identification */ #define TELOPT_OUTMRK 27 /* output marking */ #define TELOPT_TTYLOC 28 /* terminal location number */ #define TELOPT_3270REGIME 29 /* 3270 regime */ #define TELOPT_X3PAD 30 /* X.3 PAD */ #define TELOPT_NAWS 31 /* window size */ #define TELOPT_TSPEED 32 /* terminal speed */ #define TELOPT_LFLOW 33 /* remote flow control */ #define TELOPT_LINEMODE 34 /* Linemode option */ #define TELOPT_XDISPLOC 35 /* X Display Location */ #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ #define TELOPT_AUTHENTICATION 37/* Authenticate */ #define TELOPT_ENCRYPT 38 /* Encryption option */ #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ // Add RFC2217 serial port setup #define TELOPT_COM_PORT 44 /* RFC 2217 Com port control */ #define TELOPT_EXOPL 255 /* extended-options-list */ // From RFC2217 Options #define COMOPT_BAUDRATE 1 #define COMOPT_DATASIZE 2 #define COMOPT_PARITY 3 #define COMOPT_STOPSIZE 4 #define COMOPT_CONTROL 5 #define COMOPT_LINESTATE 6 #define COMOPT_MODEMSTATE 7 #define COMOPT_SUSPEND 8 #define COMOPT_RESUME 9 #define COMOPT_LINEMASK 10 #define COMOPT_MODEMMASK 11 #define COMOPT_PURGE 12 /* sub-option qualifiers */ #define TELQUAL_IS 0 /* option is... */ #define TELQUAL_SEND 1 /* send option */ #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ #define LFLOW_OFF 0 /* Disable remote flow control */ #define LFLOW_ON 1 /* Enable remote flow control */ #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ /* * LINEMODE suboptions */ #define LM_MODE 1 #define LM_FORWARDMASK 2 #define LM_SLC 3 #define MODE_EDIT 0x01 #define MODE_TRAPSIG 0x02 #define MODE_ACK 0x04 #define MODE_SOFT_TAB 0x08 #define MODE_LIT_ECHO 0x10 #define MODE_MASK 0x1f /* Not part of protocol, but needed to simplify things... */ #define MODE_FLOW 0x0100 #define MODE_ECHO 0x0200 #define MODE_INBIN 0x0400 #define MODE_OUTBIN 0x0800 #define MODE_FORCE 0x1000 #define SLC_SYNCH 1 #define SLC_BRK 2 #define SLC_IP 3 #define SLC_AO 4 #define SLC_AYT 5 #define SLC_EOR 6 #define SLC_ABORT 7 #define SLC_EOF 8 #define SLC_SUSP 9 #define SLC_EC 10 #define SLC_EL 11 #define SLC_EW 12 #define SLC_RP 13 #define SLC_LNEXT 14 #define SLC_XON 15 #define SLC_XOFF 16 #define SLC_FORW1 17 #define SLC_FORW2 18 #define NSLC 18 #define SLC_NOSUPPORT 0 #define SLC_CANTCHANGE 1 #define SLC_VARIABLE 2 #define SLC_DEFAULT 3 #define SLC_LEVELBITS 0x03 #define SLC_FUNC 0 #define SLC_FLAGS 1 #define SLC_VALUE 2 #define SLC_ACK 0x80 #define SLC_FLUSHIN 0x40 #define SLC_FLUSHOUT 0x20 #define OLD_ENV_VAR 1 #define OLD_ENV_VALUE 0 #define NEW_ENV_VAR 0 #define NEW_ENV_VALUE 1 #define ENV_ESC 2 #define ENV_USERVAR 3 #endif /* OW_TELNET_H */ owfs-2.8p15/module/owlib/src/include/ow_external.h0000644000175000017500000000447211741156523017137 00000000000000/* $Id: ow_external.h,v 1.12 2012/04/11 01:24:35 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_EXTERNAL_H /* tedious wrapper */ #define OW_EXTERNAL_H #include "ow_device.h" #include "ow_filetype.h" enum external_type { et_none, et_internal, et_script, et_tcp, et_udp, } ; struct sensor_node { char * name ; char * family ; char * description ; char * data ; char payload[0] ; } ; struct property_node { char * property ; char * family ; char * read ; char * write ; char * data ; char * other ; enum external_type et ; struct filetype ft ; struct aggregate ag ; char payload[0] ; } ; struct family_node { struct device dev ; // Must be first since this is actual entry in device tree. char * family ; char payload[0] ; } ; extern void * property_tree ; extern void * family_tree ; extern void * sensor_tree ; void AddSensor( char * input_string ) ; void AddProperty( char * input_string, enum external_type et ) ; struct sensor_node * Find_External_Sensor( char * sensor ) ; struct family_node * Find_External_Family( char * family ) ; struct property_node * Find_External_Property( char * family, char * property ) ; int sensor_compare( const void * a , const void * b ) ; int family_compare( const void * a , const void * b ) ; int property_compare( const void * a , const void * b ) ; #endif /* OW_EXTERNAL_H */ owfs-2.8p15/module/owlib/src/include/ow_bus_routines.h0000664000175000017500000001607211501267164020035 00000000000000/* $Id: ow_bus_routines.h,v 1.6 2010/12/13 00:53:08 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- */ #ifndef OW_BUS_ROUTINES_H /* tedious wrapper */ #define OW_BUS_ROUTINES_H /* -------------------------------------------- */ /* Interface-specific routines ---------------- */ struct interface_routines { /* Detect if adapter is present, and open -- usually called outside of this routine */ GOOD_OR_BAD (*detect) (struct connection_in * in); /* reset the interface -- actually the 1-wire bus */ RESET_TYPE (*reset) (const struct parsedname * pn); /* Bulk of search routine, after set ups for first or alarm or family */ enum search_status (*next_both) (struct device_search * ds, const struct parsedname * pn); /* Send a byte with bus power to follow */ GOOD_OR_BAD (*PowerByte) (const BYTE data, BYTE * resp, const UINT delay, const struct parsedname * pn); /* Send a bit with bus power to follow */ GOOD_OR_BAD (*PowerBit) (const BYTE data, BYTE * resp, const UINT delay, const struct parsedname * pn); /* Send a 12V 480msec oulse to program EEPROM */ GOOD_OR_BAD (*ProgramPulse) (const struct parsedname * pn); /* send and recieve data -- byte at a time */ GOOD_OR_BAD (*sendback_data) (const BYTE * data, BYTE * resp, const size_t len, const struct parsedname * pn); /* send and recieve data -- byte at a time */ GOOD_OR_BAD (*select_and_sendback) (const BYTE * data, BYTE * resp, const size_t len, const struct parsedname * pn); /* send and recieve data -- bit at a time */ GOOD_OR_BAD (*sendback_bits) (const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn); /* select a device */ GOOD_OR_BAD (*select) (const struct parsedname * pn); /* reconnect with a balky device */ GOOD_OR_BAD (*reconnect) (const struct parsedname * pn); /* Close the connection (port) */ void (*close) (struct connection_in * in); /* capabilities flags */ UINT flags; }; #define NO_DETECT_ROUTINE NULL #define NO_RESET_ROUTINE NULL #define NO_NEXT_BOTH_ROUTINE NULL #define NO_POWERBYTE_ROUTINE NULL #define NO_POWERBIT_ROUTINE NULL #define NO_PROGRAMPULSE_ROUTINE NULL #define NO_SENDBACKDATA_ROUTINE NULL #define NO_SELECTANDSENDBACK_ROUTINE NULL #define NO_SENDBACKBITS_ROUTINE NULL #define NO_SELECT_ROUTINE NULL #define NO_RECONNECT_ROUTINE NULL #define NO_CLOSE_ROUTINE NULL /* placed in iroutines.flags */ // Adapter is usable #define ADAP_FLAG_default 0x00000000 // Adapter supports overdrive mode #define ADAP_FLAG_overdrive 0x00000001 // Adapter doesn't support the DS2409 microlan hub #define ADAP_FLAG_no2409path 0x00000010 // Adapter doesn't need DS2404 delay (i.e. not a local device) #define ADAP_FLAG_no2404delay 0x00000020 // Adapter gets a directory all at once rather than one at a time #define ADAP_FLAG_dirgulp 0x00000100 // Adapter benefits from coalescing reads and writes into a longer string #define ADAP_FLAG_bundle 0x00001000 // Adapter automatically performs a reset before read/writes #define ADAP_FLAG_dir_auto_reset 0x00002000 // Adapter doesn't support "presence" -- use the last dirblob instead. #define ADAP_FLAG_presence_from_dirblob 0x00004000 // Adapter is a sham. #define ADAP_FLAG_sham 0x00008000 #define AdapterSupports2409(pn) (((pn)->selected_connection->iroutines.flags&ADAP_FLAG_no2409path)==0) GOOD_OR_BAD BUS_detect( struct connection_in * in ) ; RESET_TYPE BUS_reset(const struct parsedname *pn); GOOD_OR_BAD BUS_select(const struct parsedname *pn); GOOD_OR_BAD BUS_select_and_sendback(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_sendback_bits( const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn ); GOOD_OR_BAD BUS_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_sendback_cmd(const BYTE * cmd, BYTE * resp, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_send_data(const BYTE * data, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_send_bits(const BYTE * data, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_readin_data(BYTE * data, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_readin_bits(BYTE * data, const size_t len, const struct parsedname *pn); GOOD_OR_BAD BUS_verify(BYTE search, const struct parsedname *pn); GOOD_OR_BAD BUS_compare_bits(const BYTE * data1, const BYTE * data2, const size_t len); GOOD_OR_BAD BUS_PowerByte(const BYTE data, BYTE * resp, UINT delay, const struct parsedname *pn); GOOD_OR_BAD BUS_PowerBit(const BYTE data, BYTE * resp, UINT delay, const struct parsedname *pn); GOOD_OR_BAD BUS_ProgramPulse(const struct parsedname *pn); void BUS_close( struct connection_in * in ); #endif /* OW_BUS_ROUTINES_H */ owfs-2.8p15/module/owlib/src/include/ow_master.h0000644000175000017500000001335511705422410016577 00000000000000/* $Id: ow_master.h,v 1.19 2012/01/18 01:48:56 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef OW_MASTER_H /* tedious wrapper */ #define OW_MASTER_H /* included in ow_connection.h as the bus-master specific portion of the connection_in structure */ enum ds2480b_mode { ds2480b_data_mode, ds2480b_command_mode, } ; struct master_tcp { // char *host; // char *service; // struct addrinfo *ai; // struct addrinfo *ai_ok; char *type; // for zeroconf char *domain; // for zeroconf char *name; // zeroconf name int no_dirall; // flag that server doesn't support DIRALL // telnet tuning int CRLF_size ; }; struct master_serial { struct master_tcp tcp; // mirror master.server enum ds2480b_mode mode ; int reverse_polarity ; }; struct master_fake { int index; _FLOAT templow; _FLOAT temphigh; // For adapters that maintain dir-at-once (or dirgulp): struct dirblob main; /* main directory */ struct dirblob alarm; /* alarm directory */ }; struct master_usb { #if OW_USB struct usb_device *dev; struct usb_dev_handle *usb; int usb_bus_number; int usb_dev_number; int datasampleoffset; int writeonelowtime; int pulldownslewrate; int timeout; #endif /* OW_USB */ int specific_usb_address ; // only a specific address requested? /* "Name" of the device, like "8146572300000051" * This is set to the first DS1420 id found on the 1-wire adapter which * exists on the DS9490 adapters. If user only have a DS2490 chip, there * are no such DS1420 device available. It's used to find the 1-wire adapter * if it's disconnected and later reconnected again. */ BYTE ds1420_address[SERIAL_NUMBER_SIZE]; }; struct master_i2c { int channels; int index; int i2c_address; int i2c_index ; BYTE configreg; BYTE configchip; /* only one per chip, the bus entries for the other 7 channels point to the first one */ pthread_mutex_t all_channel_lock; // second level mutex for the entire chip */ int current; struct connection_in *head; struct connection_in *next; }; struct master_ha7 { struct master_tcp tcp; // mirror master.server ASCII lock[10]; int locked; int found; }; struct master_etherweather { struct master_tcp tcp; }; enum e_link_t_mode { e_link_t_unknown, e_link_t_extra, e_link_t_none } ; struct master_link { struct master_tcp tcp; // mirror master.server enum e_link_t_mode tmode ; // extra ',' before tF0 command enum e_link_t_mode qmode ; //extra '?' after b command }; struct master_enet { struct master_tcp tcp; // mirror master.server enum e_link_t_mode tmode ; // extra ',' before tF0 command enum e_link_t_mode qmode ; //extra '?' after b command unsigned char sn[SERIAL_NUMBER_SIZE] ; /* last address */ char channel ; // for the new ENET3 -- use '0' for old single channel version pthread_mutex_t all_channel_lock; // second level mutex for the entire chip */ struct connection_in *head; struct timeval expired ; // timestamp when socket is known timed out int reopening ; // to avoid infinite recursion }; struct master_ha7e { unsigned char sn[SERIAL_NUMBER_SIZE] ; /* last address */ }; struct master_ha5 { unsigned char sn[SERIAL_NUMBER_SIZE] ; /* last address */ int checksum ; /* flag to use checksum byte in communication */ char channel ; pthread_mutex_t all_channel_lock; // second level mutex for the entire chip */ struct connection_in *head; }; struct master_w1 { #if OW_W1 // bus master name kept in name SEQ_OR_ERROR seq ; int id ; // equivalent to the number part of w1_bus_master23 FILE_DESCRIPTOR_OR_ERROR netlink_pipe[2] ; enum enum_w1_slave_order { w1_slave_order_unknown, w1_slave_order_forward, w1_slave_order_reversed } w1_slave_order ; #endif /* OW_W1 */ }; struct master_w1_monitor { #if OW_W1 // netlink fd kept in file_descriptor SEQ_OR_ERROR seq ; // seq number to netlink pid_t pid ; struct timeval last_read ; pthread_mutex_t seq_mutex; // mutex for w1 sequence number */ pthread_mutex_t read_mutex; // mutex for w1 netlink read time #endif /* OW_W1 */ }; struct master_usb_monitor { FILE_DESCRIPTOR_OR_ERROR shutdown_pipe[2] ; }; struct master_browse { #if OW_ZERO DNSServiceRef bonjour_browse; #if !OW_CYGWIN AvahiServiceBrowser *avahi_browser ; AvahiSimplePoll *avahi_poll ; AvahiClient *avahi_client ; #if __HAS_IPV6__ char avahi_host[INET6_ADDRSTRLEN+1] ; #else char avahi_host[INET_ADDRSTRLEN+1] ; #endif char avahi_service[10] ; #endif /* OW_CYGWIN */ #endif /* OW_ZERO */ }; union master_union { struct master_serial serial; struct master_link link; struct master_tcp tcp; struct master_usb usb; struct master_i2c i2c; struct master_fake fake; struct master_fake tester; struct master_fake mock; struct master_ha5 ha5; struct master_ha7 ha7; struct master_ha7e ha7e ; struct master_enet enet ; struct master_etherweather etherweather; struct master_w1 w1; struct master_w1_monitor w1_monitor ; struct master_browse browse; struct master_usb_monitor usb_monitor ; }; #endif /* OW_MASTER_H */ owfs-2.8p15/module/owlib/src/include/ow_reset.h0000664000175000017500000000651111371330656016435 00000000000000/* $Id: ow_reset.h,v 1.3 2010/05/08 18:47:10 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions LICENSE (As of version 2.5p4 2-Oct-2006) owlib: GPL v2 owfs, owhttpd, owftpd, owserver: GPL v2 owshell(owdir owread owwrite owpresent): GPL v2 owcapi (libowcapi): GPL v2 owperl: GPL v2 owtcl: LGPL v2 owphp: GPL v2 owpython: GPL v2 owsim.tcl: GPL v2 where GPL v2 is the "Gnu General License version 2" and "LGPL v2" is the "Lesser Gnu General License version 2" Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #ifndef OW_RESET_H /* tedious wrapper */ #define OW_RESET_H typedef int RESET_TYPE ; #define BUS_RESET_OK 0 #define BUS_RESET_SHORT 1 #define BUS_RESET_ERROR -EINVAL #define gbRESET( r ) ( ( (r) < BUS_RESET_OK ) ? gbBAD : gbGOOD ) #endif /* OW_RESET_H */ owfs-2.8p15/module/owlib/src/c/0000775000175000017500000000000011756315510013310 500000000000000owfs-2.8p15/module/owlib/src/c/ow_com.c0000644000175000017500000000443411664034553014665 00000000000000/* $Id: ow_com.c,v 1.54 2011/11/26 00:57:15 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif GOOD_OR_BAD COM_test( struct connection_in * connection ) { if (connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to open a NULL serial device"); return gbBAD; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return gbBAD ; case ct_netlink: case ct_telnet: case ct_tcp: break ; case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented!!!"); return gbBAD ; case ct_serial: break ; } if ( SOC(connection)->state == cs_virgin ) { LEVEL_DEBUG("Auto initialization of %s", SAFESTRING(SOC(connection)->devicename)) ; } else if ( FILE_DESCRIPTOR_VALID( SOC(connection)->file_descriptor ) ) { return gbGOOD ; } return COM_open(connection) ; } void COM_flush( const struct connection_in *connection) { if (connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to flush a NULL device"); return ; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return ; case ct_netlink: case ct_telnet: case ct_tcp: tcp_read_flush( SOC(connection)->file_descriptor) ; break ; case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented!!!"); return ; case ct_serial: tcflush( SOC(connection)->file_descriptor, TCIOFLUSH); break ; } } void COM_break(struct connection_in *in) { if (in == NO_CONNECTION) { LEVEL_DEBUG("Attempt to break a NULL device"); return ; } if ( BAD( COM_test(in) ) ) { return ; } switch ( SOC(in)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return ; case ct_telnet: telnet_break(in) ; break ; case ct_tcp: case ct_netlink: case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented!!!"); return ; case ct_serial: tcsendbreak(SOC(in)->file_descriptor, 0); break ; } } owfs-2.8p15/module/owlib/src/c/ow_2401.c0000644000175000017500000000333111654105673014471 00000000000000/* $Id: ow_2401.c,v 1.9 2011/11/02 00:15:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* DS2401 Simple ID device */ /* Also needed for all others */ /* ------- Prototypes ----------- */ /* All from ow_xxxx.c file */ #include #include "owfs_config.h" #include "ow_2401.h" /* ------- Structures ----------- */ static struct filetype DS2401[] = { F_STANDARD, }; DeviceEntry(01, DS2401, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1420[] = { F_STANDARD, }; DeviceEntry(81, DS1420, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ owfs-2.8p15/module/owlib/src/c/ow_ds2482.c0000644000175000017500000006662111740305477015044 00000000000000/* $Id: ow_ds2482.c,v 1.104 2012/04/08 12:57:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* i2c support for the DS2482-100 and DS2482-800 1-wire host adapters */ /* Stolen shamelessly from Ben Gardners kernel module */ /* Actually, Dallas datasheet has the information, the module code showed a nice implementation, the eventual format is owfs-specific (using similar primatives, data structures) Testing by Jan Kandziora and Daniel Höper. */ /** * ds2482.c - provides i2c to w1-master bridge(s) * Copyright (C) 2005 Ben Gardner * * The DS2482 is a sensor chip made by Dallas Semiconductor (Maxim). * It is a I2C to 1-wire bridge. * There are two variations: -100 and -800, which have 1 or 8 1-wire ports. * The complete datasheet can be obtained from MAXIM's website at: * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382 * * 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; version 2 of the License. * * MODULE_AUTHOR("Ben Gardner "); * MODULE_DESCRIPTION("DS2482 driver"); * MODULE_LICENSE("GPL"); */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #if OW_I2C // Header taken from lm-sensors code // specifically lm-sensors-2.10.0 #include "i2c-dev.h" enum ds2482_address { ds2482_any=-2, ds2482_all=-1, ds2482_18, ds2482_19, ds2482_1A, ds2482_1B, ds2482_1C, ds2482_1D, ds2482_1E, ds2482_1F, ds2482_too_far } ; static GOOD_OR_BAD DS2482_detect_bus(enum ds2482_address chip_num, char * i2c_device, struct connection_in *in) ; static GOOD_OR_BAD DS2482_detect_sys( int any, enum ds2482_address chip_num, struct connection_in *in) ; static GOOD_OR_BAD DS2482_detect_dir( int any, enum ds2482_address chip_num, struct connection_in *in) ; static GOOD_OR_BAD DS2482_detect_single(int lowindex, int highindex, char * i2c_device, struct connection_in *in) ; static enum search_status DS2482_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD DS2482_triple(BYTE * bits, int direction, FILE_DESCRIPTOR_OR_ERROR file_descriptor); static GOOD_OR_BAD DS2482_send_and_get(FILE_DESCRIPTOR_OR_ERROR file_descriptor, const BYTE wr, BYTE * rd); static RESET_TYPE DS2482_reset(const struct parsedname *pn); static GOOD_OR_BAD DS2482_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void DS2482_setroutines(struct connection_in *in); static GOOD_OR_BAD HeadChannel(struct connection_in *head); static GOOD_OR_BAD CreateChannels(struct connection_in *head); static GOOD_OR_BAD DS2482_channel_select(struct connection_in * in); static GOOD_OR_BAD DS2482_readstatus(BYTE * c, FILE_DESCRIPTOR_OR_ERROR file_descriptor, unsigned long int min_usec, unsigned long int max_usec); static GOOD_OR_BAD SetConfiguration(BYTE c, struct connection_in *in); static void DS2482_close(struct connection_in *in); static GOOD_OR_BAD DS2482_redetect(const struct parsedname *pn); static GOOD_OR_BAD DS2482_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn); /** * The DS2482 registers - there are 3 registers that are addressed by a read * pointer. The read pointer is set by the last command executed. * * To read the data, issue a register read for any address */ #define DS2482_CMD_RESET 0xF0 /* No param */ #define DS2482_CMD_SET_READ_PTR 0xE1 /* Param: DS2482_PTR_CODE_xxx */ #define DS2482_CMD_CHANNEL_SELECT 0xC3 /* Param: Channel byte - DS2482-800 only */ #define DS2482_CMD_WRITE_CONFIG 0xD2 /* Param: Config byte */ #define DS2482_CMD_1WIRE_RESET 0xB4 /* Param: None */ #define DS2482_CMD_1WIRE_SINGLE_BIT 0x87 /* Param: Bit byte (bit7) */ #define DS2482_CMD_1WIRE_WRITE_BYTE 0xA5 /* Param: Data byte */ #define DS2482_CMD_1WIRE_READ_BYTE 0x96 /* Param: None */ /* Note to read the byte, Set the ReadPtr to Data then read (any addr) */ #define DS2482_CMD_1WIRE_TRIPLET 0x78 /* Param: Dir byte (bit7) */ /* Values for DS2482_CMD_SET_READ_PTR */ #define DS2482_PTR_CODE_STATUS 0xF0 #define DS2482_PTR_CODE_DATA 0xE1 #define DS2482_PTR_CODE_CHANNEL 0xD2 /* DS2482-800 only */ #define DS2482_PTR_CODE_CONFIG 0xC3 /** * Configure Register bit definitions * The top 4 bits always read 0. * To write, the top nibble must be the 1's compl. of the low nibble. */ #define DS2482_REG_CFG_1WS 0x08 #define DS2482_REG_CFG_SPU 0x04 #define DS2482_REG_CFG_PPM 0x02 #define DS2482_REG_CFG_APU 0x01 /** * Status Register bit definitions (read only) */ #define DS2482_REG_STS_DIR 0x80 #define DS2482_REG_STS_TSB 0x40 #define DS2482_REG_STS_SBR 0x20 #define DS2482_REG_STS_RST 0x10 #define DS2482_REG_STS_LL 0x08 #define DS2482_REG_STS_SD 0x04 #define DS2482_REG_STS_PPD 0x02 #define DS2482_REG_STS_1WB 0x01 /* Time limits for communication unsigned long int min_usec, unsigned long int max_usec */ #define DS2482_Chip_reset_usec 1, 2 #define DS2482_1wire_reset_usec 1125, 1250 #define DS2482_1wire_write_usec 530, 585 #define DS2482_1wire_triplet_usec 198, 219 /* Defines for making messages more explicit */ #define I2Cformat "I2C bus %s, channel %d/%d" #define I2Cvar(in) SOC(in)->devicename, (in)->master.i2c.index, (in)->master.i2c.channels /* Device-specific functions */ static void DS2482_setroutines(struct connection_in *in) { in->iroutines.detect = DS2482_detect; in->iroutines.reset = DS2482_reset; in->iroutines.next_both = DS2482_next_both; in->iroutines.PowerByte = DS2482_PowerByte; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = DS2482_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = DS2482_redetect; in->iroutines.close = DS2482_close; in->iroutines.flags = ADAP_FLAG_overdrive; in->bundling_length = I2C_FIFO_SIZE; } /* All the rest of the program sees is the DS2482_detect and the entry in iroutines */ /* Open a DS2482 */ /* Top level detect routine */ GOOD_OR_BAD DS2482_detect(struct connection_in *in) { struct address_pair ap ; GOOD_OR_BAD gbResult ; enum ds2482_address chip_num ; Parse_Address( SOC(in)->devicename, &ap ) ; switch ( ap.second.type ) { case address_numeric: if ( ap.second.number < ds2482_18 || ap.second.number >= ds2482_too_far ) { LEVEL_CALL("DS2482 bus address <%s> invalid. Will scan.", ap.second.alpha) ; chip_num = ds2482_any ; } else { chip_num = ap.second.number ; } break ; case address_all: chip_num = ds2482_all ; break ; case address_none: chip_num = ds2482_any ; break ; default: LEVEL_CALL("DS2482 bus address <%s> invalid. Will scan.", ap.second.alpha) ; chip_num = ds2482_any ; break ; } SAFEFREE( SOC(in)->devicename ) ; switch ( ap.first.type ) { case address_all: // All adapters gbResult = DS2482_detect_sys( 0, chip_num, in ) ; break ; case address_none: // Any adapter -- first one found gbResult = DS2482_detect_sys( 1, chip_num, in ) ; break ; default: // traditional, actual bus specified gbResult = DS2482_detect_bus( chip_num, ap.first.alpha, in ) ; break ; } Free_Address( &ap ) ; return gbResult ; } #define SYSFS_I2C_Path "/sys/class/i2c-adapter" /* Use sysfs to find i2c adapters */ /* cycle through SYSFS_I2C_Path */ /* return GOOD if any found */ static GOOD_OR_BAD DS2482_detect_sys( int any, enum ds2482_address chip_num, struct connection_in *in_original) { DIR * i2c_list_dir ; struct dirent * i2c_bus ; int found = 0 ; struct connection_in * in_current = in_original ; // We'll look in this directory for available i2c adapters. // This may be linux 2.6 specific i2c_list_dir = opendir( SYSFS_I2C_Path ) ; if ( i2c_list_dir == NULL ) { ERROR_CONNECT( "Cannot open %d to find available i2c devices",SYSFS_I2C_Path ) ; // Use the cruder approach of trying all possible numbers return DS2482_detect_dir( any, chip_num, in_original ) ; } /* cycle through entries in /sys/class/i2c-adapter */ while ( (i2c_bus=readdir(i2c_list_dir)) != NULL ) { char dev_name[128] ; // room for /dev/name int sn_ret ; UCLIBCLOCK ; sn_ret = snprintf( dev_name, 128, "/dev/%s", i2c_bus->d_name ) ; UCLIBCUNLOCK ; if ( sn_ret < 0 ) { break ; } // Now look for the ds2482's if ( BAD( DS2482_detect_bus( chip_num, dev_name, in_current ) ) ) { continue ; // none found on this i2c bus } // at least one found on this i2c bus ++found ; if ( any ) { // found one -- that's enough break ; } // ALL? then set up a new connection_in slot for the next one in_current = NewIn(in_current) ; if ( in_current == NO_CONNECTION ) { break ; } } closedir( i2c_list_dir ) ; return found>0 ? gbGOOD : gbBAD ; } /* non sysfs method -- try by bus name */ /* cycle through /dev/i2c-n */ /* returns GOOD if any adpters found */ static GOOD_OR_BAD DS2482_detect_dir( int any, enum ds2482_address chip_num, struct connection_in *in_original) { int found = 0 ; struct connection_in * in_current = in_original ; int bus = 0 ; int sn_ret ; for ( bus=0 ; bus<99 ; ++bus ) { char dev_name[128] ; UCLIBCLOCK ; sn_ret = snprintf( dev_name, 128-1, "/dev/i2c-%d", bus ) ; UCLIBCUNLOCK ; if ( sn_ret < 0 ) { break ; } if ( access(dev_name, F_OK) < 0 ) { continue ; } // Now look for the ds2482's if ( BAD( DS2482_detect_bus( chip_num, dev_name, in_current ) ) ) { continue ; } // at least one found ++found ; if ( any ) { break ; } // ALL? then set up a new connection_in slot in_current = NewIn(in_current) ; if ( in_current == NO_CONNECTION ) { break ; } } return found>0 ? gbGOOD : gbBAD ; } /* Try to see if there is a DS2482 device on the specified i2c bus */ /* Includes a fix from Pascal Baerten */ static GOOD_OR_BAD DS2482_detect_bus(enum ds2482_address chip_num, char * i2c_device, struct connection_in * in_original) { switch (chip_num) { case ds2482_any: // usual case, find the first adapter return DS2482_detect_single( 0, 7, i2c_device, in_original ) ; case ds2482_all: // Look through all the possible i2c addresses { int start_chip = 0 ; struct connection_in * all_in = in_original ; do { if ( BAD( DS2482_detect_single( start_chip, 7, i2c_device, all_in ) ) ) { if ( in_original == all_in ) { //first time return gbBAD ; } LEVEL_DEBUG("Cleaning excess allocated i2c structure"); RemoveIn(all_in); //Pascal Baerten :this removes the false DS2482-100 provisioned return gbGOOD ; } start_chip = all_in->master.i2c.i2c_index + 1 ; if ( start_chip > 7 ) { return gbGOOD ; } all_in = NewIn(all_in) ; if ( all_in == NO_CONNECTION ) { return gbBAD ; } } while (1) ; } break ; default: // specific i2c address return DS2482_detect_single( chip_num, chip_num, i2c_device, in_original ) ; } } /* Try to see if there is a DS2482 device on the specified i2c bus */ static GOOD_OR_BAD DS2482_detect_single(int lowindex, int highindex, char * i2c_device, struct connection_in *in) { int test_address[8] = { 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, }; // the last 4 are -800 only int i2c_index; FILE_DESCRIPTOR_OR_ERROR file_descriptor; /* Sanity check */ if ( lowindex < 0 ) { LEVEL_DEBUG("Bad lower bound"); return gbBAD ; } if ( highindex >= sizeof(test_address)/sizeof(int) ) { LEVEL_DEBUG("Bad upper bound"); return gbBAD ; } /* open the i2c port */ file_descriptor = open(i2c_device, O_RDWR | O_CLOEXEC); if ( FILE_DESCRIPTOR_NOT_VALID(file_descriptor) ) { ERROR_CONNECT("Could not open i2c device %s", i2c_device); return gbBAD; } else { // in case O_CLOEXEC not supported fcntl (file_descriptor, F_SETFD, FD_CLOEXEC) ; } /* Set up low-level routines */ DS2482_setroutines(in); for (i2c_index = lowindex; i2c_index <= highindex; ++i2c_index) { int trial_address = test_address[i2c_index] ; /* set the candidate address */ if (ioctl(file_descriptor, I2C_SLAVE, trial_address) < 0) { ERROR_CONNECT("Cound not set trial i2c address to %.2X", trial_address); } else { BYTE c; LEVEL_CONNECT("Found an i2c device at %s address %.2X", i2c_device, trial_address); /* Provisional setup as a DS2482-100 ( 1 channel ) */ SOC(in)->file_descriptor = file_descriptor; SOC(in)->state = cs_deflowered; SOC(in)->type = ct_i2c ; in->master.i2c.i2c_address = trial_address; in->master.i2c.i2c_index = i2c_index; in->master.i2c.index = 0; in->master.i2c.channels = 1; in->master.i2c.current = 0; in->master.i2c.head = in; in->master.i2c.next = NO_CONNECTION; in->adapter_name = "DS2482-100"; in->master.i2c.configreg = 0x00 ; // default configuration setting desired if ( Globals.i2c_APU ) { in->master.i2c.configreg |= DS2482_REG_CFG_APU ; } if ( Globals.i2c_PPM ) { in->master.i2c.configreg |= DS2482_REG_CFG_PPM ; } _MUTEX_INIT(in->master.i2c.all_channel_lock); in->busmode = bus_i2c; in->Adapter = adapter_DS2482_100; /* write the RESET code */ if (i2c_smbus_write_byte(file_descriptor, DS2482_CMD_RESET) // reset || BAD(DS2482_readstatus(&c, file_descriptor, DS2482_Chip_reset_usec)) // pause .5 usec then read status || (c != (DS2482_REG_STS_LL | DS2482_REG_STS_RST)) // make sure status is properly set ) { LEVEL_CONNECT("i2c device at %s address %.2X cannot be reset. Not a DS2482.", i2c_device, trial_address); continue; } LEVEL_CONNECT("i2c device at %s address %.2X appears to be DS2482-x00", i2c_device, trial_address); in->master.i2c.configchip = 0x00; // default configuration register after RESET // Note, only the lower nibble of the device config stored // Create name SOC(in)->devicename = owmalloc( strlen(i2c_device) + 10 ) ; if ( SOC(in)->devicename ) { UCLIBCLOCK; snprintf(SOC(in)->devicename, strlen(i2c_device) + 10, "%s:%.2X", i2c_device, trial_address); UCLIBCUNLOCK; } /* Now see if DS2482-100 or DS2482-800 */ return HeadChannel(in); } } /* fell though, no device found */ COM_close( in ) ; in->busmode = bus_bad; return gbBAD; } /* Re-open a DS2482 */ static GOOD_OR_BAD DS2482_redetect(const struct parsedname *pn) { struct connection_in *head = pn->selected_connection->master.i2c.head; int address = head->master.i2c.i2c_address; FILE_DESCRIPTOR_OR_ERROR file_descriptor; struct address_pair ap ; // to get device name from device:address /* open the i2c port */ Parse_Address( SOC(head)->devicename, &ap ) ; file_descriptor = open(ap.first.alpha, O_RDWR | O_CLOEXEC ); Free_Address( &ap ) ; if ( FILE_DESCRIPTOR_NOT_VALID(file_descriptor) ) { ERROR_CONNECT("Could not open i2c device %s", SOC(head)->devicename); return gbBAD; } else { // in case O_CLOEXEC not supported fcntl (file_descriptor, F_SETFD, FD_CLOEXEC) ; } /* address is known */ if (ioctl(file_descriptor, I2C_SLAVE, head->master.i2c.i2c_address) < 0) { ERROR_CONNECT("Cound not set i2c address to %.2X", address); } else { BYTE c; /* write the RESET code */ if (i2c_smbus_write_byte(file_descriptor, DS2482_CMD_RESET) // reset || BAD(DS2482_readstatus(&c, file_descriptor, DS2482_Chip_reset_usec)) // pause .5 usec then read status || (c != (DS2482_REG_STS_LL | DS2482_REG_STS_RST)) // make sure status is properly set ) { LEVEL_CONNECT("i2c device at %s address %d cannot be reset. Not a DS2482.", SOC(head)->devicename, address); } else { struct connection_in * next ; head->master.i2c.current = 0; SOC(head)->file_descriptor = file_descriptor; SOC(head)->state = cs_deflowered ; SOC(head)->type = ct_i2c ; head->master.i2c.configchip = 0x00; // default configuration register after RESET LEVEL_CONNECT("i2c device at %s address %d reset successfully", SOC(head)->devicename, address); for ( next = head->master.i2c.next; next; next = next->master.i2c.next ) { /* loop through devices, matching those that have the same "head" */ /* BUSLOCK also locks the sister channels for this */ next->reconnect_state = reconnect_ok; } return gbGOOD; } } /* fellthough, no device found */ close(file_descriptor); return gbBAD; } /* read status register */ /* should already be set to read from there */ /* will read at min time, avg time, max time, and another 50% */ /* returns 0 good, 1 bad */ /* tests to make sure bus not busy */ static GOOD_OR_BAD DS2482_readstatus(BYTE * c, FILE_DESCRIPTOR_OR_ERROR file_descriptor, unsigned long int min_usec, unsigned long int max_usec) { unsigned long int delta_usec = (max_usec - min_usec + 1) / 2; int i = 0; UT_delay_us(min_usec); // at least get minimum out of the way do { int ret = i2c_smbus_read_byte(file_descriptor); if (ret < 0) { LEVEL_DEBUG("problem min=%lu max=%lu i=%d ret=%d", min_usec, max_usec, i, ret); return gbBAD; } if ((ret & DS2482_REG_STS_1WB) == 0x00) { c[0] = (BYTE) ret; LEVEL_DEBUG("ok"); return gbGOOD; } if (i++ == 3) { LEVEL_DEBUG("still busy min=%lu max=%lu i=%d ret=%d", min_usec, max_usec, i, ret); return gbBAD; } UT_delay_us(delta_usec); // increment up to three times } while (1); } /* uses the "Triple" primative for faster search */ static enum search_status DS2482_next_both(struct device_search *ds, const struct parsedname *pn) { int search_direction = 0; /* initialization just to forestall incorrect compiler warning */ int bit_number; int last_zero = -1; FILE_DESCRIPTOR_OR_ERROR file_descriptor = SOC(pn->selected_connection->master.i2c.head)->file_descriptor; BYTE bits[3]; // initialize for search // if the last call was not the last one if (ds->LastDevice) { return search_done; } if ( BAD( BUS_select(pn) ) ) { return search_error ; } // need the reset done in BUS-select to set AnyDevices if ( pn->selected_connection->AnyDevices == anydevices_no ) { ds->LastDevice = 1; return search_done; } /* Make sure we're using the correct channel */ /* Appropriate search command */ if ( BAD(BUS_send_data(&(ds->search), 1, pn)) ) { return search_error; } // loop to do the search for (bit_number = 0; bit_number < 64; ++bit_number) { LEVEL_DEBUG("bit number %d", bit_number); /* Set the direction bit */ if (bit_number < ds->LastDiscrepancy) { search_direction = UT_getbit(ds->sn, bit_number); } else { search_direction = (bit_number == ds->LastDiscrepancy) ? 1 : 0; } /* Appropriate search command */ if ( BAD( DS2482_triple(bits, search_direction, file_descriptor) ) ) { return search_error; } if (bits[0] || bits[1] || bits[2]) { if (bits[0] && bits[1]) { /* 1,1 */ /* No devices respond */ ds->LastDevice = 1; return search_done; } } else { /* 0,0,0 */ last_zero = bit_number; } UT_setbit(ds->sn, bit_number, bits[2]); } // loop until through serial number bits if (CRC8(ds->sn, SERIAL_NUMBER_SIZE) || (bit_number < 64) || (ds->sn[0] == 0)) { /* Unsuccessful search or error -- possibly a device suddenly added */ return search_error; } // if the search was successful then ds->LastDiscrepancy = last_zero; ds->LastDevice = (last_zero < 0); LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn)); return search_good; } /* DS2482 Reset -- A little different from DS2480B */ // return 1 shorted, 0 ok, <0 error static RESET_TYPE DS2482_reset(const struct parsedname *pn) { BYTE status_byte; struct connection_in * in = pn->selected_connection ; FILE_DESCRIPTOR_OR_ERROR file_descriptor = SOC(in->master.i2c.head)->file_descriptor; /* Make sure we're using the correct channel */ if ( BAD(DS2482_channel_select(in)) ) { return BUS_RESET_ERROR; } /* write the RESET code */ if (i2c_smbus_write_byte(file_descriptor, DS2482_CMD_1WIRE_RESET)) { return BUS_RESET_ERROR; } /* wait */ // rstl+rsth+.25 usec /* read status */ if ( BAD( DS2482_readstatus(&status_byte, file_descriptor, DS2482_1wire_reset_usec) ) ) { return BUS_RESET_ERROR; // 8 * Tslot } in->AnyDevices = (status_byte & DS2482_REG_STS_PPD) ? anydevices_yes : anydevices_no ; LEVEL_DEBUG("DS2482 "I2Cformat" Any devices found on reset? %s",I2Cvar(in),in->AnyDevices==anydevices_yes?"Yes":"No"); return (status_byte & DS2482_REG_STS_SD) ? BUS_RESET_SHORT : BUS_RESET_OK; } static GOOD_OR_BAD DS2482_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; FILE_DESCRIPTOR_OR_ERROR file_descriptor = SOC(in->master.i2c.head)->file_descriptor; size_t i; /* Make sure we're using the correct channel */ RETURN_BAD_IF_BAD(DS2482_channel_select(in)) ; TrafficOut( "write", data, len, in ) ; for (i = 0; i < len; ++i) { RETURN_BAD_IF_BAD(DS2482_send_and_get(file_descriptor, data[i], &resp[i])) ; } TrafficOut( "response", resp, len, in ) ; return gbGOOD; } /* Single byte -- assumes channel selection already done */ static GOOD_OR_BAD DS2482_send_and_get(FILE_DESCRIPTOR_OR_ERROR file_descriptor, const BYTE wr, BYTE * rd) { int read_back; BYTE c; /* Write data byte */ if (i2c_smbus_write_byte_data(file_descriptor, DS2482_CMD_1WIRE_WRITE_BYTE, wr) < 0) { return gbBAD; } /* read status for done */ RETURN_BAD_IF_BAD( DS2482_readstatus(&c, file_descriptor, DS2482_1wire_write_usec) ) ; /* Select the data register */ if (i2c_smbus_write_byte_data(file_descriptor, DS2482_CMD_SET_READ_PTR, DS2482_PTR_CODE_DATA) < 0) { return gbBAD; } /* Read the data byte */ read_back = i2c_smbus_read_byte(file_descriptor); if (read_back < 0) { return gbBAD; } rd[0] = (BYTE) read_back; return gbGOOD; } /* It's a DS2482 -- whether 1 channel or 8 channel not yet determined */ /* All general stored data will be assigned to this "head" channel */ static GOOD_OR_BAD HeadChannel(struct connection_in *head) { /* Intentionally put the wrong index */ head->master.i2c.index = 1; if ( BAD(DS2482_channel_select(head)) ) { /* Couldn't switch */ head->master.i2c.index = 0; /* restore correct value */ LEVEL_CONNECT("DS2482-100 (Single channel)"); return gbGOOD; /* happy as DS2482-100 */ } // It's a DS2482-800 (8 channels) to set up other 7 with this one as "head" LEVEL_CONNECT("DS2482-800 (Eight channels)"); /* Must be a DS2482-800 */ head->master.i2c.channels = 8; head->Adapter = adapter_DS2482_800; return CreateChannels(head); } /* create more channels, inserts in connection_in chain "in" points to first (head) channel called only for DS12482-800 NOTE: coded assuming num = 1 or 8 only */ static GOOD_OR_BAD CreateChannels(struct connection_in *head) { struct connection_in * prior = head ; int i; char *name[] = { "DS2482-800(0)", "DS2482-800(1)", "DS2482-800(2)", "DS2482-800(3)", "DS2482-800(4)", "DS2482-800(5)", "DS2482-800(6)", "DS2482-800(7)", }; head->master.i2c.index = 0; head->adapter_name = name[0]; for (i = 1; i < 8; ++i) { struct connection_in * added = NewIn(head); prior->master.i2c.next = added ; if (added == NO_CONNECTION) { return gbBAD; } added->master.i2c.index = i; added->adapter_name = name[i]; added->master.i2c.next = NO_CONNECTION ; // for now prior = added ; } return gbGOOD; } static GOOD_OR_BAD DS2482_triple(BYTE * bits, int direction, FILE_DESCRIPTOR_OR_ERROR file_descriptor) { /* 3 bits in bits */ BYTE c; LEVEL_DEBUG("-> TRIPLET attempt direction %d", direction); /* Write TRIPLE command */ if (i2c_smbus_write_byte_data(file_descriptor, DS2482_CMD_1WIRE_TRIPLET, direction ? 0xFF : 0) < 0) { return gbBAD; } /* read status */ RETURN_BAD_IF_BAD(DS2482_readstatus(&c, file_descriptor, DS2482_1wire_triplet_usec)) ; bits[0] = (c & DS2482_REG_STS_SBR) != 0; bits[1] = (c & DS2482_REG_STS_TSB) != 0; bits[2] = (c & DS2482_REG_STS_DIR) != 0; LEVEL_DEBUG("<- TRIPLET %d %d %d", bits[0], bits[1], bits[2]); return gbGOOD; } static GOOD_OR_BAD DS2482_channel_select(struct connection_in * in) { struct connection_in *head = in->master.i2c.head; int chan = in->master.i2c.index; FILE_DESCRIPTOR_OR_ERROR file_descriptor = SOC(head)->file_descriptor; /* Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only). To set the channel, write the value at the index of the channel. Read and compare against the corresponding value to verify the change. */ static const BYTE W_chan[8] = { 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87 }; static const BYTE R_chan[8] = { 0xB8, 0xB1, 0xAA, 0xA3, 0x9C, 0x95, 0x8E, 0x87 }; if ( FILE_DESCRIPTOR_NOT_VALID(file_descriptor) ) { LEVEL_CONNECT("Calling a closed i2c channel (%d) "I2Cformat" ", chan,I2Cvar(in)); return gbBAD; } /* Already properly selected? */ /* All `100 (1 channel) will be caught here */ if (chan != head->master.i2c.current) { int read_back; /* Select command */ if (i2c_smbus_write_byte_data(file_descriptor, DS2482_CMD_CHANNEL_SELECT, W_chan[chan]) < 0) { return gbBAD; } /* Read back and confirm */ read_back = i2c_smbus_read_byte(file_descriptor); if (read_back < 0) { return gbBAD; // flag for DS2482-100 vs -800 detection } if (((BYTE) read_back) != R_chan[chan]) { return gbBAD; // flag for DS2482-100 vs -800 detection } /* Set the channel in head */ head->master.i2c.current = in->master.i2c.index; } /* Now check the configuration register */ /* This is since configuration is per chip, not just channel */ if (in->master.i2c.configreg != head->master.i2c.configchip) { return SetConfiguration(in->master.i2c.configreg, in); } return gbGOOD; } /* Set the configuration register, both for this channel, and for head global data */ /* Note, config is stored as only the lower nibble */ static GOOD_OR_BAD SetConfiguration(BYTE c, struct connection_in *in) { struct connection_in *head = in->master.i2c.head; FILE_DESCRIPTOR_OR_ERROR file_descriptor = SOC(head)->file_descriptor; int read_back; /* Write, readback, and compare configuration register */ /* Logic error fix from Uli Raich */ if (i2c_smbus_write_byte_data(file_descriptor, DS2482_CMD_WRITE_CONFIG, c | ((~c) << 4)) || (read_back = i2c_smbus_read_byte(file_descriptor)) < 0 || ((BYTE) read_back != c) ) { head->master.i2c.configchip = 0xFF; // bad value to trigger retry LEVEL_CONNECT("Trouble changing DS2482 configuration register "I2Cformat" ",I2Cvar(in)); return gbBAD; } /* Clear the strong pull-up power bit(register is automatically cleared by reset) */ in->master.i2c.configreg = head->master.i2c.configchip = c & ~DS2482_REG_CFG_SPU; return gbGOOD; } static GOOD_OR_BAD DS2482_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; /* Make sure we're using the correct channel */ RETURN_BAD_IF_BAD(DS2482_channel_select(in)) ; /* Set the power (bit is automatically cleared by reset) */ TrafficOut("power write", &byte, 1, in ) ; RETURN_BAD_IF_BAD(SetConfiguration( in->master.i2c.configreg | DS2482_REG_CFG_SPU, in)) ; /* send and get byte (and trigger strong pull-up */ RETURN_BAD_IF_BAD(DS2482_send_and_get( SOC(in->master.i2c.head)->file_descriptor, byte, resp)) ; TrafficOut("power response", resp, 1, in ) ; UT_delay(delay); return gbGOOD; } static void DS2482_close(struct connection_in *in) { if (in == NO_CONNECTION) { return; } if (in->master.i2c.index == 0) { _MUTEX_DESTROY(in->master.i2c.all_channel_lock); } } #endif /* OW_I2C */ owfs-2.8p15/module/owlib/src/c/ow_write.c0000644000175000017500000004701011674517460015242 00000000000000/* $Id: ow_write.c,v 1.173 2011/12/22 03:08:32 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ static ZERO_OR_ERROR FS_w_given_bus(struct one_wire_query *owq); static ZERO_OR_ERROR FS_w_settings(struct one_wire_query *owq); static ZERO_OR_ERROR FS_w_interface(struct one_wire_query *owq); static ZERO_OR_ERROR FS_w_local(struct one_wire_query *owq); static ZERO_OR_ERROR FS_w_simultaneous(struct one_wire_query *owq); static ZERO_OR_ERROR FS_write_owq(struct one_wire_query *owq); static ZERO_OR_ERROR FS_write_all( struct one_wire_query *owq_all ) ; static ZERO_OR_ERROR FS_write_all_bits( struct one_wire_query *owq_all ); static ZERO_OR_ERROR FS_write_a_bit(struct one_wire_query *owq_bit); static ZERO_OR_ERROR FS_write_in_parts( struct one_wire_query *owq_all ); static ZERO_OR_ERROR FS_write_a_part( struct one_wire_query *owq_part ); static ZERO_OR_ERROR FS_write_as_bits( struct one_wire_query *owq_byte ) ; static ZERO_OR_ERROR FS_write_real(int depth, struct one_wire_query *owq) ; static ZERO_OR_ERROR FS_write_post_stats(struct one_wire_query *owq) ; static ZERO_OR_ERROR FS_write_post_input(struct one_wire_query *owq) ; /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ /* Note on return values: */ /* Top level FS_write will return size if ok, else a negative number */ /* Each lower level function called will return 0 if ok, else non-zero */ /* Note on size and offset: */ /* Buffer length (and requested data) is size bytes */ /* writing should start after offset bytes in original data */ /* only binary, and ascii data support offset in single data points */ /* only binary supports offset in array data */ /* size and offset are vetted against specification data size and calls */ /* outside of this module will not have buffer overflows */ /* I.e. the rest of owlib can trust size and buffer to be legal */ /* Format of input, Depends on "filetype" type function format Handled as integer strol decimal integer integer array unsigned strou decimal integer unsigned array bitfield strou decimal integer unsigned array yesno strcmp "0" "1" "yes" "no" "on" "off" unsigned array float strod decimal floating point double array date strptime "Jan 01, 1901", etc date array ascii strcpy string without "," or null comma-separated-strings binary memcpy fixed length binary string binary "string" */ /* return size if ok, else negative */ SIZE_OR_ERROR FS_write(const char *path, const char *buf, const size_t size, const off_t offset) { ZERO_OR_ERROR write_return; OWQ_allocate_struct_and_pointer(owq); LEVEL_CALL("path=%s size=%d offset=%d", SAFESTRING(path), (int) size, (int) offset); // parsable path? if ( OWQ_create(path, owq) != 0 ) { // for write return -ENOENT; } OWQ_assign_write_buffer(buf, size, offset, owq) ; write_return = FS_write_postparse(owq); OWQ_destroy(owq); return write_return; /* here's where the size is used! */ } /* return size if ok, else negative */ SIZE_OR_ERROR FS_write_postparse(struct one_wire_query *owq) { ZERO_OR_ERROR write_or_error; struct parsedname *pn = PN(owq); if (Globals.readonly) { LEVEL_DEBUG("Attempt to write but readonly set on command line."); return -EROFS; // read-only invokation } if (IsDir(pn)) { LEVEL_DEBUG("Attempt to write to a directory."); return -EISDIR; // not a file } STATLOCK; AVERAGE_IN(&write_avg); AVERAGE_IN(&all_avg); ++write_calls; /* statistics */ STATUNLOCK; write_or_error = FS_write_post_stats( owq ) ; STATLOCK; // write_or_error is still ZERO_OR_ERROR mode if ( write_or_error == 0 ) { LEVEL_DEBUG("Successful write to %s",pn->path) ; } else { LEVEL_DEBUG("Error writing to %s",pn->path) ; } if (write_or_error == 0) { ++write_success; /* statistics */ write_bytes += OWQ_size(owq); /* statistics */ // write_or_error now SIZE_OR_ERROR mode write_or_error = OWQ_size(owq); /* here's where the size is used! */ } AVERAGE_OUT(&write_avg); AVERAGE_OUT(&all_avg); STATUNLOCK; return write_or_error; } /* return 0 if ok, else negative */ /* Handles 3-peat */ static ZERO_OR_ERROR FS_write_post_stats(struct one_wire_query *owq) { // Parse the data to be written ZERO_OR_ERROR input_or_error = OWQ_parse_input(owq); Debug_OWQ(owq); if (input_or_error < 0) { LEVEL_DEBUG("Error interpreting input value.") ; return input_or_error ; } return FS_write_post_input( owq ) ; } /* return 0 if ok, else negative */ /* Handles 3-peat */ static ZERO_OR_ERROR FS_write_post_input(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); // Write differently depending on the type of directory switch (pn->type) { case ePN_structure: case ePN_statistics: case ePN_system: // No writable features here LEVEL_DEBUG("Cannot write in this type of directory.") ; return -ENOTSUP; case ePN_settings: return FS_w_settings(owq); case ePN_real: // ePN_real /* handle DeviceSimultaneous */ if (pn->selected_device == DeviceSimultaneous) { /* writing to /simultaneous/temperature will write to ALL * available bus.?/simultaneous/temperature * not just /simultaneous/temperature */ return FS_w_simultaneous(owq); } else if (pn->selected_connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to write but no 1-wire bus master."); return -ENODEV; // no buses } else { // Normal path for most writes to actual devices return FS_write_real(0,owq) ; // start with 0 depth } case ePN_interface: return FS_w_interface(owq) ; case ePN_root: default: return -ENOTSUP ; } } /* write to a real 1-wire device */ /* If error, try twice more */ static ZERO_OR_ERROR FS_write_real(int depth, struct one_wire_query *owq) { ZERO_OR_ERROR write_or_error; struct parsedname *pn = PN(owq); struct filetype * ft = pn->selected_filetype ; INDEX_OR_ERROR initial_bus = pn->selected_connection->index ; // current selected bus INDEX_OR_ERROR rechecked_bus ; if ( depth > 1 ) { LEVEL_DEBUG("Too many bus changes for write"); return -ENODEV ; } if ( ft->write == FS_w_alias ) { // Special check for alias // it's ok for fake and tester and mock as well // so do this before the fake test // also no need to three-peat. return FS_write_owq(owq) ; } /* Special case for "fake" adapter */ switch (get_busmode(pn->selected_connection)) { case bus_mock: // Mock -- write even "unwritable" to the cache for testing OWQ_Cache_Add(owq) ; // fall through case bus_fake: case bus_tester: return ( ft->write == NO_WRITE_FUNCTION ) ? -ENOTSUP : 0 ; default: // non-virtual devices get handled below break ; } /* First try */ /* in and bus_nr already set */ STAT_ADD1(write_tries[0]); write_or_error = FS_w_given_bus(owq); if ( write_or_error ==0 ) { return 0 ; } /* Second Try */ STAT_ADD1(write_tries[1]); if (SpecifiedBus(pn)) { // The bus number casn't be changed -- it was specified in the path write_or_error = FS_w_given_bus(owq); if ( write_or_error == 0 ) { return 0 ; } // The bus number casn't be changed -- it was specified in the path STAT_ADD1(write_tries[2]); return FS_w_given_bus(owq); } /* Recheck location */ /* if not a specified bus, relook for chip location */ rechecked_bus = ReCheckPresence(pn) ; if ( rechecked_bus < 0 ) { // can't find the location return -ENOENT ; } if ( initial_bus == rechecked_bus ) { // special handling for remote // only repeat if the bus number is wrong // because the remote does the rewrites if (BusIsServer(pn->selected_connection)) { return write_or_error ; } // try again STAT_ADD1(write_tries[1]); write_or_error = FS_w_given_bus(owq); if ( write_or_error == 0 ) { return 0 ; } // third try STAT_ADD1(write_tries[2]); return FS_w_given_bus(owq); } // Changed location retry everything LEVEL_DEBUG("Bus location changed from %d to %d\n",initial_bus,rechecked_bus); return FS_write_real(depth+1,owq); } #if OW_MT struct simultaneous_struct { struct connection_in *in; const struct one_wire_query *owq ; }; static void * Simultaneous_write(void * v) { struct simultaneous_struct *ss = (struct simultaneous_struct *) v; struct simultaneous_struct ss_next = { ss->in->next, ss->owq }; pthread_t thread; int threadbad = 1; OWQ_allocate_struct_and_pointer(owq_copy); threadbad = (ss->in->next == NULL) || pthread_create(&thread, DEFAULT_THREAD_ATTR, Simultaneous_write, (void *) (&ss_next)); memcpy(owq_copy, ss->owq, sizeof(struct one_wire_query)); // shallow copy SetKnownBus(ss->in->index, PN(owq_copy)); FS_w_given_bus(owq_copy); if (threadbad == 0) { /* was a thread created? */ pthread_join(thread, NULL) ; } return VOID_RETURN ; } /* This function is only used by "Simultaneous" */ static ZERO_OR_ERROR FS_w_simultaneous(struct one_wire_query *owq) { if (SpecifiedBus(PN(owq))) { return FS_w_given_bus(owq); } else if (Inbound_Control.head) { struct simultaneous_struct ss = { Inbound_Control.head, owq }; Simultaneous_write( (void *) (&ss) ) ; } return 0; } #else /* not OW_MT */ /* This function is only used by "Simultaneous" */ static ZERO_OR_ERROR FS_w_simultaneous(struct one_wire_query *owq) { if (SpecifiedBus(PN(owq))) { return FS_w_given_bus(owq); } else if (Inbound_Control.head) { struct connection_in * in; OWQ_allocate_struct_and_pointer(owq_given); memcpy(owq_given, owq, sizeof(struct one_wire_query)); // shallow copy for( in=Inbound_Control.head; in ; in=in->next ) { SetKnownBus(in->index, PN(owq_given)); FS_w_given_bus(owq_given); } } return 0; } #endif /* OW_MT */ /* Write to interface dir */ static ZERO_OR_ERROR FS_w_interface(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if ( pn->selected_connection == NO_CONNECTION ) { LEVEL_DEBUG("Attempt to write to no bus for /settings"); return -ENODEV ; } else if ( SpecifiedLocalBus(pn) ) { return FS_w_local(owq); } else { return ServerWrite(owq); } } /* Write to settings dir */ static ZERO_OR_ERROR FS_w_settings(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if ( BAD(TestConnection(pn)) ) { // safe for connection_in == NULL return -ECONNABORTED; } else if (KnownBus(pn) && BusIsServer(pn->selected_connection)) { return ServerWrite(owq); } else if ( pn->selected_connection == NO_CONNECTION ) { LEVEL_DEBUG("Attempt to write to local bus for /settings"); return -ENODEV ; } else { return FS_w_local(owq); } } /* Write now that connection is set */ static ZERO_OR_ERROR FS_w_given_bus(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if ( BAD(TestConnection(pn)) ) { return -ECONNABORTED; } else if (KnownBus(pn) && BusIsServer(pn->selected_connection)) { return ServerWrite(owq); } else if (OWQ_pn(owq).type == ePN_real) { ZERO_OR_ERROR write_or_error = DeviceLockGet(pn); if (write_or_error == 0) { write_or_error = FS_w_local(owq); DeviceLockRelease(pn); } else { LEVEL_DEBUG("Cannot lock device for writing") ; } return write_or_error ; } else if ( IsInterfaceDir(pn) ) { ZERO_OR_ERROR write_or_error; BUSLOCK(pn); write_or_error = FS_w_local(owq); BUSUNLOCK(pn); return write_or_error ; } else { return FS_w_local(owq); } } /* return 0 if ok */ static ZERO_OR_ERROR FS_w_local(struct one_wire_query *owq) { // Device already locked struct parsedname *pn = PN(owq); struct filetype * ft = pn->selected_filetype ; /* Writable? */ if ( ft->write == NO_WRITE_FUNCTION ) { return -ENOTSUP; } /* Special case for "fake" adapter */ switch (get_busmode(pn->selected_connection)) { case bus_mock: case bus_fake: case bus_tester: return 0 ; default: // non-virtual devices get handled below break ; } /* Non-array? */ if ( ft->ag == NON_AGGREGATE ) { LEVEL_DEBUG("Write a non-array element %s",pn->path); return FS_write_owq(owq); } /* array */ switch ( ft->ag->combined ) { case ag_sparse: // avoid cache return (ft->write) (owq);; case ag_aggregate: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Write an aggregate .BYTE %s",pn->path); return FS_write_owq(owq); case EXTENSION_ALL: LEVEL_DEBUG("Write an aggregate .ALL %s",pn->path); return FS_write_all(owq); default: LEVEL_DEBUG("Write an aggregate element %s",pn->path); return FS_write_a_part(owq) ; } case ag_mixed: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Write a mixed .BYTE %s",pn->path); OWQ_Cache_Del_parts(owq); return FS_write_owq(owq); case EXTENSION_ALL: LEVEL_DEBUG("Write a mixed .ALL %s",pn->path); OWQ_Cache_Del_parts(owq); return FS_write_all(owq); default: LEVEL_DEBUG("Write a mixed element %s",pn->path); OWQ_Cache_Del_ALL(owq); OWQ_Cache_Del_BYTE(owq); return FS_write_owq(owq); } case ag_separate: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Write a separate .BYTE %s",pn->path); return FS_write_as_bits(owq); case EXTENSION_ALL: LEVEL_DEBUG("Write a separate .ALL %s",pn->path); return FS_write_in_parts(owq); default: LEVEL_DEBUG("Write a separate element %s",pn->path); return FS_write_owq(owq); } default: return -ENOENT ; } } static ZERO_OR_ERROR FS_write_owq(struct one_wire_query *owq) { ZERO_OR_ERROR write_error = (OWQ_pn(owq).selected_filetype->write) (owq); OWQ_Cache_Del(owq) ; // Delete anyways LEVEL_DEBUG("Write %s Extension %d Gives result %d",PN(owq)->path,PN(owq)->extension,write_error); return write_error; } /* Write just one field of an aggregate property -- but a property that is handled as one big object */ // Handles .n static ZERO_OR_ERROR FS_write_a_part( struct one_wire_query *owq_part ) { struct parsedname *pn = PN(owq_part); size_t extension = pn->extension; struct filetype * ft = pn->selected_filetype ; ZERO_OR_ERROR z_or_e ; struct one_wire_query * owq_all ; // bitfield if ( ft->format == ft_bitfield ) { return FS_write_a_bit( owq_part ) ; } // non-bitfield owq_all = OWQ_create_aggregate( owq_part ) ; if ( owq_all == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } // First fill the whole array with current values if ( FS_read_local( owq_all ) < 0 ) { OWQ_destroy( owq_all ) ; return -ENOENT ; } // Copy ascii/binary field switch (ft->format) { case ft_binary: case ft_ascii: case ft_vascii: case ft_alias: { size_t extension_index; size_t elements = ft->ag->elements; char *buffer_pointer = OWQ_buffer(owq_all); char *entry_pointer; char *target_pointer; // All prior elements for (extension_index = 0; extension_index < extension; ++extension) { // move past their buffer position buffer_pointer += OWQ_array_length(owq_all, extension_index); } entry_pointer = buffer_pointer; // this element's buffer start target_pointer = buffer_pointer + OWQ_length(owq_part); // new start next element buffer_pointer = buffer_pointer + OWQ_array_length(owq_all, extension); // current start next element // move rest of elements to new locations for (extension_index = extension + 1; extension_index < elements; ++extension) { size_t this_length = OWQ_array_length(owq_all, extension_index); memmove(target_pointer, buffer_pointer, this_length); target_pointer += this_length; buffer_pointer += this_length; } // now move current element's buffer to location memmove(entry_pointer, OWQ_buffer(owq_part), OWQ_length(owq_part)); OWQ_array_length(owq_all,extension) = OWQ_length(owq_part) ; } break; default: // Copy value field memcpy(&OWQ_array(owq_all)[pn->extension], &OWQ_val(owq_part), sizeof(union value_object)); break; } // Write whole thing out z_or_e = FS_write_owq(owq_all); OWQ_destroy(owq_all); return z_or_e ; } // Write a whole aggregate array (treated as a single large value ) // handles ALL static ZERO_OR_ERROR FS_write_all( struct one_wire_query * owq_all ) { // bitfield, convert to .BYTE format and write ( and delete cache ) as BYTE. if ( OWQ_pn(owq_all).selected_filetype->format == ft_bitfield ) { return FS_write_all_bits( owq_all ) ; } return FS_write_owq( owq_all ) ; } /* Takes ALL to individual, no need for the cache */ // Handles: ALL static ZERO_OR_ERROR FS_write_in_parts( struct one_wire_query *owq_all ) { struct one_wire_query * owq_part = OWQ_create_separate( 0, owq_all ) ; struct parsedname *pn = PN(owq_all); size_t elements = pn->selected_filetype->ag->elements; size_t extension ; char *buffer_pointer; ZERO_OR_ERROR z_or_e = 0 ; // Create a "single" OWQ copy to iterate with if ( owq_part == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } // create a buffer for certain types // point to 0th element's buffer first buffer_pointer = OWQ_buffer(owq_all); OWQ_size(owq_part) = FileLength(PN(owq_part)); OWQ_offset(owq_part) = 0; // loop through all eloements for (extension = 0; extension < elements; ++extension) { ZERO_OR_ERROR single_write; switch (pn->selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: OWQ_length(owq_part) = OWQ_array_length(owq_all,extension) ; OWQ_buffer(owq_part) = buffer_pointer; buffer_pointer += OWQ_length(owq_part); break; default: memcpy(&OWQ_val(owq_part), &OWQ_array(owq_all)[extension], sizeof(union value_object)); break; } OWQ_pn(owq_part).extension = extension; single_write = FS_write_owq(owq_part); if (single_write != 0) { z_or_e = single_write ; } } return z_or_e; } /* Write BYTE to bits */ // handles: BYTE static ZERO_OR_ERROR FS_write_as_bits( struct one_wire_query *owq_byte ) { struct one_wire_query * owq_bit = OWQ_create_separate( 0, owq_byte ) ; size_t elements = OWQ_pn(owq_byte).selected_filetype->ag->elements; size_t extension ; ZERO_OR_ERROR z_or_e = 0 ; if ( owq_bit == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } for ( extension = 0 ; extension < elements ; ++extension ) { ZERO_OR_ERROR z ; OWQ_pn(owq_bit).extension = extension ; OWQ_Y(owq_bit) = UT_getbit( (BYTE *) &OWQ_U(owq_byte), extension ) ; z = FS_write_owq( owq_bit ) ; if ( z != 0 ) { z_or_e = z ; } } OWQ_destroy( owq_bit ) ; return z_or_e ; } /* Write ALL to BYTE */ // Handles: ALL static ZERO_OR_ERROR FS_write_all_bits( struct one_wire_query *owq_all ) { struct one_wire_query * owq_byte = ALLtoBYTE( owq_all ) ; ZERO_OR_ERROR z_or_e = -ENOENT ; if ( owq_byte != NO_ONE_WIRE_QUERY ) { z_or_e = FS_write_owq( owq_byte ) ; OWQ_destroy( owq_byte ) ; } return z_or_e ; } /* Write a bit in a BYTE */ // Handles: .n static ZERO_OR_ERROR FS_write_a_bit(struct one_wire_query *owq_bit) { struct one_wire_query * owq_byte = OWQ_create_separate( EXTENSION_BYTE, owq_bit ) ; ZERO_OR_ERROR z_or_e = -ENOENT ; if ( owq_byte != NO_ONE_WIRE_QUERY ) { if ( FS_read_local( owq_byte ) >= 0 ) { UT_setbit( (BYTE *) &OWQ_U( owq_byte ), OWQ_pn(owq_bit).extension, OWQ_Y(owq_bit) ) ; z_or_e = FS_write_owq( owq_byte ) ; } OWQ_destroy( owq_byte ) ; } return z_or_e ; } // Used for sibling write -- bus already locked, and it's local ZERO_OR_ERROR FS_write_local(struct one_wire_query *owq) { return FS_w_local(owq); } owfs-2.8p15/module/owlib/src/c/ow_usb_msg.c0000644000175000017500000003327611754440273015554 00000000000000/* $Id: ow_usb_msg.c,v 1.14 2012/05/15 11:40:43 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* DS9490R-W USB 1-Wire master USB parameters: Vendor ID: 04FA ProductID: 2490 Dallas controller DS2490 */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_usb_cycle.h" #include "ow_usb_msg.h" #if OW_USB /* conditional inclusion of USB */ /* Extensive FreeBSD workarounds by Robert Nilsson */ /* Peter Radcliffe updated support for FreeBSD >= 8 */ #ifdef __FreeBSD__ // Add a few definitions we need #undef HAVE_USB_INTERRUPT_READ // This call in libusb is unneeded for FreeBSD (and it's broken) #if __FreeBSD__ < 8 #include #include #define USB_CLEAR_HALT BSD_usb_clear_halt #endif /* __FreeBSD__ < 8 */ #endif /* __FreeBSD__ */ #ifndef USB_CLEAR_HALT #define USB_CLEAR_HALT usb_clear_halt #endif /* USB_CLEAR_HALT */ #define CONTROL_REQUEST_TYPE 0x40 /** EP1 -- control read */ #define DS2490_EP1 0x81 /** EP2 -- bulk write */ #define DS2490_EP2 0x02 /** EP3 -- bulk read */ #define DS2490_EP3 0x83 char badUSBname[] = "-1:-1"; /* ------------------------------------------------------------ */ /* --- USB low-level communication -----------------------------*/ // Call to USB EP1 (control channel) // Names (bRequest, wValue wIndex) are from datasheet http://datasheets.maxim-ic.com/en/ds/DS2490.pdf GOOD_OR_BAD USB_Control_Msg(BYTE bRequest, UINT wValue, UINT wIndex, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; usb_dev_handle *usb = in->master.usb.usb; int ret ; if (usb == NULL) { return gbBAD; } ret = usb_control_msg(usb, CONTROL_REQUEST_TYPE, bRequest, wValue, wIndex, NULL, 0, in->master.usb.timeout); #if OW_SHOW_TRAFFIC fprintf(stderr, "TRAFFIC OUT bus=%d (%s)\n", in->index, SOC(in)->devicename ) ; fprintf(stderr, "\tbus name=%s request type=0x%.2X, wValue=0x%X, wIndex=0x%X, return code=%d\n",in->adapter_name, bRequest, wValue, wIndex, ret) ; #endif /* OW_SHOW_TRAFFIC */ if( ret < 0 ) { LEVEL_DEBUG("USB control problem = %d", ret) ; return gbBAD ; } return gbGOOD ; } #ifdef __FreeBSD__ // This is in here for versions of libusb on FreeBSD that do not support the usb_clear_halt function #if __FreeBSD__ < 8 int BSD_usb_clear_halt(usb_dev_handle * dev, unsigned int ep) { int ret; struct usb_ctl_request ctl_req; ctl_req.ucr_addr = 0; // Not used for this type of request ctl_req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT; ctl_req.ucr_request.bRequest = UR_CLEAR_FEATURE; USETW(ctl_req.ucr_request.wValue, UF_ENDPOINT_HALT); USETW(ctl_req.ucr_request.wIndex, ep); USETW(ctl_req.ucr_request.wLength, 0); ctl_req.ucr_flags = 0; if ((ret = ioctl(dev->file_descriptor, USB_DO_REQUEST, &ctl_req)) < 0) { LEVEL_DATA("DS9490_clear_halt: failed for %d", ep); } return ret; } #endif /* __FreeBSD__ < 8 */ #endif /* __FreeBSD__ */ RESET_TYPE DS9490_getstatus(BYTE * buffer, int * readlen, const struct parsedname *pn) { int ret, loops = 0; int i; struct connection_in * in = pn->selected_connection ; usb_dev_handle *usb = in->master.usb.usb; // Pretty ugly, but needed for SUSE at least // Try both HAVE_USB_INTERRUPT_READ #ifdef HAVE_USB_INTERRUPT_READ static int have_usb_interrupt_read = (1 == 1); #else /* HAVE_USB_INTERRUPT_READ */ static int have_usb_interrupt_read = (1 == 0); #endif /* HAVE_USB_INTERRUPT_READ */ static int count_have_usb_interrupt_read = 0; memset(buffer, 0, DS9490_getstatus_BUFFER_LENGTH ); // should not be needed #ifdef __FreeBSD__ // Clear the Interrupt read buffer before trying to get status { char junk[1500]; ret = usb_bulk_read(usb, DS2490_EP1, (ASCII *) junk, (size_t) 1500, in->master.usb.timeout) ; if ( ret < 0) { STAT_ADD1_BUS(e_bus_status_errors, in); LEVEL_DATA("error reading ret=%d", ret); return BUS_RESET_ERROR; } } #endif // __FreeBSD__ do { // Fix from Wim Heirman -- kernel 2.6 is fussier about endpoint type #ifdef HAVE_USB_INTERRUPT_READ if (have_usb_interrupt_read) { ret = usb_interrupt_read(usb, DS2490_EP1, (ASCII *) buffer, (size_t) 32, in->master.usb.timeout) ; if ( ret < 0 ) { LEVEL_DATA("(HAVE_USB_INTERRUPT_READ) error reading ret=%d", ret); } } else #endif { ret = usb_bulk_read(usb, DS2490_EP1, (ASCII *) buffer, (size_t) 32, in->master.usb.timeout) ; } if ( ret < 0 ) { LEVEL_DATA("(no HAVE_USB_INTERRUPT_READ) error reading ret=%d", ret); if (count_have_usb_interrupt_read != 0) { STAT_ADD1_BUS(e_bus_status_errors, in); return BUS_RESET_ERROR; } have_usb_interrupt_read = !have_usb_interrupt_read; count_have_usb_interrupt_read = 1; continue; } if (ret > 32 ) { LEVEL_DATA("Bad DS2490 status %d > 32",ret) ; return BUS_RESET_ERROR; } if (ret > 16) { if (ret == 32) { // FreeBSD buffers the input, so this could just be two readings if (!memcmp(buffer, &buffer[16], 6)) { memmove(buffer, &buffer[16], 16); ret = 16; LEVEL_DATA("Corrected buffer 32 byte read"); } } for (i = 16; i < ret; i++) { BYTE val = buffer[i]; if (val != ONEWIREDEVICEDETECT) { LEVEL_DATA("Status byte[%X]: %X", i - 16, val); } if (val & COMMCMDERRORRESULT_SH) { // short detected LEVEL_DATA("short detected"); return BUS_RESET_SHORT; } } } if (*readlen < 0) { break; /* Don't wait for STATUSFLAGS_IDLE if length==-1 */ } if (buffer[8] & STATUSFLAGS_IDLE) { #if OW_SHOW_TRAFFIC // See note below for register info LEVEL_DEBUG("USB status registers (Idle) EFlags:%u->SPU:%u Dspeed:%u,Speed:%u,SPUdur:%u, PDslew:%u, W1lowtime:%u, W0rectime:%u, DevState:%u, CC1:%u, CC2:%u, CCState:%u, DataOutState:%u, DataInState:%u", buffer[0], (buffer[0]&0x01), (buffer[0]&0x04 ? 1 : 0), buffer[1], buffer[2], buffer[4], buffer[5], buffer[6], buffer[8], buffer[9], buffer[10], buffer[11], buffer[12], buffer[13] ); #endif /* OW_SHOW_TRAFFIC */ if (*readlen > 0) { // we have enough bytes to read now! // buffer[13] == (ReadBufferStatus) if (buffer[13] >= *readlen) { break; } LEVEL_DEBUG("Problem with buffer[13]=%d and readlen[0]=%d",(int) buffer[13], (int) readlen[0] ) ; } else { break; } } else { #if OW_SHOW_TRAFFIC // See note below for register info LEVEL_DEBUG("USB status registers (Not idle) EFlags:%u->SPU:%u Dspeed:%u,Speed:%u,SPUdur:%u, PDslew:%u, W1lowtime:%u, W0rectime:%u, DevState:%u, CC1:%u, CC2:%u, CCState:%u, DataOutState:%u, DataInState:%u", buffer[0], (buffer[0]&0x01), (buffer[0]&0x04 ? 1 : 0), buffer[1], buffer[2], buffer[4], buffer[5], buffer[6], buffer[8], buffer[9], buffer[10], buffer[11], buffer[12], buffer[13] ); #endif /* OW_SHOW_TRAFFIC */ } // this value might be decreased later... if (++loops > 100) { LEVEL_DATA("never got idle StatusFlags=%X read=%X", buffer[8], buffer[13]); //reset USB device // probably should reset speed and any other parameters. USB_Control_Msg(CONTROL_CMD, CTL_RESET_DEVICE, 0x0000, pn) ; return BUS_RESET_ERROR; // adapter never got idle } /* Since result seem to be on the usb bus very quick, I sleep * sleep 0.1ms or something like that instead... It seems like * result is there after 0.2-0.3ms */ UT_delay_us(100); } while (1); if (ret < 16) { LEVEL_DATA("incomplete packet ret=%d", ret); return BUS_RESET_ERROR; // incomplete packet?? } *readlen = ret ; // pass this data back (used by reset) return BUS_RESET_OK ; } GOOD_OR_BAD DS9490_open(struct usb_list *ul, struct connection_in *in) { usb_dev_handle *usb; in->master.usb.dev = ul->dev; if (in->master.usb.dev ==NULL ) { return gbBAD ; } usb = usb_open(in->master.usb.dev) ; if (usb == NULL) { // intentional print to console fprintf(stderr, "Could not open the USB bus master. Is there a problem with permissions?\n"); // And log LEVEL_DEFAULT("Could not open the USB bus master. Is there a problem with permissions?"); STAT_ADD1_BUS(e_bus_open_errors, in); return gbBAD ; } in->master.usb.usb = usb; in->master.usb.usb_bus_number = ul->usb_bus_number ; in->master.usb.usb_dev_number = ul->usb_dev_number ; #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP usb_detach_kernel_driver_np(usb, 0); #endif /* LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP */ // store timeout value -- sec -> msec in->master.usb.timeout = 1000 * Globals.timeout_usb; if ( usb_set_configuration(usb, 1) != 0 ) { LEVEL_CONNECT("Failed to set configuration on USB DS9490 bus master at %s.", SOC(in)->devicename); } else if ( usb_claim_interface(usb, 0) != 0 ) { LEVEL_CONNECT("Failed to claim interface on USB DS9490 bus master at %s.", SOC(in)->devicename); } else { if ( usb_set_altinterface(usb, 3) != 0 ) { LEVEL_CONNECT("Failed to set alt interface on USB DS9490 bus master at %s.", SOC(in)->devicename); } else { LEVEL_DEFAULT("Opened USB DS9490 bus master at %s.", SOC(in)->devicename); // clear endpoints if ( USB_CLEAR_HALT(usb, DS2490_EP3) || USB_CLEAR_HALT(usb, DS2490_EP2) || USB_CLEAR_HALT(usb, DS2490_EP1) ) { LEVEL_DEFAULT("USB_CLEAR_HALT failed"); } else { /* All GOOD */ return gbGOOD; } } usb_release_interface(usb, 0); } usb_close(usb); in->master.usb.usb = NULL; LEVEL_DEBUG("Did not successfully open DS9490 %s -- permission problem?",SOC(in)->devicename) ; STAT_ADD1_BUS(e_bus_open_errors, in); return gbBAD; } void DS9490_close(struct connection_in *in) { usb_dev_handle *usb = in->master.usb.usb; if (usb != NULL) { int ret = usb_release_interface(usb, 0); if (ret) { in->master.usb.dev = NULL; // force a re-scan LEVEL_CONNECT("Release interface (USB) failed ret=%d", ret); } /* It might already be closed? (returning -ENODEV) * I have seen problem with calling usb_close() twice, so we * might perhaps skip it if usb_release_interface() fails */ ret = usb_close(usb); if (ret) { in->master.usb.dev = NULL; // force a re-scan LEVEL_CONNECT("usb_close() failed ret=%d", ret); } LEVEL_CONNECT("Closed USB DS9490 bus master at %s. ret=%d", SOC(in)->devicename, ret); } in->master.usb.usb = NULL; in->master.usb.dev = NULL; SAFEFREE(SOC(in)->devicename) ; SOC(in)->devicename = owstrdup(badUSBname); } /* ------------------------------------------------------------ */ /* --- USB read and write --------------------------------------*/ SIZE_OR_ERROR DS9490_read(BYTE * buf, size_t size, const struct parsedname *pn) { SIZE_OR_ERROR ret; struct connection_in * in = pn->selected_connection ; usb_dev_handle *usb = in->master.usb.usb; if ((ret = usb_bulk_read(usb, DS2490_EP3, (ASCII *) buf, (int) size, in->master.usb.timeout)) > 0) { TrafficIn("read",buf,size,pn->selected_connection) ; return ret; } LEVEL_DATA("failed ret=%d", ret); USB_CLEAR_HALT(usb, DS2490_EP3); STAT_ADD1_BUS(e_bus_read_errors, in); return ret; } /* Fills the EP2 buffer in the USB adapter returns number of bytes (size) or <0 for an error */ SIZE_OR_ERROR DS9490_write(const BYTE * buf, size_t size, const struct parsedname *pn) { SIZE_OR_ERROR ret; struct connection_in * in = pn->selected_connection ; usb_dev_handle *usb = in->master.usb.usb; if (size == 0) { return 0; } ret = usb_bulk_write(usb, DS2490_EP2, (ASCII *) buf, (int) size, in->master.usb.timeout) ; if ( ret < 0 ) { LEVEL_DATA("failed ret=%d", ret); USB_CLEAR_HALT(usb, DS2490_EP2); STAT_ADD1_BUS(e_bus_write_errors, in); } TrafficOut("write",buf,size,pn->selected_connection); return ret; } // Notes from Michael Markstaller: /* Datasheet DS2490 page 29 table 16 0: Enable Flags: SPUE=1(bit0) If set to 1, the strong pullup to 5V is enabled, if set to 0, it is disabled. bit1 should be 0 but is 1 ?! SPCE = 4(bit2) If set to 1, a dynamic 1-Wire bus speed change through a Communication command is enabled, if set to 0, it is disabled. 1: 1-Wire Speed 2: Strong Pullup Duration 3: (Reserved) 4: Pulldown Slew Rate 5: Write-1 Low Time 6: Data Sample Offset / Write-0 Recovery Time 7: reserved 8: Device Status Flags: bit0: SPUA if set to 1, the strong pullup to 5V is currently active, if set to 0, it is inactive. bit3(8): PMOD if set to 1, the DS2490 is powered from USB and external sources, if set to 0, all DS2490 power is provided from USB. FIXME: expose this to clients to check! bit4(16): HALT if set to 1, the DS2490 is currently halted, if set to 0, the device is not halted. bit5(32): IDLE if set to 1, the DS2490 is currently idle, if set to 0, the device is not idle. bit5(64): EPOF: Endpoint 0 FIFO status, see: If EP0F is set to 1, the Endpoint 0 FIFO was full when a new control transfer setup packet was received. This is an error condition in that the setup packet received is discarded due to the full condition. To recover from this state the USB host must send a CTL_RESET_DEVICE command; the device will also recover with a power on reset cycle. Note that the DS2490 will accept and process a CTL_RESET_DEVICE command if the EP0F = 1 state occurs. If EP0F = 0, no FIFO error condition exists. 9: Communication Command, Byte 1 10: Communication Command, Byte 2 11: Communication Command Buffer Status 12: 1-Wire Data Out Buffer Status 13: 1-Wire Data In Buffer Status */ #endif /* OW_USB */ owfs-2.8p15/module/owlib/src/c/ow_reconnect.c0000664000175000017500000000400111614063627016056 00000000000000/* $Id: ow_reconnect.c,v 1.29 2011/07/27 19:31:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* Tests whether this bus (pn->selected_connection) has too many consecutive reset errors */ /* If so, the bus is closed and "reconnected" */ /* Reconnection usually just means reopening (detect) with the same initial name like ttyS0 */ /* USB is a special case, in gets reenumerated, so we look for similar DS2401 chip */ GOOD_OR_BAD TestConnection(const struct parsedname *pn) { GOOD_OR_BAD ret = 0; struct connection_in *in ; if ( pn == NO_PARSEDNAME ) { return gbGOOD ; } in = pn->selected_connection ; if ( in == NO_CONNECTION ) { return gbGOOD ; } // Test without a lock -- efficient if ( in->reconnect_state < reconnect_error ) { return gbGOOD; } // Lock the bus BUSLOCK(pn); // Test again if (in->reconnect_state >= reconnect_error) { // Add Statistics STAT_ADD1_BUS(e_bus_reconnects, in); // Close the bus (should leave enough reconnection information available) BUS_close(in); // already locked // Call reconnection in->AnyDevices = anydevices_unknown ; if ( in->iroutines.reconnect != NO_RECONNECT_ROUTINE ) { // reconnect method exists ret = (in->iroutines.reconnect) (pn) ; // call bus-specific reconnect } else { ret = BUS_detect(in) ; // call initial opener } if ( BAD( ret ) ) { in->reconnect_state = reconnect_ok + 1 ; // delay to slow thrashing UT_delay(200); } else { in->reconnect_state = reconnect_ok; } } BUSUNLOCK(pn); if ( BAD( ret ) ) { LEVEL_DEFAULT("Failed to reconnect %s bus master!", in->adapter_name); } else { LEVEL_DEFAULT("%s bus master reconnected", in->adapter_name); } return ret; } owfs-2.8p15/module/owlib/src/c/ow_read_external.c0000644000175000017500000001046711740204352016716 00000000000000/* $Id: ow_read_external.c,v 1.5 2012/04/08 03:41:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_external.h" /* strategy for external read: A common read function for all communication schemes e.g. script The actual device record and actual family record is obtained from the trees. The script is called (via popen) or other method for other types The device should be locked for the communication arguments include fields from the tree records and owq the returned value is obvious */ static ZERO_OR_ERROR OW_trees_for_read( char * device, char * property, struct one_wire_query * owq ) ; static ZERO_OR_ERROR OW_read_external_script( struct sensor_node * sensor_n, struct property_node * property_n, struct one_wire_query * owq ) ; static ZERO_OR_ERROR OW_script_read( FILE * script_f, struct one_wire_query * owq ) ; // ------------------------ ZERO_OR_ERROR FS_r_external( struct one_wire_query * owq ) { ZERO_OR_ERROR zoe = -ENOENT ; // default char * device_property = owstrdup( PN(owq)->device_name ) ; // copy of device/property part of path if ( device_property != NULL ) { char * property = device_property ; char * device = strsep( &property, "/" ) ; // separate out property char * extension = property ; if ( property != NULL ) { // pare off extension property = strsep( &extension, "." ) ; } zoe = OW_trees_for_read( device, property, owq ) ; owfree( device_property ) ; // clean up } return zoe ; } static ZERO_OR_ERROR OW_trees_for_read( char * device, char * property, struct one_wire_query * owq ) { // find sensor node struct sensor_node * sense_n = Find_External_Sensor( device ) ; if ( sense_n != NULL ) { // found // find property node struct property_node * property_n = Find_External_Property( sense_n->family, property ) ; if ( property_n != NULL ) { switch ( property_n->et ) { case et_none: return 0 ; case et_internal: return -ENOTSUP ; case et_script: return OW_read_external_script( sense_n, property_n, owq ) ; default: return -ENOTSUP ; } } } return -ENOENT ; } static ZERO_OR_ERROR OW_read_external_script( struct sensor_node * sensor_n, struct property_node * property_n, struct one_wire_query * owq ) { char cmd[PATH_MAX+1] ; struct parsedname * pn = PN(owq) ; FILE * script_f ; int snp_return ; ZERO_OR_ERROR zoe ; // load the command script and arguments if ( pn->sparse_name == NULL ) { // not a text sparse name snp_return = snprintf( cmd, PATH_MAX+1, "%s %s %s %d %s %d %d %s %s", property_n->read, // command sensor_n->name, // sensor name property_n->property, // property, pn->extension, // extension "read", // mode (int) OWQ_size(owq), // size (int) OWQ_offset(owq), // offset sensor_n->data, // sensor-specific data property_n->data // property-specific data ) ; } else { snp_return = snprintf( cmd, PATH_MAX+1, "%s %s %s %s %s %d %d %s %s", property_n->read, // command sensor_n->name, // sensor name property_n->property, // property, pn->sparse_name, // extension "read", // mode (int) OWQ_size(owq), // size (int) OWQ_offset(owq), // offset sensor_n->data, // sensor-specific data property_n->data // property-specific data ) ; } if ( snp_return < 0 ) { LEVEL_DEBUG("Problem creating script string for %s/%s",sensor_n->name,property_n->property) ; return -EINVAL ; } script_f = popen( cmd, "r" ) ; if ( script_f == NULL ) { ERROR_DEBUG("Cannot create external program link for reading %s/%s",sensor_n->name,property_n->property); return -EIO ; } zoe = OW_script_read( script_f, owq ) ; fclose( script_f ) ; return zoe ; } static ZERO_OR_ERROR OW_script_read( FILE * script_f, struct one_wire_query * owq ) { size_t fr_return ; memset( OWQ_buffer(owq), 0, OWQ_size(owq) ) ; fr_return = fread( OWQ_buffer(owq), OWQ_size(owq), 1, script_f ) ; if ( fr_return == 0 && ferror(script_f) != 0 ) { LEVEL_DEBUG( "Could not read script data back for %s",PN(owq)->path ) ; return -EIO ; } return OWQ_parse_input( owq ) ; } owfs-2.8p15/module/owlib/src/c/ow_util.c0000664000175000017500000000611511554166177015072 00000000000000/* $Id: ow_util.c,v 1.28 2011/04/22 02:48:31 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" /* * HEXVALUE() is defined in , but since it's more * common with 0-9 I changed compare-order in the define */ #define _HEXVALUE(c) \ (((c) >= '0' && (c) <= '9') \ ? (c)-'0' \ : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'a'+10 ) /* 2 hex digits to number. This is the most used function in owfs for the LINK */ BYTE string2num(const char *s) { if (s == NULL) { return 0; } return (_HEXVALUE(s[0]) << 4) + _HEXVALUE(s[1]); } //#define _TOHEXCHAR(c) (((c) >= 0 && (c) <= 9) ? '0'+(c) : 'A'+(c)-10 ) // we only use a nibble #define _TOHEXCHAR(c) (((c) <= 9) ? '0'+(c) : ('A'-10)+(c) ) #if 0 /* number to a hex digit */ char num2char(const BYTE n) { return _TOHEXCHAR(n); } #endif /* number to 2 hex digits */ void num2string(char *s, const BYTE n) { s[0] = _TOHEXCHAR(n >> 4); s[1] = _TOHEXCHAR(n & 0x0F); } /* 2x hex digits to x number bytes */ void string2bytes(const char *str, BYTE * b, const int bytes) { int i; for (i = 0; i < bytes; ++i) { b[i] = string2num(&str[i << 1]); } } /* number(x bytes) to 2x hex digits */ void bytes2string(char *str, const BYTE * b, const int bytes) { int i; for (i = 0; i < bytes; ++i) { num2string(&str[i << 1], b[i]); } } // #define UT_getbit(buf, loc) ( ( (buf)[(loc)>>3]>>((loc)&0x7) ) &0x01 ) int UT_getbit(const BYTE * buf, const int loc) { return (((buf[loc >> 3]) >> (loc & 0x7)) & 0x01); } int UT_get2bit(const BYTE * buf, const int loc) { return (((buf[loc >> 2]) >> ((loc & 0x3) << 1)) & 0x03); } void UT_setbit(BYTE * buf, const int loc, const int bit) { if (bit) { buf[loc >> 3] |= 0x01 << (loc & 0x7); } else { buf[loc >> 3] &= ~(0x01 << (loc & 0x7)); } } void UT_set2bit(BYTE * buf, const int loc, const int bits) { BYTE *p = &buf[loc >> 2]; switch (loc & 3) { case 0: *p = (*p & 0xFC) | bits; return; case 1: *p = (*p & 0xF3) | (bits << 2); return; case 2: *p = (*p & 0xCF) | (bits << 4); return; case 3: *p = (*p & 0x3F) | (bits << 6); return; } } void UT_fromDate(const _DATE d, BYTE * data) { data[0] = BYTE_MASK(d); data[1] = BYTE_MASK(d >> 8); data[2] = BYTE_MASK(d >> 16); data[3] = BYTE_MASK(d >> 24); } _DATE UT_toDate(const BYTE * data) { return (_DATE) UT_uint32(data); } void Test_and_Close( FILE_DESCRIPTOR_OR_ERROR * file_descriptor ) { if ( file_descriptor == NULL ) { return ; } if ( FILE_DESCRIPTOR_VALID( *file_descriptor ) ) { close( *file_descriptor ) ; } *file_descriptor = FILE_DESCRIPTOR_BAD ; } void Test_and_Close_Pipe( FILE_DESCRIPTOR_OR_ERROR * pipe_fd ) { Test_and_Close( &pipe_fd[fd_pipe_read]) ; Test_and_Close( &pipe_fd[fd_pipe_write]) ; } void Init_Pipe( FILE_DESCRIPTOR_OR_ERROR * pipe_fd ) { pipe_fd[fd_pipe_read] = pipe_fd[fd_pipe_write] = FILE_DESCRIPTOR_BAD ; } owfs-2.8p15/module/owlib/src/c/ow_cache.c0000644000175000017500000014036311731463642015154 00000000000000/* $Id: ow_cache.c,v 1.139 2012/03/18 11:19:10 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ // 8/18/2004 -- applied Serg Oskin's correction // 8/20/2004 -- changed everything, specifically no longer using db, tsearch instead! #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" //#define CACHE_DEBUG #if OW_CACHE #include #define EXTENSION_INTERNAL -2 // Directories are bus-specific, but buses are dynamic // The numbering is sequential, however, so use that and an arbitrary // generic unique address for directories. int DirMarkerLoc ; void * Directory_Marker = &DirMarkerLoc ; int AuxDirMarkerLoc ; void * AuxDirectory_Marker = &AuxDirMarkerLoc ; int MainDirMarkerLoc ; void * MainDirectory_Marker = &MainDirMarkerLoc ; // Devices are sn-based // generic unique address for devices. int DevMarkerLoc ; void * Device_Marker = &DevMarkerLoc ; // Aliases are sn-based // generic unique address for devices. int AliasMarkerLoc ; void * Alias_Marker = &AliasMarkerLoc ; // Simultaneous Dir are bus-based // generic unique address for Simultaneous. int SimulMarkerLoc[simul_end] ; void * Simul_Marker[] = { &SimulMarkerLoc[simul_temp], &SimulMarkerLoc[simul_volt], } ; /* Put the globals into a struct to declutter the namespace */ struct cache_data { void *temporary_tree_new; // current cache database void *temporary_tree_old; // older cache database void *persistent_tree; // persistent database void *temporary_alias_tree_new; // current cache database void *temporary_alias_tree_old; // older cache database void *persistent_alias_tree; // persistent database size_t old_ram_size; // cache size size_t new_ram_size; // cache size time_t time_retired; // start time of older time_t time_to_kill; // deathtime of older time_t retired_lifespan; // lifetime of older UINT added; // items added }; static struct cache_data cache; /* Cache elements are placed in a Red/Black binary tree -- standard glibc implementation -- use gnu tdestroy extension -- compatibility implementation included Cache key has 3 components: (struct tree_key) sn -- 8 byte serial number of 1-wire slave p -- pointer to internal structure like filetype (guaranteed unique if non-portable) extension -- integer used for array elements Cache node is the entire node not including data payload (struct key_node) key -- sorted component as above expires -- the time that the element is no longer valid dsize -- length in bytes of trailing data Cache data is the actual data allocated at same call as cache node access via macro TREE_DATA freed when cache node is freed Note: This means that cache data must be a copy of program data both on creation and retrieval */ /* Key used for sorting/retrieving cache data sn is for device serial number p is a pointer to filetype, or other things (guaranteed unique and fast lookup extension is used for indexed array properties */ struct tree_key { BYTE sn[8]; void *p; int extension; }; /* How we organize the data in the binary tree used for cache storage A key (see above) An expiration time And a size in bytes Actaully size bytes follows with the data */ struct tree_node { struct tree_key tk; time_t expires; size_t dsize; }; struct alias_tree_node { size_t size; time_t expires; union { INDEX_OR_ERROR bus; BYTE sn[SERIAL_NUMBER_SIZE]; } ; }; /* Bad bad C library */ /* implementation of tfind, tsearch returns an opaque structure */ /* you have to know that the first element is a pointer to your data */ struct tree_opaque { struct tree_node *key; void *other; }; #define TREE_DATA(tn) ( (BYTE *)(tn) + sizeof(struct tree_node) ) #define CONST_TREE_DATA(tn) ( (const BYTE *)(tn) + sizeof(struct tree_node) ) #define ALIAS_TREE_DATA(atn) ( (ASCII *)(atn) + sizeof(struct alias_tree_node) ) #define CONST_ALIAS_TREE_DATA(atn) ( (const ASCII *)(atn) + sizeof(struct alias_tree_node) ) enum cache_task_return { ctr_ok, ctr_not_found, ctr_expired, ctr_size_mismatch, } ; static void FlipTree( void ) ; static int IsThisPersistent( const struct parsedname * pn ) ; static GOOD_OR_BAD Cache_Add(const void *data, const size_t datasize, const struct parsedname *pn); static GOOD_OR_BAD Cache_Add_Common(struct tree_node *tn); static GOOD_OR_BAD Cache_Add_Persistent(struct tree_node *tn); static enum cache_task_return Cache_Get_Common(void *data, size_t * dsize, time_t * duration, const struct tree_node *tn); static enum cache_task_return Cache_Get_Common_Dir(struct dirblob *db, time_t * duration, const struct tree_node *tn); static enum cache_task_return Cache_Get_Persistent(void *data, size_t * dsize, time_t * duration, const struct tree_node *tn); static GOOD_OR_BAD Cache_Get_Simultaneous(enum simul_type type, struct one_wire_query *owq) ; static GOOD_OR_BAD Cache_Get_Internal(void *data, size_t * dsize, const struct internal_prop *ip, const struct parsedname *pn); static GOOD_OR_BAD Cache_Get_Strict(void *data, size_t dsize, const struct parsedname *pn); static void Cache_Del(const struct parsedname *pn) ; static GOOD_OR_BAD Cache_Del_Common(const struct tree_node *tn); static GOOD_OR_BAD Cache_Del_Persistent(const struct tree_node *tn); static void Cache_Add_Alias_Common(struct alias_tree_node *atn); static INDEX_OR_ERROR Cache_Get_Alias_Common( struct alias_tree_node * atn) ; static void Cache_Add_Alias_SN(const ASCII * alias_name, const BYTE * sn) ; static void Cache_Del_Alias_SN(const ASCII * alias_name) ; static void Cache_Add_Alias_Persistent(struct alias_tree_node *atn); static enum cache_task_return Cache_Get_Alias_Persistent( BYTE * sn, struct alias_tree_node * atn); static void Cache_Del_Alias_Persistent( struct alias_tree_node * atn) ; static GOOD_OR_BAD Add_Stat(struct cache_stats *scache, GOOD_OR_BAD result); static GOOD_OR_BAD Get_Stat(struct cache_stats *scache, const enum cache_task_return result); static void Del_Stat(struct cache_stats *scache, const int result); static int tree_compare(const void *a, const void *b); static time_t TimeOut(const enum fc_change change); static void Aliaslistaction(const void *node, const VISIT which, const int depth) ; static void LoadTK( const BYTE * sn, void * p, int extension, struct tree_node * tn ) ; /* used for the sort/search b-tree routines */ /* big voodoo pointer fuss to just do a standard memory compare of the "key" */ static int tree_compare(const void *a, const void *b) { return memcmp(&((const struct tree_node *) a)->tk, &((const struct tree_node *) b)->tk, sizeof(struct tree_key)); } /* used for the sort/search b-tree routines */ /* big voodoo pointer fuss to just do a standard memory compare of the "key" */ static int alias_tree_compare(const void *a, const void *b) { int da = ((const struct alias_tree_node *) a)->size ; int d = da - ((const struct alias_tree_node *) b)->size ; if ( d != 0 ) { return d ; } return memcmp( CONST_ALIAS_TREE_DATA((const struct alias_tree_node *) a), CONST_ALIAS_TREE_DATA((const struct alias_tree_node *) b), da); } /* Gives the delay for a given property type */ /* Values in seconds (as defined in Globals structure and modified by command line and "settings") */ static time_t TimeOut(const enum fc_change change) { switch (change) { case fc_second: case fc_persistent: /* arbitrary non-zero */ return 1; case fc_volatile: case fc_simultaneous_temperature: case fc_simultaneous_voltage: return Globals.timeout_volatile; case fc_stable: case fc_read_stable: return Globals.timeout_stable; case fc_presence: return Globals.timeout_presence; case fc_directory: return Globals.timeout_directory; case fc_link: case fc_page: case fc_subdir: default: /* static or statistic */ return 0; } } #ifdef CACHE_DEBUG /* debug routine -- shows a table */ /* Run it as twalk(dababase, tree_show ) */ static void node_show(struct tree_node *tn) { int i; char b[26]; ctime_r(&tn->expires, b); fprintf(stderr,"\tNode " SNformat " pointer=%p extension=%d length=%d start=%p expires=%s", SNvar(tn->tk.sn), tn->tk.p, tn->tk.extension, tn->dsize, tn, b ? b : "null\n"); for (i = 0; i < sizeof(struct tree_key); ++i) { fprintf(stderr,"%.2X ", ((uint8_t *) tn)[i]); } fprintf(stderr,"\n"); } static void tree_show(const void *node, const VISIT which, const int depth) { const struct tree_node *tn = *(struct tree_node * *) node; (void) depth; if (node) { switch (which) { case leaf: case postorder: node_show(tn); // fall through default: break; } } else { fprintf(stderr,"Node empty\n"); } } static void new_tree(void) { fprintf(stderr,"Walk the new tree:\n"); twalk(cache.temporary_tree_new, tree_show); } #else /* CACHE_DEBUG */ #define new_tree() #define node_show(tn) #endif /* CACHE_DEBUG */ static int IsThisPersistent( const struct parsedname * pn ) { return ( (pn->selected_filetype->change==fc_persistent) || get_busmode(pn->selected_connection)==bus_mock ) ; } /* DB cache creation code */ /* Note: done in single-threaded mode so locking not yet needed */ void Cache_Open(void) { memset(&cache, 0, sizeof(struct cache_data)); cache.retired_lifespan = TimeOut(fc_stable); if (cache.retired_lifespan > 3600) { cache.retired_lifespan = 3600; /* 1 hour tops */ } // Flip once (at start) to set up old tree. FlipTree() ; } /* Note: done in a simgle single thread mode so locking not needed */ void Cache_Close(void) { Cache_Clear() ; SAFETDESTROY( cache.persistent_tree, owfree_func); SAFETDESTROY( cache.persistent_alias_tree, owfree_func); } /* Moves new to old tree, initializes new tree, and clears former old tree location */ static void FlipTree( void ) { void * flip = cache.temporary_tree_old; // old old saved for later clearing void * flip_alias = cache.temporary_alias_tree_old; // old old saved for later clearing /* Flip caches! old = new. New truncated, reset time and counters and flag */ LEVEL_DEBUG("Flipping cache tree (purging timed-out data)"); // move "new" pointers to "old" cache.temporary_tree_old = cache.temporary_tree_new; cache.old_ram_size = cache.new_ram_size; cache.temporary_alias_tree_old = cache.temporary_alias_tree_new; // New cache setup cache.temporary_tree_new = NULL; cache.temporary_alias_tree_new = NULL; cache.new_ram_size = 0; cache.added = 0; // set up "old" cache times cache.time_retired = NOW_TIME; cache.time_to_kill = cache.time_retired + cache.retired_lifespan; // delete really old tree LEVEL_DEBUG("flip cache. tdestroy() will be called."); SAFETDESTROY( flip, owfree_func); SAFETDESTROY( flip_alias, owfree_func); STATLOCK; ++cache_flips; /* statistics */ memcpy(&old_avg, &new_avg, sizeof(struct average)); AVERAGE_CLEAR(&new_avg); STATUNLOCK; } /* Clear the cache (a change was made that might give stale information) */ void Cache_Clear(void) { CACHE_WLOCK; FlipTree() ; FlipTree() ; CACHE_WUNLOCK; } /* Wrapper to perform a cache function and add statistics */ static GOOD_OR_BAD Add_Stat(struct cache_stats *scache, GOOD_OR_BAD result) { if ( GOOD(result) ) { STAT_ADD1(scache->adds); } return result; } /* Higher level add of a one-wire-query object */ GOOD_OR_BAD OWQ_Cache_Add(const struct one_wire_query *owq) { const struct parsedname *pn = PN(owq); if (pn->extension == EXTENSION_ALL) { switch (pn->selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: return gbBAD; // cache of string arrays not supported case ft_integer: case ft_unsigned: case ft_yesno: case ft_date: case ft_float: case ft_pressure: case ft_temperature: case ft_tempgap: LEVEL_DEBUG("Adding data for %s", SAFESTRING(pn->path) ); return Cache_Add(OWQ_array(owq), (pn->selected_filetype->ag->elements) * sizeof(union value_object), pn); default: return gbBAD; } } else { switch (pn->selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: if (OWQ_offset(owq) > 0) { return gbBAD; } LEVEL_DEBUG("Adding data for %s", SAFESTRING(pn->path) ); return Cache_Add(OWQ_buffer(owq), OWQ_length(owq), pn); case ft_integer: case ft_unsigned: case ft_yesno: case ft_date: case ft_float: case ft_pressure: case ft_temperature: case ft_tempgap: LEVEL_DEBUG("Adding data for %s", SAFESTRING(pn->path) ); return Cache_Add(&OWQ_val(owq), sizeof(union value_object), pn); default: return gbBAD; } } } /* Add an item to the cache */ /* return 0 if good, 1 if not */ static GOOD_OR_BAD Cache_Add(const void *data, const size_t datasize, const struct parsedname *pn) { struct tree_node *tn; time_t duration; int persistent ; if (!pn || IsAlarmDir(pn)) { return gbGOOD; // do check here to avoid needless processing } // Special handling of Mock persistent = IsThisPersistent(pn) ; if ( persistent ) { duration = 1 ; } else { duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { return gbGOOD; /* in case timeout set to 0 */ } } // allocate space for the node and data tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + datasize); if (!tn) { return gbBAD; } LEVEL_DEBUG(SNformat " size=%d", SNvar(pn->sn), (int) datasize); // populate the node structure with data LoadTK( pn->sn, pn->selected_filetype, pn->extension, tn ); tn->expires = duration + NOW_TIME; tn->dsize = datasize; if (datasize) { memcpy(TREE_DATA(tn), data, datasize); } return persistent ? Add_Stat(&cache_pst, Cache_Add_Persistent(tn)) : Add_Stat(&cache_ext, Cache_Add_Common(tn)) ; } /* Add a directory entry to the cache */ /* return 0 if good, 1 if not */ GOOD_OR_BAD Cache_Add_Dir(const struct dirblob *db, const struct parsedname *pn) { time_t duration = TimeOut(fc_directory); struct tree_node *tn; size_t size = DirblobElements(db) * SERIAL_NUMBER_SIZE; struct parsedname pn_directory; if (pn==NO_PARSEDNAME || pn->selected_connection==NO_CONNECTION) { return gbGOOD; // do check here to avoid needless processing } switch ( pn->selected_connection->busmode ) { case bus_fake: case bus_tester: case bus_mock: case bus_w1: case bus_bad: case bus_unknown: return gbGOOD ; default: break ; } if (duration <= 0) { return 0; /* in case timeout set to 0 */ } if ( DirblobElements(db) < 1 ) { // only cache long directories. // zero (or one?) entry is possibly an error and needs to be repeated more quickly LEVEL_DEBUG("Won\'t cache empty directory"); Cache_Del_Dir( pn ) ; return gbGOOD ; } // allocate space for the node and data tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + size); if (!tn) { return gbBAD; } LEVEL_DEBUG("Adding directory for " SNformat " elements=%d", SNvar(pn->sn), DirblobElements(db)); // populate node with directory name and dirblob FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK( pn_directory.sn, Directory_Marker, pn->selected_connection->index, tn ); tn->expires = duration + NOW_TIME; tn->dsize = size; if (size) { memcpy(TREE_DATA(tn), db->snlist, size); } return Add_Stat(&cache_dir, Cache_Add_Common(tn)); } /* Add a Simultaneous entry to the cache */ /* return 0 if good, 1 if not */ GOOD_OR_BAD Cache_Add_Simul(const enum simul_type type, const struct parsedname *pn) { // Note: pn already points to directory time_t duration = TimeOut(fc_volatile); struct tree_node *tn; if (pn==NO_PARSEDNAME || pn->selected_connection==NO_CONNECTION) { return gbGOOD; // do check here to avoid needless processing } switch ( pn->selected_connection->busmode ) { case bus_fake: case bus_tester: case bus_mock: case bus_bad: case bus_unknown: return gbGOOD ; default: break ; } if (duration <= 0) { return gbGOOD; /* in case timeout set to 0 */ } // allocate space for the node and data LEVEL_DEBUG("Adding for conversion time for "SNformat, SNvar(pn->sn)); tn = (struct tree_node *) owmalloc(sizeof(struct tree_node)); if (!tn) { return gbBAD; } LEVEL_DEBUG(SNformat, SNvar(pn->sn)); // populate node with directory name and dirblob LoadTK( pn->sn, Simul_Marker[type], pn->selected_connection->index, tn) ; LEVEL_DEBUG("Simultaneous add type=%d",type); tn->expires = duration + NOW_TIME; tn->dsize = 0; return Add_Stat(&cache_dir, Cache_Add_Common(tn)); } /* Add a device entry to the cache */ /* return 0 if good, 1 if not */ GOOD_OR_BAD Cache_Add_Device(const int bus_nr, const BYTE * sn) { time_t duration = TimeOut(fc_presence); struct tree_node *tn; if (duration <= 0) { return gbGOOD; /* in case timeout set to 0 */ } if ( sn[0] == 0 ) { //bad serial number return gbGOOD ; } tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + sizeof(int)); if (!tn) { return gbBAD; } LEVEL_DEBUG("Adding device location " SNformat " bus=%d", SNvar(sn), (int) bus_nr); LoadTK(sn, Device_Marker, 0, tn ); tn->expires = duration + NOW_TIME; tn->dsize = sizeof(int); memcpy(TREE_DATA(tn), &bus_nr, sizeof(int)); return Add_Stat(&cache_dev, Cache_Add_Common(tn)); } /* What do we cache? Type sn extension p What directory 0=root 0 *in dirblob DS2409_branch 0 *in dirblob device device sn EXTENSION_DEVICE=-1 NULL bus_nr internal device sn EXTENSION_INTERNAL=-2 ip->name binary data property device sn extension *ft binary data */ /* Add an item to the cache */ /* return 0 if good, 1 if not */ GOOD_OR_BAD Cache_Add_SlaveSpecific(const void *data, const size_t datasize, const struct internal_prop *ip, const struct parsedname *pn) { struct tree_node *tn; time_t duration; //printf("Cache_Add_SlaveSpecific\n"); if (!pn) { return gbGOOD; // do check here to avoid needless processing } duration = TimeOut(ip->change); if (duration <= 0) { return gbGOOD; /* in case timeout set to 0 */ } tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + datasize); if (!tn) { return gbBAD; } LEVEL_DEBUG("Adding internal data for "SNformat " size=%d", SNvar(pn->sn), (int) datasize); LoadTK( pn->sn, ip->name, EXTENSION_INTERNAL, tn ); tn->expires = duration + NOW_TIME; tn->dsize = datasize; if (datasize) { memcpy(TREE_DATA(tn), data, datasize); } //printf("ADD INTERNAL name= %s size=%d \n",tn->tk.p.nm,tn->dsize); //printf(" ADD INTERNAL data[0]=%d size=%d \n",((BYTE *)data)[0],datasize); switch (ip->change) { case fc_persistent: return Add_Stat(&cache_pst, Cache_Add_Persistent(tn)); default: return Add_Stat(&cache_int, Cache_Add_Common(tn)); } } /* Add an item to the cache */ /* return 0 if good, 1 if not */ GOOD_OR_BAD Cache_Add_Alias(const ASCII *name, const BYTE * sn) { struct tree_node *tn; size_t size = strlen(name) ; if ( size == 0 ) { return gbGOOD ; } tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + size + 1 ); if (!tn) { return gbBAD; } LEVEL_DEBUG("Adding alias for " SNformat " = %s", SNvar(sn), name); LoadTK( sn, Alias_Marker, 0, tn ); tn->expires = NOW_TIME; tn->dsize = size; memcpy((ASCII *)TREE_DATA(tn), name, size+1 ); // includes NULL Cache_Add_Alias_SN( name, sn ) ; return Add_Stat(&cache_pst, Cache_Add_Persistent(tn)); } /* Add an item to the cache */ /* retire the cache (flip) if too old, and start a new one (keep the old one for a while) */ /* return 0 if good, 1 if not */ static GOOD_OR_BAD Cache_Add_Common(struct tree_node *tn) { struct tree_opaque *opaque; enum { no_add, yes_add, just_update } state = no_add; node_show(tn); LEVEL_DEBUG("Add to cache sn " SNformat " pointer=%p index=%d size=%d", SNvar(tn->tk.sn), tn->tk.p, tn->tk.extension, tn->dsize); CACHE_WLOCK; if (cache.time_to_kill < NOW_TIME) { // old database has timed out FlipTree() ; } if (Globals.cache_size && (cache.old_ram_size + cache.new_ram_size > Globals.cache_size)) { // failed size test owfree(tn); } else if ((opaque = tsearch(tn, &cache.temporary_tree_new, tree_compare))) { //printf("Cache_Add_Common to %p\n",opaque); if (tn != opaque->key) { cache.new_ram_size += sizeof(tn) - sizeof(opaque->key); owfree(opaque->key); opaque->key = tn; state = just_update; } else { state = yes_add; cache.new_ram_size += sizeof(tn); } } else { // nothing found or added?!? free our memory segment owfree(tn); } CACHE_WUNLOCK; /* Added or updated, update statistics */ switch (state) { case yes_add: // add new entry STATLOCK; AVERAGE_IN(&new_avg); ++cache_adds; /* statistics */ STATUNLOCK; return gbGOOD; case just_update: // update the time mark and data STATLOCK; AVERAGE_MARK(&new_avg); ++cache_adds; /* statistics */ STATUNLOCK; return gbGOOD; default: // unable to add return gbBAD; } } /* Add an item to the cache */ /* retire the cache (flip) if too old, and start a new one (keep the old one for a while) */ /* return 0 if good, 1 if not */ static GOOD_OR_BAD Cache_Add_Persistent(struct tree_node *tn) { struct tree_opaque *opaque; enum { no_add, yes_add, just_update } state = no_add; LEVEL_DEBUG("Adding data to permanent store"); PERSISTENT_WLOCK; opaque = tsearch(tn, &cache.persistent_tree, tree_compare) ; if ( opaque != NULL ) { //printf("CACHE ADD pointer=%p, key=%p\n",tn,opaque->key); if (tn != opaque->key) { owfree(opaque->key); opaque->key = tn; state = just_update; } else { state = yes_add; } } else { // nothing found or added?!? free our memory segment owfree(tn); } PERSISTENT_WUNLOCK; switch (state) { case yes_add: STATLOCK; AVERAGE_IN(&store_avg); STATUNLOCK; return gbGOOD; case just_update: STATLOCK; AVERAGE_MARK(&store_avg); STATUNLOCK; return gbGOOD; default: return gbBAD; } } static GOOD_OR_BAD Get_Stat(struct cache_stats *scache, const enum cache_task_return result) { GOOD_OR_BAD gbret = gbBAD ; // default STATLOCK; ++scache->tries; switch ( result ) { case ctr_expired: ++scache->expires; break ; case ctr_ok: ++scache->hits; gbret = gbGOOD ; break ; default: break ; } STATUNLOCK; return gbret ; } /* Does cache get, but doesn't allow play in data size */ static GOOD_OR_BAD Cache_Get_Strict(void *data, size_t dsize, const struct parsedname *pn) { size_t size = dsize; RETURN_BAD_IF_BAD( Cache_Get(data, &size, pn) ) ; return ( dsize == size) ? gbGOOD : gbBAD ; } GOOD_OR_BAD OWQ_Cache_Get(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); // do check here to avoid needless processing if (IsUncachedDir(pn) || IsAlarmDir(pn)) { return gbBAD; } switch (pn->selected_filetype->change) { case fc_simultaneous_temperature: return Cache_Get_Simultaneous(simul_temp, owq) ; case fc_simultaneous_voltage: return Cache_Get_Simultaneous(simul_volt, owq) ; default: break ; } if (pn->extension == EXTENSION_ALL) { switch (pn->selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: return gbBAD; // string arrays not supported case ft_integer: case ft_unsigned: case ft_yesno: case ft_date: case ft_float: case ft_pressure: case ft_temperature: case ft_tempgap: return Cache_Get_Strict(OWQ_array(owq), (pn->selected_filetype->ag->elements) * sizeof(union value_object), pn); default: return gbBAD; } } else { switch (pn->selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: if (OWQ_offset(owq) > 0) { return gbBAD; } OWQ_length(owq) = OWQ_size(owq); return Cache_Get(OWQ_buffer(owq), &OWQ_length(owq), pn); case ft_integer: case ft_unsigned: case ft_yesno: case ft_date: case ft_float: case ft_pressure: case ft_temperature: case ft_tempgap: return Cache_Get_Strict(&OWQ_val(owq), sizeof(union value_object), pn); default: return gbBAD; } } } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ GOOD_OR_BAD Cache_Get(void *data, size_t * dsize, const struct parsedname *pn) { time_t duration; struct tree_node tn; int persistent ; // do check here to avoid needless processing if (IsUncachedDir(pn) || IsAlarmDir(pn)) { return gbBAD; } // Special handling of Mock persistent = IsThisPersistent(pn) ; if ( persistent ) { duration = 1 ; } else { duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { return gbBAD; /* in case timeout set to 0 */ } } LEVEL_DEBUG(SNformat " size=%d IsUncachedDir=%d", SNvar(pn->sn), (int) dsize[0], IsUncachedDir(pn)); LoadTK( pn->sn, pn->selected_filetype, pn->extension, &tn ); return persistent ? Get_Stat(&cache_pst, Cache_Get_Persistent(data, dsize, &duration, &tn)) : Get_Stat(&cache_ext, Cache_Get_Common(data, dsize, &duration, &tn)); } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ GOOD_OR_BAD Cache_Get_Dir(struct dirblob *db, const struct parsedname *pn) { time_t duration = TimeOut(fc_directory); struct tree_node tn; struct parsedname pn_directory; DirblobInit(db); if (duration <= 0) { return gbBAD; } LEVEL_DEBUG("Looking for directory "SNformat, SNvar(pn->sn)); FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK( pn_directory.sn, Directory_Marker, pn->selected_connection->index, &tn) ; return Get_Stat(&cache_dir, Cache_Get_Common_Dir(db, &duration, &tn)); } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ static enum cache_task_return Cache_Get_Common_Dir(struct dirblob *db, time_t * duration, const struct tree_node *tn) { enum cache_task_return ctr_ret; time_t now = NOW_TIME; size_t size; struct tree_opaque *opaque; LEVEL_DEBUG("Get from cache sn " SNformat " pointer=%p extension=%d", SNvar(tn->tk.sn), tn->tk.p, tn->tk.extension); CACHE_RLOCK; opaque = tfind(tn, &cache.temporary_tree_new, tree_compare) ; if ( opaque == NULL ) { // not found in new tree if ( cache.time_retired + duration[0] > now ) { // old tree could be new enough opaque = tfind(tn, &cache.temporary_tree_old, tree_compare) ; } } if ( opaque != NULL ) { duration[0] = opaque->key->expires - now ; if (duration[0] >= 0) { LEVEL_DEBUG("Dir found in cache"); size = opaque->key->dsize; if (DirblobRecreate(TREE_DATA(opaque->key), size, db) == 0) { //printf("Cache: snlist=%p, devices=%lu, size=%lu\n",*snlist,devices[0],size) ; ctr_ret = ctr_ok; } else { ctr_ret = ctr_size_mismatch; } } else { //char b[26]; //printf("GOT DEAD now:%s",ctime_r(&now,b)) ; //printf(" then:%s",ctime_r(&opaque->key->expires,b)) ; LEVEL_DEBUG("Dir expired in cache"); ctr_ret = ctr_expired; } } else { LEVEL_DEBUG("Dir not found in cache"); ctr_ret = ctr_not_found; } CACHE_RUNLOCK; return ctr_ret; } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ GOOD_OR_BAD Cache_Get_Device(void *bus_nr, const struct parsedname *pn) { time_t duration = TimeOut(fc_presence); size_t size = sizeof(int); struct tree_node tn; if (duration <= 0) { return gbBAD; } LEVEL_DEBUG("Looking for device "SNformat, SNvar(pn->sn)); LoadTK( pn->sn, Device_Marker, 0, &tn ) ; return Get_Stat(&cache_dev, Cache_Get_Common(bus_nr, &size, &duration, &tn)); } /* Does cache get, but doesn't allow play in data size */ GOOD_OR_BAD Cache_Get_SlaveSpecific(void *data, size_t dsize, const struct internal_prop *ip, const struct parsedname *pn) { size_t size = dsize; RETURN_BAD_IF_BAD( Cache_Get_Internal(data, &size, ip, pn) ) ; return ( dsize == size) ? gbGOOD : gbBAD ; } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ static GOOD_OR_BAD Cache_Get_Internal(void *data, size_t * dsize, const struct internal_prop *ip, const struct parsedname *pn) { struct tree_node tn; time_t duration; //printf("Cache_Get_Internal"); if (!pn) { return gbBAD; // do check here to avoid needless processing } duration = TimeOut(ip->change); if (duration <= 0) { return gbBAD; /* in case timeout set to 0 */ } LEVEL_DEBUG(SNformat " size=%d", SNvar(pn->sn), (int) dsize[0]); LoadTK( pn->sn, ip->name, EXTENSION_INTERNAL, &tn) ; switch (ip->change) { case fc_persistent: return Get_Stat(&cache_pst, Cache_Get_Persistent(data, dsize, &duration, &tn)); default: return Get_Stat(&cache_int, Cache_Get_Common(data, dsize, &duration, &tn)); } } /* Test for a simultaneous property If the property isn't independently cached, return false (1) If the simultaneous conversion is more recent, return false (1) Else return the cached value and true (0) */ GOOD_OR_BAD Cache_Get_Simul_Time(enum simul_type type, time_t * dwell_time, const struct parsedname * pn) { // valid cached primary data -- see if a simultaneous conversion should be used instead struct tree_node tn; time_t duration ; time_t time_left ; size_t dsize_simul = 0 ; struct parsedname pn_directory ; duration = TimeOut(ipSimul[type].change); // time allocated this conversion if ( duration <= 0) { // uncachable return gbBAD; } LEVEL_DEBUG("Looking for conversion time "SNformat, SNvar(pn->sn)); FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK(pn_directory.sn, Simul_Marker[type], pn->selected_connection->index, &tn ) ; if ( Get_Stat(&cache_int, Cache_Get_Common(NULL, &dsize_simul, &time_left, &tn)) ) { return gbBAD ; } // duration_simul is time left // duration is time allocated // back-compute dwell time dwell_time[0] = duration - time_left ; return gbGOOD ; } /* Test for a simultaneous property * return true if simultaneous is the prefered method * bad if no simultaneous, or it's not the best */ static GOOD_OR_BAD Cache_Get_Simultaneous(enum simul_type type, struct one_wire_query *owq) { struct tree_node tn; time_t duration ; time_t time_left ; time_t dwell_time_simul ; struct parsedname * pn = PN(owq) ; size_t dsize = sizeof(union value_object) ; duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { // probably "uncached" requested return gbBAD; } LoadTK( pn->sn, pn->selected_filetype, pn->extension, &tn ) ; if ( Get_Stat(&cache_ext, Cache_Get_Common( &OWQ_val(owq), &dsize, &time_left, &tn)) == 0 ) { // valid cached primary data -- see if a simultaneous conversion should be used instead time_t dwell_time_data = duration - time_left ; if ( BAD( Cache_Get_Simul_Time( type, &dwell_time_simul, pn)) ) { // Simul not found or timed out LEVEL_DEBUG("Simultaneous conversion not found.") ; OWQ_SIMUL_CLR(owq) ; return gbGOOD ; } if ( dwell_time_simul < dwell_time_data ) { LEVEL_DEBUG("Simultaneous conversion is newer than previous reading.") ; OWQ_SIMUL_SET(owq) ; return gbBAD ; // Simul is newer } // Cached data is newer, so use it OWQ_SIMUL_CLR(owq) ; return gbGOOD ; } // fall through -- no cached primary data if ( BAD( Cache_Get_Simul_Time( type, &dwell_time_simul, pn)) ) { // no simultaneous either OWQ_SIMUL_CLR(owq) ; return gbBAD ; } OWQ_SIMUL_SET(owq) ; return gbBAD ; // Simul is newer } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ /* space allocated, needs to be owfree-d */ /* returns null-terminated string */ ASCII * Cache_Get_Alias(const BYTE * sn) { struct tree_node tn; struct tree_opaque *opaque; ASCII * alias_name = NULL ; LoadTK(sn, Alias_Marker, 0, &tn ) ; PERSISTENT_RLOCK; opaque = tfind(&tn, &cache.persistent_tree, tree_compare) ; if ( opaque != NULL ) { alias_name = owmalloc( opaque->key->dsize + 1 ) ; if ( alias_name != NULL ) { memcpy( alias_name, (ASCII *)TREE_DATA(opaque->key), opaque->key->dsize+1 ) ; LEVEL_DEBUG("Retrieving " SNformat " alias=%s", SNvar(sn), alias_name ); } } PERSISTENT_RUNLOCK; return alias_name ; } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ /* duration is time left */ static enum cache_task_return Cache_Get_Common(void *data, size_t * dsize, time_t * duration, const struct tree_node *tn) { enum cache_task_return ctr_ret; time_t now = NOW_TIME; struct tree_opaque *opaque; LEVEL_DEBUG("Search in cache sn " SNformat " pointer=%p index=%d size=%d", SNvar(tn->tk.sn), tn->tk.p, tn->tk.extension, (int) dsize[0]); //node_show(tn); //new_tree(); CACHE_RLOCK; opaque = tfind(tn, &cache.temporary_tree_new, tree_compare) ; if ( opaque == NULL ) { // not found in new tree if ( cache.time_retired + duration[0] > now ) { // retired time isn't too old for this data item opaque = tfind(tn, &cache.temporary_tree_old, tree_compare) ; } } if ( opaque != NULL ) { // modify duration to time left (can be negative if expired) duration[0] = opaque->key->expires - now ; if (duration[0] > 0) { LEVEL_DEBUG("Value found in cache. Remaining life: %d seconds.",duration[0]); // Compared with >= before, but fc_second(1) always cache for 2 seconds in that case. // Very noticable when reading time-data like "/26.80A742000000/date" for example. if ( dsize[0] >= opaque->key->dsize) { // lower data size if stored value is shorter dsize[0] = opaque->key->dsize; //tree_show(opaque,leaf,0); if (dsize[0] > 0) { memcpy(data, TREE_DATA(opaque->key), dsize[0]); } ctr_ret = ctr_ok; //twalk(cache.temporary_tree_new,tree_show) ; } else { ctr_ret = ctr_size_mismatch; } } else { LEVEL_DEBUG("Value found in cache, but expired by %d seconds.",-duration[0]); ctr_ret = ctr_expired; } } else { LEVEL_DEBUG("Value not found in cache"); ctr_ret = ctr_not_found; } CACHE_RUNLOCK; return ctr_ret; } /* Look in caches, 0=found and valid, 1=not or uncachable in the first place */ static enum cache_task_return Cache_Get_Persistent(void *data, size_t * dsize, time_t * duration, const struct tree_node *tn) { struct tree_opaque *opaque; enum cache_task_return ctr_ret; (void) duration; // ignored -- no timeout PERSISTENT_RLOCK; opaque = tfind(tn, &cache.persistent_tree, tree_compare) ; if ( opaque != NULL ) { if ( dsize[0] >= opaque->key->dsize) { dsize[0] = opaque->key->dsize; if (dsize[0] > 0) { memcpy(data, TREE_DATA(opaque->key), dsize[0]); } ctr_ret = ctr_ok; } else { ctr_ret = ctr_size_mismatch; } } else { ctr_ret = ctr_not_found; } PERSISTENT_RUNLOCK; return ctr_ret; } static void Del_Stat(struct cache_stats *scache, const int result) { if ( GOOD( result)) { STAT_ADD1(scache->deletes); } } void OWQ_Cache_Del(struct one_wire_query *owq) { Cache_Del(PN(owq)); } void OWQ_Cache_Del_ALL(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // convenience int extension = pn->extension ; // store extension pn->extension = EXTENSION_ALL ; // temporary assignment Cache_Del(pn); pn->extension = extension ; // restore extension } void OWQ_Cache_Del_BYTE(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // convenience int extension = pn->extension ; // store extension pn->extension = EXTENSION_BYTE ; // temporary assignment Cache_Del(pn); pn->extension = extension ; // restore extension } void OWQ_Cache_Del_parts(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // convenience if ( pn->selected_filetype->ag != NON_AGGREGATE ) { int extension = pn->extension ; // store extension int extension_index ; for ( extension_index = pn->selected_filetype->ag->elements - 1 ; extension_index >= 0 ; -- extension_index ) { pn->extension = extension_index ; // temporary assignment Cache_Del(pn); } pn->extension = extension ; // restore extension } else { Cache_Del(pn); } } // Delete a serial number's alias // Safe to call if no alias exists // Also deletes from linked alias_sn file void Cache_Del_Alias(const BYTE * sn) { ASCII * alias_name ; struct tree_node *tn; size_t size ; alias_name = Cache_Get_Alias( sn ) ; if ( alias_name == NULL ) { // doesn't exist // (or a memory error -- unlikely) return ; } LEVEL_DEBUG("Deleting alias %s from "SNformat, alias_name, SNvar(sn)) ; size = strlen( alias_name ) ; tn = (struct tree_node *) owmalloc(sizeof(struct tree_node) + size + 1 ); if ( tn != NULL ) { tn->expires = NOW_TIME; tn->dsize = size; memcpy((ASCII *)TREE_DATA(tn), alias_name, size+1); // includes NULL LoadTK( sn, Alias_Marker, 0, tn ) ; Del_Stat(&cache_pst, Cache_Del_Persistent(tn)); Cache_Del_Alias_SN( alias_name ) ; } owfree( alias_name ) ; } static void Cache_Del(const struct parsedname *pn) { struct tree_node tn; time_t duration; //printf("Cache_Del\n") ; //printf("Cache_Del\n") ; if (!pn) { return; // do check here to avoid needless processing } duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { return; /* in case timeout set to 0 */ } LoadTK( pn->sn, pn->selected_filetype, pn->extension, &tn ) ; switch (pn->selected_filetype->change) { case fc_persistent: Del_Stat(&cache_pst, Cache_Del_Persistent(&tn)); break ; default: Del_Stat(&cache_ext, Cache_Del_Common(&tn)); break ; } } void Cache_Del_Mixed_Individual(const struct parsedname *pn) { struct tree_node tn; time_t duration; //printf("Cache_Del\n") ; if (!pn) { return; // do check here to avoid needless processing } if (pn->selected_filetype->ag==NON_AGGREGATE || pn->selected_filetype->ag->combined!=ag_mixed) { return ; } duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { return; /* in case timeout set to 0 */ } LoadTK( pn->sn, pn->selected_filetype, 0, &tn) ; for ( tn.tk.extension = pn->selected_filetype->ag->elements-1 ; tn.tk.extension >= 0 ; --tn.tk.extension ) { switch (pn->selected_filetype->change) { case fc_persistent: Del_Stat(&cache_pst, Cache_Del_Persistent(&tn)); break ; default: Del_Stat(&cache_ext, Cache_Del_Common(&tn)); break ; } } } void Cache_Del_Mixed_Aggregate(const struct parsedname *pn) { struct tree_node tn; time_t duration; //printf("Cache_Del\n") ; if (!pn) { return; // do check here to avoid needless processing } if (pn->selected_filetype->ag==NON_AGGREGATE || pn->selected_filetype->ag->combined!=ag_mixed) { return ; } duration = TimeOut(pn->selected_filetype->change); if (duration <= 0) { return; /* in case timeout set to 0 */ } LoadTK( pn->sn, pn->selected_filetype, EXTENSION_ALL, &tn) ; switch (pn->selected_filetype->change) { case fc_persistent: Del_Stat(&cache_pst, Cache_Del_Persistent(&tn)); break ; default: Del_Stat(&cache_ext, Cache_Del_Common(&tn)); break ; } } void Cache_Del_Dir(const struct parsedname *pn) { struct tree_node tn; struct parsedname pn_directory; FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK( pn_directory.sn, Directory_Marker, pn->selected_connection->index, &tn ) ; Del_Stat(&cache_dir, Cache_Del_Common(&tn)); } void Cache_Del_Simul(enum simul_type type, const struct parsedname *pn) { struct tree_node tn; struct parsedname pn_directory; FS_LoadDirectoryOnly(&pn_directory, pn); LoadTK(pn_directory.sn, Simul_Marker[type], pn->selected_connection->index, &tn ); Del_Stat(&cache_dir, Cache_Del_Common(&tn)); } void Cache_Del_Device(const struct parsedname *pn) { struct tree_node tn; time_t duration = TimeOut(fc_presence); if (duration <= 0) { return; } LoadTK(pn->sn, Device_Marker, 0, &tn) ; Del_Stat(&cache_dev, Cache_Del_Common(&tn)); } void Cache_Del_Internal(const struct internal_prop *ip, const struct parsedname *pn) { struct tree_node tn; time_t duration; //printf("Cache_Del_Internal\n") ; if (!pn) { return; // do check here to avoid needless processing } duration = TimeOut(ip->change); if (duration <= 0) { return; /* in case timeout set to 0 */ } LoadTK(pn->sn, ip->name, 0, &tn); switch (ip->change) { case fc_persistent: Del_Stat(&cache_pst, Cache_Del_Persistent(&tn)); break; default: Del_Stat(&cache_int, Cache_Del_Common(&tn)); break; } } static GOOD_OR_BAD Cache_Del_Common(const struct tree_node *tn) { struct tree_opaque *opaque; time_t now = NOW_TIME; GOOD_OR_BAD ret = gbBAD; LEVEL_DEBUG("Delete from cache sn " SNformat " in=%p index=%d", SNvar(tn->tk.sn), tn->tk.p, tn->tk.extension); CACHE_WLOCK; opaque = tfind(tn, &cache.temporary_tree_new, tree_compare) ; if ( opaque == NULL ) { // not in new tree if ( cache.time_to_kill > now ) { // old tree still alive opaque = tfind(tn, &cache.temporary_tree_old, tree_compare) ; } } if ( opaque != NULL ) { opaque->key->expires = now - 1; ret = gbGOOD; } CACHE_WUNLOCK; return ret; } static GOOD_OR_BAD Cache_Del_Persistent(const struct tree_node *tn) { struct tree_opaque *opaque; struct tree_node *tn_found = NULL; PERSISTENT_WLOCK; opaque = tfind(tn, &cache.persistent_tree, tree_compare) ; if ( opaque != NULL ) { tn_found = opaque->key; tdelete(tn, &cache.persistent_tree, tree_compare); } PERSISTENT_WUNLOCK; if ( tn_found == NULL ) { return gbBAD; } owfree(tn_found); STATLOCK; AVERAGE_OUT(&store_avg); STATUNLOCK; return gbGOOD; } static void LoadTK( const BYTE * sn, void * p, int extension, struct tree_node * tn ) { memset(&(tn->tk), 0, sizeof(struct tree_key)); memcpy(tn->tk.sn, sn, SERIAL_NUMBER_SIZE); tn->tk.p = p; tn->tk.extension = extension; } // Alias list from persistent cache // formatted as an alias file: // NNNNNNNNNNNN=alias_name\n // // Need to protect a global variable (aliaslist_cb) since twalk has no way of sending user data. struct memblob * aliaslist_mb ; static void Aliaslistaction(const void *node, const VISIT which, const int depth) { const struct tree_node *p = *(struct tree_node * const *) node; (void) depth; char SN_address[SERIAL_NUMBER_SIZE*2] ; switch (which) { case leaf: case postorder: if ( p->tk.p != Alias_Marker ) { return ; } // Add sn address bytes2string(SN_address, p->tk.sn, SERIAL_NUMBER_SIZE); MemblobAdd( (BYTE *) SN_address, SERIAL_NUMBER_SIZE*2, aliaslist_mb ) ; // Add '=' MemblobAdd( (BYTE *) "=", 1, aliaslist_mb ) ; // Add alias name MemblobAdd( (const BYTE *)CONST_TREE_DATA(p), p->dsize, aliaslist_mb ) ; // Add MemblobAdd( (BYTE *) "\x0D\x0A", 2, aliaslist_mb ) ; return ; case preorder: case endorder: break; } } void Aliaslist( struct memblob * mb ) { PERSISTENT_RLOCK ; ALIASLISTLOCK ; aliaslist_mb = mb ; twalk(cache.persistent_tree, Aliaslistaction); ALIASLISTUNLOCK ; PERSISTENT_RUNLOCK ; } /* Add an alias to the temporary database of name->bus */ /* alias_name is a null-terminated string */ void Cache_Add_Alias_Bus(const ASCII * alias_name, INDEX_OR_ERROR bus) { // allocate space for the node and data size_t datasize = strlen(alias_name) ; struct alias_tree_node *atn = (struct alias_tree_node *) owmalloc(sizeof(struct alias_tree_node) + datasize + 1 ); time_t duration = TimeOut(fc_presence); if (atn==NULL) { return ; } if (datasize==0) { owfree(atn) ; return ; } // populate the node structure with data atn->expires = duration + NOW_TIME; atn->size = datasize ; atn->bus = bus ; memcpy( ALIAS_TREE_DATA(atn), alias_name, datasize + 1 ) ; Cache_Add_Alias_Common( atn ) ; } /* Add an item to the alias cache */ /* retire the cache (flip) if too old, and start a new one (keep the old one for a while) */ static void Cache_Add_Alias_Common(struct alias_tree_node *atn) { struct tree_opaque *opaque; CACHE_WLOCK; if (cache.time_to_kill < NOW_TIME) { // old database has timed out FlipTree() ; } if (Globals.cache_size && (cache.old_ram_size + cache.new_ram_size > Globals.cache_size)) { // failed size test owfree(atn); } else if ((opaque = tsearch(atn, &cache.temporary_alias_tree_new, alias_tree_compare))) { if ( (void *)atn != (void *) (opaque->key) ) { cache.new_ram_size += sizeof(atn) - sizeof(opaque->key); owfree(opaque->key); opaque->key = (void *) atn; } else { cache.new_ram_size += sizeof(atn); } } else { // nothing found or added?!? free our memory segment owfree(atn); } CACHE_WUNLOCK; } /* Add an alias/sn to the persistent database of name->sn */ /* Alias name must be a null-terminated string */ static void Cache_Add_Alias_SN(const ASCII * alias_name, const BYTE * sn) { // allocate space for the node and data size_t datasize = strlen(alias_name) ; struct alias_tree_node *atn = (struct alias_tree_node *) owmalloc(sizeof(struct alias_tree_node) + datasize + 1); if (atn==NULL) { return ; } if (datasize==0) { owfree(atn) ; return ; } // populate the node structure with data atn->expires = NOW_TIME; atn->size = datasize; memcpy( atn->sn, sn, SERIAL_NUMBER_SIZE ) ; memcpy( ALIAS_TREE_DATA(atn), alias_name, datasize+1 ) ; Cache_Add_Alias_Persistent( atn ) ; } static void Cache_Add_Alias_Persistent(struct alias_tree_node *atn) { struct tree_opaque *opaque; PERSISTENT_WLOCK; opaque = tsearch(atn, &cache.persistent_alias_tree, alias_tree_compare) ; if ( opaque != NULL ) { if ( (void *) atn != (void *) (opaque->key) ) { owfree(opaque->key); opaque->key = (void *) atn; } } else { // nothing found or added?!? free our memory segment owfree(atn); } PERSISTENT_WUNLOCK; } /* Find bus from alias name */ /* Alias name must be a null-terminated string */ INDEX_OR_ERROR Cache_Get_Alias_Bus(const ASCII * alias_name) { // allocate space for the node and data size_t datasize = strlen(alias_name) ; struct alias_tree_node *atn = (struct alias_tree_node *) owmalloc(sizeof(struct alias_tree_node) + datasize + 1); if (atn==NULL) { return INDEX_BAD ; } if (datasize==0) { owfree(atn) ; return INDEX_BAD ; } // populate the node structure with data atn->size = datasize; memcpy( ALIAS_TREE_DATA(atn), alias_name, datasize+1 ) ; return Cache_Get_Alias_Common( atn ) ; } static INDEX_OR_ERROR Cache_Get_Alias_Common( struct alias_tree_node * atn) { INDEX_OR_ERROR bus = INDEX_BAD; time_t now = NOW_TIME; struct tree_opaque *opaque; CACHE_RLOCK; opaque = tfind(atn, &cache.temporary_alias_tree_new, alias_tree_compare) ; if ( opaque == NULL ) { // try old tree opaque = tfind(atn, &cache.temporary_alias_tree_old, alias_tree_compare) ; } if ( opaque != NULL ) { // test expiration if ( ((struct alias_tree_node *)(opaque->key))->expires > now) { bus = ((struct alias_tree_node *)(opaque->key))->bus ; LEVEL_DEBUG("Found %s on bus.%d",ALIAS_TREE_DATA(atn),bus) ; } } CACHE_RUNLOCK; LEVEL_DEBUG("Finding %s unsuccessful",ALIAS_TREE_DATA(atn)) ; owfree(atn) ; return bus; } /* sn must point to an 8 byte buffer */ /* Alias name must be a null-terminated string */ GOOD_OR_BAD Cache_Get_Alias_SN(const ASCII * alias_name, BYTE * sn ) { // allocate space for the node and data size_t datasize = strlen(alias_name) ; struct alias_tree_node *atn ; if (datasize==0) { return gbBAD ; } atn = (struct alias_tree_node *) owmalloc(sizeof(struct alias_tree_node) + datasize+1); if (atn==NULL) { return gbBAD ; } // populate the node structure with data atn->size = datasize; memcpy( ALIAS_TREE_DATA(atn), alias_name, datasize+1 ) ; return Cache_Get_Alias_Persistent( sn, atn )==ctr_ok ? gbGOOD : gbBAD ; } /* look in persistent alias->sn tree */ static enum cache_task_return Cache_Get_Alias_Persistent( BYTE * sn, struct alias_tree_node * atn) { struct tree_opaque *opaque; GOOD_OR_BAD ret = gbBAD ; PERSISTENT_RLOCK; opaque = tfind(atn, &cache.persistent_alias_tree, alias_tree_compare) ; if ( opaque != NULL ) { memcpy( sn, ((struct alias_tree_node *)(opaque->key))->sn, SERIAL_NUMBER_SIZE ) ; LEVEL_DEBUG("Lookup of %s gives "SNformat, CONST_ALIAS_TREE_DATA(atn), SNvar(sn) ) ; ret = gbGOOD ; } else { LEVEL_DEBUG("Lookup of %s unsuccessful",CONST_ALIAS_TREE_DATA(atn)) ; } PERSISTENT_RUNLOCK; owfree(atn) ; return ret; } /* Alias name must be a null-terminated string */ static void Cache_Del_Alias_SN(const ASCII * alias_name) { // allocate space for the node and data size_t datasize = strlen(alias_name) ; struct alias_tree_node *atn = (struct alias_tree_node *) owmalloc(sizeof(struct alias_tree_node) + datasize + 1); if (atn==NULL) { return ; } // populate the node structure with data atn->expires = NOW_TIME; atn->size = datasize; memcpy( ALIAS_TREE_DATA(atn), alias_name, datasize+1 ) ; Cache_Del_Alias_Persistent( atn ) ; } /* look in persistent alias->sn tree */ static void Cache_Del_Alias_Persistent( struct alias_tree_node * atn) { struct tree_opaque *opaque; struct alias_tree_node *atn_found = NULL; PERSISTENT_RLOCK; opaque = tfind(atn, &cache.persistent_alias_tree, alias_tree_compare) ; if ( opaque != NULL ) { atn_found = (struct alias_tree_node *) (opaque->key); } PERSISTENT_RUNLOCK; owfree(atn_found) ; } /* Delete bus from alias name */ /* Alias name must be a null-terminated string */ void Cache_Del_Alias_Bus(const ASCII * alias_name) { // Cheat -- just change to a bad bus value LEVEL_DEBUG("Hide %s",alias_name) ; Cache_Add_Alias_Bus( alias_name, INDEX_BAD ) ; } #endif /* OW_CACHE */ owfs-2.8p15/module/owlib/src/c/ow_baud.c0000664000175000017500000000437311236014303015010 00000000000000/* $Id: ow_baud.c,v 1.2 2009/08/04 11:17:23 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_baud -- baud rate interpret and print */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" speed_t COM_MakeBaud( int raw_baud ) { switch ( raw_baud ) { case 12: case 1200: return B1200 ; case 24: case 2400: return B2400 ; case 48: case 4800: return B4800 ; case 96: case 9600: return B9600 ; case 19: case 19000: case 19200: return B19200 ; case 38: case 38000: case 38400: return B38400 ; case 56: case 57: case 56000: case 57000: case 57600: return B57600 ; case 115: case 115000: case 115200: return B115200 ; case 230: case 230000: case 230400: return B230400 ; default: return B9600 ; } } int COM_BaudRate( speed_t B_baud ) { switch ( B_baud ) { case B1200: return 1200 ; case B2400: return 2400 ; case B4800: return 4800 ; case B9600: return 9600 ; case B19200: return 19200 ; case B38400: return 38400 ; case B57600: return 57600 ; case B115200: return 115200 ; case B230400: return 230400 ; default: return 9600 ; } } // Find the best choice for baud rate among allowable choices. // Must end list with a 0 void COM_BaudRestrict( speed_t * B_baud, ... ) { va_list baud_list ; speed_t B_original = B_baud[0] ; int original_baudrate = COM_BaudRate( B_original ) ; speed_t B_best = B9600 ; int best_baudrate = COM_BaudRate( B_best ) ; speed_t B_current ; va_start( baud_list, B_baud ) ; while ( (B_current=va_arg( baud_list, speed_t)) ) { int current_baudrate = COM_BaudRate( B_current ) ; if ( current_baudrate == original_baudrate ) { // perfect match B_best = B_current ; break ; } else if ( current_baudrate > original_baudrate ) { // too fast continue ; } else if ( current_baudrate > best_baudrate ) { // better choice B_best = B_current ; best_baudrate = current_baudrate ; } } va_end( baud_list ) ; B_baud[0] = B_best ; } owfs-2.8p15/module/owlib/src/c/ow_1821.c0000644000175000017500000003214611740076517014504 00000000000000/* $Id: ow_1821.c,v 1.45 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_1821.h" #include /* ------- Prototypes ----------- */ /* DS18S20&2 Temperature */ // READ_FUNCTION( FS_tempdata ) ; READ_FUNCTION(FS_temperature); READ_FUNCTION(FS_r_polarity); WRITE_FUNCTION(FS_w_polarity); READ_FUNCTION(FS_r_templimit); WRITE_FUNCTION(FS_w_templimit); READ_FUNCTION(FS_r_thermomode); WRITE_FUNCTION(FS_w_thermomode); READ_FUNCTION(FS_r_oneshot); WRITE_FUNCTION(FS_w_oneshot); READ_FUNCTION(FS_r_tlf); WRITE_FUNCTION(FS_w_tlf); READ_FUNCTION(FS_r_thf); WRITE_FUNCTION(FS_w_thf); /* -------- Structures ---------- */ static struct filetype DS1821[] = { F_type, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_temperature, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"polarity", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_polarity, FS_w_polarity, VISIBLE, NO_FILETYPE_DATA, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"templowflag", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_tlf, FS_w_tlf, VISIBLE, NO_FILETYPE_DATA, }, {"temphighflag", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_thf, FS_w_thf, VISIBLE, NO_FILETYPE_DATA, }, {"thermostatmode", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_thermomode, FS_w_thermomode, VISIBLE, NO_FILETYPE_DATA, }, {"1shot", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_oneshot, FS_w_oneshot, VISIBLE, NO_FILETYPE_DATA, } } ; DeviceEntry(thermostat, DS1821, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_READ_TEMPERATURE 0xAA #define _1W_START_CONVERT_T 0xEE #define _1W_STOP_CONVERT_T 0x22 #define _1W_WRITE_TH 0x01 #define _1W_WRITE_TL 0x02 #define _1W_READ_TH 0xA1 #define _1W_READ_TL 0xA2 #define _1W_WRITE_STATUS 0x0C #define _1W_READ_STATUS 0xAC #define _1W_READ_COUNTER 0xA0 #define _1W_LOAD_COUNTER 0x41 /* Definition of status register bits. */ /* Please see the DS1821 datasheet for further information. */ #define DS1821_STATUS_1SHOT 0 // 0: convert temp continuously; 1: one conversion only. #define DS1821_STATUS_POL 1 // 0: in thermostat mode DQ output is active low; 1: active high. #define DS1821_STATUS_TR 2 // 0: go 1-wire mode on next power-up; 1: go into thermostat mode. #define DS1821_STATUS_TLF 3 // 0: temp has not been below the TL temp; 1: temp has. #define DS1821_STATUS_THF 4 // 0: temp has not been above the TH temp; 1: temp has. #define DS1821_STATUS_NVB 5 // 0: EEPROM write not in progress; 1: EEPROM write in progress. // Bit 6 always returns 1. #define DS1821_STATUS_DONE 7 // 0: temp conversion in progress; 1: conversion finished. /* End of status register bits. */ /* ------- Functions ------------ */ /* DS1821*/ static GOOD_OR_BAD OW_temperature(_FLOAT * temp, const struct parsedname *pn); static GOOD_OR_BAD OW_current_temperature(_FLOAT * temp, const struct parsedname *pn); static GOOD_OR_BAD OW_current_temperature_lowres(_FLOAT * temp, const struct parsedname *pn); static GOOD_OR_BAD OW_r_status(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_status(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_templimit(_FLOAT * T, const int Tindex, const struct parsedname *pn); static GOOD_OR_BAD OW_w_templimit(const _FLOAT T, const int Tindex, const struct parsedname *pn); static ZERO_OR_ERROR FS_temperature(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_temperature(&OWQ_F(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_thf(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; OWQ_Y(owq) = (data >> DS1821_STATUS_THF) & 0x01; // OWQ_Y(owq) = (data & 0x10) >> 4; return 0; } static ZERO_OR_ERROR FS_w_thf(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; UT_setbit(&data, DS1821_STATUS_THF, OWQ_Y(owq)); return GB_to_Z_OR_E(OW_w_status(&data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_tlf(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; OWQ_Y(owq) = (data >> DS1821_STATUS_TLF) & 0x01; //OWQ_Y(owq) = (data & 0x08) >> 3; return 0; } static ZERO_OR_ERROR FS_w_tlf(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; UT_setbit(&data, DS1821_STATUS_TLF, OWQ_Y(owq)); return GB_to_Z_OR_E(OW_w_status(&data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_thermomode(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; OWQ_Y(owq) = (data >> DS1821_STATUS_TR) & 0x01; // OWQ_Y(owq) = (data & 0x04) >> 2; return 0; } static ZERO_OR_ERROR FS_w_thermomode(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; UT_setbit(&data, DS1821_STATUS_TR, OWQ_Y(owq)); return GB_to_Z_OR_E(OW_w_status(&data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_polarity(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; OWQ_Y(owq) = (data >> DS1821_STATUS_POL) & 0x01; return 0; } static ZERO_OR_ERROR FS_w_polarity(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; UT_setbit(&data, DS1821_STATUS_POL, OWQ_Y(owq)); return GB_to_Z_OR_E(OW_w_status(&data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_oneshot(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; OWQ_Y(owq) = (data >> DS1821_STATUS_1SHOT) & 0x01; return 0; } /* Set or reset the "one shot" bit of the status register. * * One of several idiosyncrasies of this chip is it's "Continuous Conversion/1Shot" mode. * If the 1Shot bit is zero at the time a temperature conversion is finished then the chip starts another * conversion immediately without needing a Start Conversion command. It continues to do this until * it hears a Stop Conversion command. This means that the chip doesn't do anything when the 1Shot * bit is cleared - it waits until the next Start Conversion command before starting continuous conversions. * I can't see how this waiting behaviour is useful so I have issued Start Conversion and Stop Conversion * commands at the appropriate times on the assumption that the reason you are setting the continuous conversion * mode is because you want continuous conversions. */ static ZERO_OR_ERROR FS_w_oneshot(struct one_wire_query *owq) { BYTE pstop[] = { _1W_STOP_CONVERT_T, }; struct transaction_log tstop[] = { TRXN_START, TRXN_WRITE1(pstop), TRXN_END, }; BYTE pstart[] = { _1W_START_CONVERT_T, }; struct transaction_log tstart[] = { TRXN_START, TRXN_WRITE1(pstart), TRXN_END, }; BYTE data; int oneshotmode; RETURN_ERROR_IF_BAD(OW_r_status(&data, PN(owq))) ; oneshotmode = (data >> DS1821_STATUS_1SHOT) & 0x01; UT_setbit(&data, DS1821_STATUS_1SHOT, OWQ_Y(owq)); RETURN_ERROR_IF_BAD(OW_w_status(&data, PN(owq))) ; if (!oneshotmode && OWQ_Y(owq)) { /* 1Shot mode was off and we are setting it on; i.e. we are ending continuous mode. * Continuous conversions may be in progress. * Since we are turning this mode off, it's probably a reasonable assumption * that we don't want continuous conversions anymore, * so issue a STOP CONVERSION to halt the conversions. */ if ( BUS_transaction(tstop, PN(owq)) ) { return -EINVAL; } } else if (oneshotmode && !OWQ_Y(owq)) { /* 1Shot mode was on and we are turning it off; i.e. we are starting continuous mode. * Continuous conversions are probably not in progress. * Presumably, we are doing this because we want continuous conversions so * issue a START CONVERSION command to kick things off. */ GOOD_OR_BAD ret = BUS_transaction(tstart, PN(owq)); /* We have just kicked off a conversion. If we try to read the temperature * right now we will get some previous temperature, which we are not probably * expecting. So wait for the first conversion only, just in case. We will now * be in continuous conversion mode so after the first one we no longer have to * worry about it. */ UT_delay(1000); if ( BAD(ret) ) { return -EINVAL; } } // else ; /* We are setting the bit to what it already was so do nothing special. */ return 0; } static ZERO_OR_ERROR FS_r_templimit(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_templimit(&OWQ_F(owq), OWQ_pn(owq).selected_filetype->data.i, PN(owq))) ; } static ZERO_OR_ERROR FS_w_templimit(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_templimit(OWQ_F(owq), OWQ_pn(owq).selected_filetype->data.i, PN(owq))) ; } static GOOD_OR_BAD OW_r_status(BYTE * data, const struct parsedname *pn) { BYTE p[] = { _1W_READ_STATUS, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ1(data), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_w_status(BYTE * data, const struct parsedname *pn) { BYTE p[] = { _1W_WRITE_STATUS, data[0] }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_END, }; return BUS_transaction(t, pn); } /* Do a transaction to get the temperature, increasing the resolution if possible. * * When we are in continuous conversion mode we don't have to wait for a conversion to finish * because, apart from the first one, one has always already been completed and the temperature stored in the * temperature register. * * However, a tricky wrinkle is that you cannot use the "high resolution" temperature calculation in continuous * conversion mode because the counter is constantly in use and reading it disrupts the temperature measurement * in progress. The result is incorrect temperature readings in the temperature register even if we don't attempt * to use the counter value to increase resolution. */ static GOOD_OR_BAD OW_temperature(_FLOAT * temp, const struct parsedname *pn) { BYTE c[] = { _1W_START_CONVERT_T, }; BYTE status; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(c), TRXN_END, }; RETURN_BAD_IF_BAD(OW_r_status(&status, pn)) ; if ((status >> DS1821_STATUS_1SHOT) & 0x01) { /* 1-shot, convert and wait 1 second */ RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; UT_delay(1000); return OW_current_temperature(temp, pn); } else { /* in continuous conversion mode. No need to delay but can't get full resolution. */ return OW_current_temperature_lowres(temp, pn); } } /* Do a transaction to get the temperature, the remaining count, and the count-per-c registers. * Perform the calculation to increase the temperature resolution. */ static GOOD_OR_BAD OW_current_temperature(_FLOAT * temp, const struct parsedname *pn) { BYTE read_temp[] = { _1W_READ_TEMPERATURE, }; BYTE read_counter[] = { _1W_READ_COUNTER, }; BYTE load_counter[] = { _1W_LOAD_COUNTER, }; BYTE temp_read; BYTE count_per_c; BYTE count_remain; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(read_temp), TRXN_READ1(&temp_read), TRXN_START, TRXN_WRITE1(read_counter), TRXN_READ1(&count_remain), TRXN_START, TRXN_WRITE1(load_counter), TRXN_START, TRXN_WRITE1(read_counter), TRXN_READ1(&count_per_c), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; if (count_per_c) { /* Perform calculation to get high temperature resolution - see datasheet. */ temp[0] = (_FLOAT) ((int8_t) temp_read) + .5 - ((_FLOAT) count_remain) / ((_FLOAT) count_per_c); } else { /* Bad count_per_c -- use lower resolution */ temp[0] = (_FLOAT) ((int8_t) temp_read); } return gbGOOD; } /* Read temperature register but do not attempt to increase the resolution, * because, for instance, the chip is in continuous conversion mode. */ static GOOD_OR_BAD OW_current_temperature_lowres(_FLOAT * temp, const struct parsedname *pn) { BYTE read_temp[] = { _1W_READ_TEMPERATURE, }; BYTE temp_read; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(read_temp), TRXN_READ1(&temp_read), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; temp[0] = (_FLOAT) ((int8_t) temp_read); return gbGOOD; } /* Limits Tindex=0 high 1=low */ static GOOD_OR_BAD OW_r_templimit(_FLOAT * T, const int Tindex, const struct parsedname *pn) { BYTE p[] = { _1W_READ_TH, _1W_READ_TL, }; BYTE data; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(&p[Tindex]), TRXN_READ1(&data), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; T[0] = (_FLOAT) ((int8_t) data); return gbGOOD; } /* Limits Tindex=0 high 1=low */ static GOOD_OR_BAD OW_w_templimit(const _FLOAT T, const int Tindex, const struct parsedname *pn) { BYTE p[] = { _1W_WRITE_TH, _1W_WRITE_TL, }; #ifdef HAVE_LRINT BYTE data = BYTE_MASK(lrint(T)); // round off #else BYTE data = BYTE_MASK((int) (T + .49)); // round off #endif struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(&p[Tindex]), TRXN_WRITE1(&data), TRXN_END, }; return BUS_transaction(t, pn);; } owfs-2.8p15/module/owlib/src/c/ow_del_inflight.c0000664000175000017500000000247411503546662016544 00000000000000/* $Id: ow_del_inflight.c,v 1.7 2010/12/20 03:29:54 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" /* Can only be called by a separate (monitoring) thread so the write-lock won't deadlock */ /* This allows removing Bus Masters while program is running * The master is usually only read-locked for normal operation * write lock is done in a separate thread when no requests are being processed */ void Del_InFlight( GOOD_OR_BAD (*nomatch)(struct connection_in * trial,struct connection_in * existing), struct connection_in * old_in ) { if ( old_in == NO_CONNECTION ) { return ; } LEVEL_DEBUG("Request master be removed: %s", SOC(old_in)->devicename); CONNIN_WLOCK ; if ( nomatch != NULL ) { struct connection_in * in = Inbound_Control.head ; while ( in != NO_CONNECTION ) { struct connection_in * next = in-> next ; if ( BAD( nomatch( old_in, in )) ) { LEVEL_DEBUG("Removing BUS index=%d %s",in->index,SAFESTRING(SOC(in)->devicename)); RemoveIn(in) ; } in = next ; } } CONNIN_WUNLOCK ; RemoveIn(old_in); } owfs-2.8p15/module/owlib/src/c/ow_dir.c0000644000175000017500000010100411742172216014650 00000000000000/* $Id: ow_dir.c,v 1.209 2012/04/14 03:52:46 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_devices.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_dirblob.h" #include "ow.h" #include "ow_external.h" static enum search_status PossiblyLockedBusCall( enum search_status (* first_next)(struct device_search *, const struct parsedname *), struct device_search * ds, const struct parsedname * pn ) ; static ZERO_OR_ERROR FS_dir_both(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory, uint32_t * flags); static ZERO_OR_ERROR FS_dir_all_connections(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory, uint32_t * flags); static ZERO_OR_ERROR FS_devdir(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn2); static ZERO_OR_ERROR FS_structdevdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_device_directory); static ZERO_OR_ERROR FS_alarmdir(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn2); static ZERO_OR_ERROR FS_typedir(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_type_directory); static ZERO_OR_ERROR FS_realdir(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn2, uint32_t * flags); static ZERO_OR_ERROR FS_cache2real(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn2, uint32_t * flags); static ZERO_OR_ERROR FS_busdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory); static void FS_stype_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory); static ZERO_OR_ERROR FS_externaldir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_external_directory); static void FS_interface_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory); static void FS_alarm_entry(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory); static void FS_simultaneous_entry(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory); static void FS_uncached_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory); static ZERO_OR_ERROR FS_dir_plus(void (*dirfunc) (void *, const struct parsedname *), void *v, uint32_t * flags, const struct parsedname *pn_directory, const char *file) ; /* Calls dirfunc() for each element in directory */ /* void * data is arbitrary user data passed along -- e.g. output file descriptor */ /* pn_directory -- input: pn_directory->selected_device == NO_DEVICE -- root directory, give list of all devices pn_directory->selected_device non-null, -- device directory, give all properties branch aware cache aware pn_directory -- output (with each call to dirfunc) ROOT pn_directory->selected_device set pn_directory->sn set appropriately pn_directory->selected_filetype not set DEVICE pn_directory->selected_device and pn_directory->sn still set pn_directory->selected_filetype loops through */ /* path is the path which "pn_directory" parses */ /* FS_dir produces the "invariant" portion of the directory, passing on to FS_dir_all_connections the variable part */ ZERO_OR_ERROR FS_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, struct parsedname *pn_directory) { uint32_t flags; LEVEL_DEBUG("path=%s", pn_directory->path); pn_directory->control_flags |= ALIAS_REQUEST ; // All local directory queries want alias translation return FS_dir_both(dirfunc, v, pn_directory, &flags); } /* path is the path which "pn_directory" parses */ /* FS_dir_remote is the entry into FS_dir_all_connections from ServerDir */ /* More checking is done, and the flags are returned */ ZERO_OR_ERROR FS_dir_remote(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory, uint32_t * flags) { LEVEL_DEBUG("path=%s", pn_directory->path); return FS_dir_both(dirfunc, v, pn_directory, flags); } static ZERO_OR_ERROR FS_dir_both(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_raw_directory, uint32_t * flags) { ZERO_OR_ERROR ret = 0; /* initialize flags */ flags[0] = 0; /* pn_raw_directory->selected_connection Could be NULL here... * It will then return a root-directory containing * /uncached,/settings,/system,/statistics,/structure * instead of an empty directory. */ if (pn_raw_directory == NO_PARSEDNAME) { LEVEL_CALL("return ENODEV pn_raw_directory=%p selected_connection=%p", pn_raw_directory, (pn_raw_directory ? pn_raw_directory->selected_connection : NO_CONNECTION)); return -ENODEV; } LEVEL_CALL("path=%s", SAFESTRING(pn_raw_directory->path)); STATLOCK; AVERAGE_IN(&dir_avg); AVERAGE_IN(&all_avg); STATUNLOCK; FSTATLOCK; StateInfo.dir_time = NOW_TIME; // protected by mutex FSTATUNLOCK; if (pn_raw_directory->selected_filetype != NO_FILETYPE) { // File, not directory ret = -ENOTDIR; } else if (SpecifiedVeryRemoteBus(pn_raw_directory)) { //printf("SPECIFIED_BUS BUS_IS_SERVER (very remote)\n"); // Send remotely only (all evaluation done there) ret = ServerDir(dirfunc, v, pn_raw_directory, flags); } else if (SpecifiedRemoteBus(pn_raw_directory)) { //printf("SPECIFIED_BUS BUS_IS_SERVER (just remote)\n"); //printf("Add extra INTERFACE\n"); FS_interface_dir(dirfunc, v, pn_raw_directory); // Send remotely only (all evaluation done there) ret = ServerDir(dirfunc, v, pn_raw_directory, flags); } else if (pn_raw_directory->selected_device != NO_DEVICE) { //printf("YES SELECTED_DEVICE\n"); // device directory -- not bus-specific if ( IsInterfaceDir(pn_raw_directory) ) { ret = FS_devdir(dirfunc, v, pn_raw_directory); } else if ( BusIsServer( pn_raw_directory->selected_connection) ) { ret = ServerDir(dirfunc, v, pn_raw_directory, flags); } else if ( IsStructureDir( pn_raw_directory ) ) { ret = FS_structdevdir( dirfunc, v, pn_raw_directory ) ; } else { ret = FS_devdir(dirfunc, v, pn_raw_directory); } } else if (NotRealDir(pn_raw_directory)) { //printf("NOT_REAL_DIR\n"); // structure, statistics, system or settings dir -- not bus-specific ret = FS_typedir(dirfunc, v, pn_raw_directory); } else if (SpecifiedLocalBus(pn_raw_directory)) { if (IsAlarmDir(pn_raw_directory)) { /* root or branch directory -- alarm state */ ret = FS_alarmdir(dirfunc, v, pn_raw_directory); } else { if (pn_raw_directory->ds2409_depth == 0) { // only add funny directories for non-micro hub (DS2409) branches FS_interface_dir(dirfunc, v, pn_raw_directory); } /* Now get the actual devices */ ret = FS_cache2real(dirfunc, v, pn_raw_directory, flags); /* simultaneous directory */ if (flags[0] & (DEV_temp | DEV_volt)) { FS_simultaneous_entry(dirfunc, v, pn_raw_directory); } if (flags[0] & DEV_alarm) { FS_alarm_entry(dirfunc, v, pn_raw_directory); } } } else if ( IsAlarmDir(pn_raw_directory)) { // alarm for all busses // Not specified bus, so scan through all and print union ret = FS_dir_all_connections(dirfunc, v, pn_raw_directory, flags); // add no chaff to alarm directory -- no "uncached", "bus.x" etc } else { // standard directory search -- all busses // Not specified bus, so scan through all and print union int server_type = Globals.program_type==program_type_server || Globals.program_type==program_type_external ; ret = FS_dir_all_connections(dirfunc, v, pn_raw_directory, flags); if ( !server_type || ShouldReturnBusList(pn_raw_directory)) { if (pn_raw_directory->ds2409_depth == 0) { // only add funny directories for non-micro hub (DS2409) branches FS_busdir(dirfunc, v, pn_raw_directory); FS_uncached_dir(dirfunc, v, pn_raw_directory); FS_stype_dir(dirfunc, v, pn_raw_directory); } /* simultaneous directory */ if (flags[0] & (DEV_temp | DEV_volt)) { FS_simultaneous_entry(dirfunc, v, pn_raw_directory); } if (flags[0] & DEV_alarm) { FS_alarm_entry(dirfunc, v, pn_raw_directory); } } } STATLOCK; AVERAGE_OUT(&dir_avg); AVERAGE_OUT(&all_avg); STATUNLOCK; LEVEL_DEBUG("ret=%d", ret); return ret; } /* directories about the internal pogram state and configuration rather than device data */ static void FS_stype_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory) { uint32_t ignoreflag ; FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, ePN_name[ePN_settings]); FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, ePN_name[ePN_system]); FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, ePN_name[ePN_statistics]); FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, ePN_name[ePN_structure]); } /* interface (only for bus directories) -- actually generated by the layer ABOVE that bus. */ static void FS_interface_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory) { uint32_t ignoreflag ; FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, ePN_name[ePN_interface]); } /* Some devices have a special state when certain events are found called the ALARM state */ static void FS_alarm_entry(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory) { uint32_t ignoreflag ; FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, "alarm"); } /* Add the "uncached" directory as a mnenomic aid to top level directory listings. */ static void FS_uncached_dir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory) { uint32_t ignoreflag ; if (IsUncachedDir(pn_root_directory)) { /* already uncached */ return; } FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, "uncached"); } /* Some temperature and voltage measurements can be triggered globally for considerable speed improvements */ static void FS_simultaneous_entry(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_root_directory) { uint32_t ignoreflag ; FS_dir_plus(dirfunc, v, &ignoreflag, pn_root_directory, "simultaneous"); } #if OW_MT /* path is the path which "pn_directory" parses */ /* FS_dir_all_connections produces the data that can vary: device lists, etc. */ static ZERO_OR_ERROR FS_dir_all_connections_loop(void (*dirfunc) (void *, const struct parsedname * const), void *v, struct connection_in * in, const struct parsedname *pn_directory, uint32_t * flags); struct dir_all_connections_struct { struct connection_in * current ; const struct parsedname *pn_directory; void (*dirfunc) (void *, const struct parsedname *); void *v; uint32_t *flags; ZERO_OR_ERROR ret; }; /* Embedded function */ static void *FS_dir_all_connections_callback(void *v) { struct dir_all_connections_struct *dacs = v; dacs->ret = FS_dir_all_connections_loop(dacs->dirfunc, dacs->v, dacs->current, dacs->pn_directory, dacs->flags); pthread_exit(NULL); return VOID_RETURN; } static ZERO_OR_ERROR FS_dir_all_connections_loop(void (*dirfunc) (void *, const struct parsedname *), void *v, struct connection_in * current, const struct parsedname *pn_directory, uint32_t * flags) { ZERO_OR_ERROR ret = 0; struct dir_all_connections_struct dacs = { current->next, pn_directory, dirfunc, v, flags, 0 }; struct parsedname s_pn_bus_directory; struct parsedname *pn_bus_directory = &s_pn_bus_directory; pthread_t thread; int threadbad = 1; threadbad = (dacs.current==NULL) || pthread_create(&thread, DEFAULT_THREAD_ATTR, FS_dir_all_connections_callback, (void *) (&dacs)); memcpy(pn_bus_directory, pn_directory, sizeof(struct parsedname)); // shallow copy SetKnownBus(current->index, pn_bus_directory); if ( BAD(TestConnection(pn_bus_directory)) ) { // reconnect ok? ret = -ECONNABORTED; } else if (BusIsServer(pn_bus_directory->selected_connection)) { /* is this a remote bus? */ //printf("FS_dir_all_connections: Call ServerDir %s\n", pn_directory->path); ret = ServerDir(dirfunc, v, pn_bus_directory, flags); } else if (IsAlarmDir(pn_bus_directory)) { /* root or branch directory -- alarm state */ //printf("FS_dir_all_connections: Call FS_alarmdir %s\n", pn_directory->path); ret = FS_alarmdir(dirfunc, v, pn_bus_directory); } else { ret = FS_cache2real(dirfunc, v, pn_bus_directory, flags); } //printf("FS_dir_all_connections4 pid=%ld adapter=%d ret=%d\n",pthread_self(), pn_directory->selected_connection->index,ret); /* See if next bus was also queried */ if (threadbad == 0) { /* was a thread created? */ if (pthread_join(thread, NULL)!= 0) { return ret; /* cannot join, so return only this result */ } if (dacs.ret >= 0) { return dacs.ret; /* is it an error return? Then return this one */ } } return ret; } static ZERO_OR_ERROR FS_dir_all_connections(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory, uint32_t * flags) { struct connection_in * in = Inbound_Control.head ; // Make sure head isn't NULL if ( in == NO_CONNECTION ) { return 0 ; } // Start iterating through buses return FS_dir_all_connections_loop(dirfunc, v, in, pn_directory, flags); } #else /* OW_MT */ /* path is the path which "pn_directory" parses */ /* FS_dir_all_connections produces the data that can vary: device lists, etc. */ static ZERO_OR_ERROR FS_dir_all_connections(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory, uint32_t * flags) { ZERO_OR_ERROR ret = 0; struct connection_in * in; struct parsedname s_pn_selected_connection; struct parsedname *pn_selected_connection = &s_pn_selected_connection; memcpy(pn_selected_connection, pn_directory, sizeof(struct parsedname)); //shallow copy for (in = Inbound_Control.head ; in != NO_CONNECTION ; in = in->next ) { SetKnownBus(in->index, pn_selected_connection); if ( BAD(TestConnection(pn_selected_connection)) ) { continue ; } if (BusIsServer(pn_selected_connection->selected_connection)) { /* is this a remote bus? */ ZERO_OR_ERROR server = ServerDir(dirfunc, v, pn_selected_connection, flags); if ( server ) { ret = server ; } continue ; } /* local bus */ if (IsAlarmDir(pn_selected_connection)) { /* root or branch directory -- alarm state */ ZERO_OR_ERROR alarm_return = FS_alarmdir(dirfunc, v, pn_selected_connection); if ( alarm_return ) { ret = alarm_return ; } } else { ret = FS_cache2real(dirfunc, v, pn_selected_connection, flags); } } return ret; } #endif /* OW_MT */ /* Device directory (i.e. show the properties) -- all from memory */ /* Respect the Visibility status and also show only the correct subdir level */ static ZERO_OR_ERROR FS_devdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_device_directory) { struct device * dev = pn_device_directory->selected_device ; struct filetype *lastft = &(dev->filetype_array[dev->count_of_filetypes]); /* last filetype struct */ struct filetype *ft_pointer; /* first filetype struct */ char subdir_name[OW_FULLNAME_MAX + 1]; size_t subdir_len; uint32_t ignoreflag ; STAT_ADD1(dir_dev.calls); // Add subdir to name (SubDirectory is within a device, but an extra layer of grouping of properties) if (pn_device_directory->subdir == NO_SUBDIR) { // not sub directory subdir_name[0] = '\0' ; subdir_len = 0; ft_pointer = dev->filetype_array; } else { // device subdirectory -- so use the sorted list to find all entries with the same prefix strncpy(subdir_name, pn_device_directory->subdir->name, OW_FULLNAME_MAX); strcat(subdir_name, "/"); subdir_len = strlen(subdir_name); ft_pointer = pn_device_directory->subdir + 1; // next element (first one truly in the subdir) } for (; ft_pointer < lastft; ++ft_pointer) { /* loop through filetypes */ char *namepart ; /* test that start of name matches directory name */ if (strncmp(ft_pointer->name, subdir_name, subdir_len) != 0) { // end of subdir break; } namepart = &ft_pointer->name[subdir_len]; // point after subdir name if ( strchr( namepart, '/') != NULL) { // subdir elements (and we're not in this subdir!) continue; } if (ft_pointer->ag==NON_AGGREGATE) { FS_dir_plus(dirfunc, v, &ignoreflag, pn_device_directory, namepart); STAT_ADD1(dir_dev.entries); } else if (ft_pointer->ag->combined==ag_sparse) { struct parsedname s_pn_file_entry; struct parsedname *pn_file_entry = &s_pn_file_entry; if (ft_pointer->ag->letters==ag_letters) { if (FS_ParsedNamePlusText(pn_device_directory->path, namepart, "xxx", pn_file_entry) == 0) { switch ( FS_visible(pn_file_entry) ) { // hide hidden properties case visible_now : case visible_always: FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; STAT_ADD1(dir_dev.entries); break ; default: break ; } FS_ParsedName_destroy(pn_file_entry); } } else { if (FS_ParsedNamePlusText(pn_device_directory->path, namepart, "000", pn_file_entry) == 0) { switch ( FS_visible(pn_file_entry) ) { // hide hidden properties case visible_now : case visible_always: FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; STAT_ADD1(dir_dev.entries); break ; default: break ; } FS_ParsedName_destroy(pn_file_entry); } } } else { int extension; int first_extension = (ft_pointer->format == ft_bitfield) ? EXTENSION_BYTE : EXTENSION_ALL; struct parsedname s_pn_file_entry; struct parsedname *pn_file_entry = &s_pn_file_entry; for (extension = first_extension; extension < ft_pointer->ag->elements; ++extension) { if (FS_ParsedNamePlusExt(pn_device_directory->path, namepart, extension, ft_pointer->ag->letters, pn_file_entry) == 0) { switch ( FS_visible(pn_file_entry) ) { // hide hidden properties case visible_now : case visible_always: FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; STAT_ADD1(dir_dev.entries); break ; default: break ; } FS_ParsedName_destroy(pn_file_entry); } } } } return 0; } /* Device directory -- all from memory -- for structure */ static ZERO_OR_ERROR FS_structdevdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_device_directory) { struct filetype *lastft = &(pn_device_directory->selected_device->filetype_array[pn_device_directory->selected_device->count_of_filetypes]); /* last filetype struct */ struct filetype *ft_pointer; /* first filetype struct */ char subdir_name[OW_FULLNAME_MAX + 1]; size_t subdir_len; // Add subdir to name (SubDirectory is within a device, but an extra layer of grouping of properties) if (pn_device_directory->subdir == NO_SUBDIR) { // not sub directory subdir_name[0] = '\0' ; subdir_len = 0; ft_pointer = pn_device_directory->selected_device->filetype_array; } else { // device subdirectory -- so use the sorted list to find all entries with the same prefix strncpy(subdir_name, pn_device_directory->subdir->name, OW_FULLNAME_MAX); strcat(subdir_name, "/"); subdir_len = strlen(subdir_name); ft_pointer = pn_device_directory->subdir + 1; // next element (first one truly in the subdir) } for (; ft_pointer < lastft; ++ft_pointer) { /* loop through filetypes */ char *namepart ; if ( ft_pointer->visible == INVISIBLE ) { // hide always invisible // done without actually calling the visibility function since // the device is generic for structure listings and may not // be an actual device. continue ; } /* test that start of name matches directory name */ if (strncmp(ft_pointer->name, subdir_name, subdir_len) != 0) { // end of subdir break; } namepart = &ft_pointer->name[subdir_len]; // point after subdir name if ( strchr( namepart, '/') != NULL) { // subdir elements (and we're not in this subdir!) continue; } if (ft_pointer->ag==NON_AGGREGATE) { struct parsedname s_pn_file_entry; struct parsedname *pn_file_entry = &s_pn_file_entry; if (FS_ParsedNamePlus(pn_device_directory->path, namepart, pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } } else if (ft_pointer->ag->combined==ag_sparse) { // Aggregate property struct parsedname s_pn_file_entry; struct parsedname *pn_file_entry = &s_pn_file_entry; if ( ft_pointer->ag->letters == ag_letters ) { if (FS_ParsedNamePlusText(pn_device_directory->path, namepart, "xxx", pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } } else { if (FS_ParsedNamePlusText(pn_device_directory->path, namepart, "000", pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } } } else { // Aggregate property struct parsedname s_pn_file_entry; struct parsedname *pn_file_entry = &s_pn_file_entry; if ( ft_pointer->format == ft_bitfield ) { if (FS_ParsedNamePlusExt(pn_device_directory->path, namepart, EXTENSION_BYTE, ft_pointer->ag->letters, pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } } if (FS_ParsedNamePlusExt(pn_device_directory->path, namepart, EXTENSION_ALL, ft_pointer->ag->letters, pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } // unlike real directory, only show the first array element since the data is redundant if (FS_ParsedNamePlusExt(pn_device_directory->path, namepart, 0, ft_pointer->ag->letters, pn_file_entry) == 0) { FS_dir_entry_aliased( dirfunc, v, pn_file_entry) ; FS_ParsedName_destroy(pn_file_entry); } } } return 0; } /* Note -- alarm directory is smaller, no adapters or stats or uncached */ static ZERO_OR_ERROR FS_alarmdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_alarm_directory) { enum search_status ret; struct device_search ds; // holds search state uint32_t ignoreflag ; /* Special handling for External directory -- no alarm */ if ( get_busmode(pn_alarm_directory->selected_connection) == bus_external ) { return 0 ; } /* cache from Server if this is a remote bus */ if (BusIsServer(pn_alarm_directory->selected_connection)) { return ServerDir(dirfunc, v, pn_alarm_directory, &ignoreflag); } /* Certain buses are not real bus masters (like usb-monitor and w1-monitor) */ if ( pn_alarm_directory->selected_connection->iroutines.flags & ADAP_FLAG_sham ) { return 0 ; } /* STATISCTICS */ STAT_ADD1(dir_main.calls); ret = PossiblyLockedBusCall( BUS_first_alarm, &ds, pn_alarm_directory) ; while ( ret == search_good ) { char dev[PROPERTY_LENGTH_ALIAS + 1]; STAT_ADD1(dir_main.entries); FS_devicename(dev, PROPERTY_LENGTH_ALIAS, ds.sn, pn_alarm_directory); FS_dir_plus(dirfunc, v, &ignoreflag, pn_alarm_directory, dev); ret = PossiblyLockedBusCall( BUS_next, &ds, pn_alarm_directory) ; } switch ( ret ) { case search_good: case search_done: return 0 ; case search_error: default: return -EIO; } } static enum search_status PossiblyLockedBusCall( enum search_status (* first_next)(struct device_search *, const struct parsedname *), struct device_search * ds, const struct parsedname * pn ) { enum search_status ret; // This is also called from the reconnection routine -- we use a flag to avoid mutex doubling and deadlock if ( NotReconnect(pn) ) { BUSLOCK(pn); ret = first_next(ds, pn) ; BUSUNLOCK(pn); } else { ret = first_next(ds, pn) ; } return ret ; } /* A directory of devices -- either main or branch */ /* not within a device, nor alarm state */ /* Also, adapters and stats handled elsewhere */ /* Scan the directory from the BUS and add to cache */ static ZERO_OR_ERROR FS_realdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags) { struct device_search ds; size_t devices = 0; struct dirblob db; enum search_status ret; /* cache from Server if this is a remote bus */ if (BusIsServer(pn_whole_directory->selected_connection)) { return ServerDir(dirfunc, v, pn_whole_directory, flags); } /* Certain buses are not real bus masters (like usb-monitor and w1-monitor) */ if ( pn_whole_directory->selected_connection->iroutines.flags & ADAP_FLAG_sham ) { return 0 ; } /* STATISTICS */ STAT_ADD1(dir_main.calls); DirblobInit(&db); // set up a fresh dirblob ret = PossiblyLockedBusCall( BUS_first, &ds, pn_whole_directory) ; if (RootNotBranch(pn_whole_directory)) { db.allocated = pn_whole_directory->selected_connection->last_root_devs; // root dir estimated length } while ( ret == search_good ) { char dev[PROPERTY_LENGTH_ALIAS + 1]; /* Add to device cache */ Cache_Add_Device(pn_whole_directory->selected_connection->index,ds.sn) ; /* Get proper device name (including alias subst) */ FS_devicename(dev, PROPERTY_LENGTH_ALIAS, ds.sn, pn_whole_directory); /* Execute callback function */ if ( FS_dir_plus(dirfunc, v, flags, pn_whole_directory, dev) != 0 ) { DirblobPoison(&db); break ; } DirblobAdd(ds.sn, &db); ++devices; ret = PossiblyLockedBusCall( BUS_next, &ds, pn_whole_directory) ; } STATLOCK; dir_main.entries += devices; STATUNLOCK; switch ( ret ) { case search_done: if ( RootNotBranch(pn_whole_directory) ) { pn_whole_directory->selected_connection->last_root_devs = devices; // root dir estimated length } /* Add to the cache (full list as a single element */ if (DirblobPure(&db) && (ret == search_done) ) { Cache_Add_Dir(&db, pn_whole_directory); } DirblobClear(&db); return 0 ; case search_good: case search_error: default: DirblobClear(&db); return -EIO ; } } /* points "serial number" to directory -- 0 for root -- DS2409/main|aux for branch -- DS2409 needs only the last element since each DS2409 is unique */ void FS_LoadDirectoryOnly(struct parsedname *pn_directory, const struct parsedname *pn_original) { if (pn_directory != pn_original) { memcpy(pn_directory, pn_original, sizeof(struct parsedname)); //shallow copy } if (RootNotBranch(pn_directory)) { memset(pn_directory->sn, 0, SERIAL_NUMBER_SIZE); } else { // Stuff the branch into the checksum slot // Makes the branch address unique (DS2409 id + branch) --pn_directory->ds2409_depth; memcpy(pn_directory->sn, pn_directory->bp[pn_directory->ds2409_depth].sn, SERIAL_NUMBER_SIZE-1); pn_directory->sn[SERIAL_NUMBER_SIZE-1] = pn_directory->bp[pn_directory->ds2409_depth].branch; } pn_directory->selected_device = NO_DEVICE; } /* A directory of devices -- either main or branch */ /* not within a device, nor alarm state */ /* Also, adapters and stats handled elsewhere */ /* Cache2Real try the cache first, else get directory from bus (and add to cache) */ static ZERO_OR_ERROR FS_cache2real(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_real_directory, uint32_t * flags) { size_t dindex; struct dirblob db; BYTE sn[8]; /* Special handling for External directory -- just walk tree */ if ( get_busmode(pn_real_directory->selected_connection) == bus_external ) { return FS_externaldir(dirfunc, v, pn_real_directory) ; } /* Test to see whether we should get the directory "directly" */ if (SpecifiedBus(pn_real_directory) || IsUncachedDir(pn_real_directory) || BAD( Cache_Get_Dir(&db, pn_real_directory)) ) { //printf("FS_cache2real: didn't find anything at bus %d\n", pn_real_directory->selected_connection->index); return FS_realdir(dirfunc, v, pn_real_directory, flags); } //printf("Post test cache for dir, snlist=%p, devices=%lu\n",snlist,devices) ; /* We have a cached list in snlist. Note that we have to free this memory */ /* STATISTICS */ STAT_ADD1(dir_main.calls); /* Get directory from the cache */ for (dindex = 0; DirblobGet(dindex, sn, &db) == 0; ++dindex) { char dev[PROPERTY_LENGTH_ALIAS + 1]; FS_devicename(dev, PROPERTY_LENGTH_ALIAS, sn, pn_real_directory); FS_dir_plus(dirfunc, v, flags, pn_real_directory, dev); } DirblobClear(&db); /* allocated in Cache_Get_Dir */ STATLOCK; dir_main.entries += dindex; STATUNLOCK; return 0; } // must lock a global struct for walking through tree -- limitation of "twalk" // struct for walking through tree -- cannot send data except globally struct { void (*dirfunc) (void *, const struct parsedname *); void *v; struct parsedname *pn_directory; } typedir_action_struct; static void Typediraction(const void *t, const VISIT which, const int depth) { uint32_t ignoreflag ; (void) depth; switch (which) { case leaf: case postorder: FS_dir_plus(typedir_action_struct.dirfunc, typedir_action_struct.v, &ignoreflag, typedir_action_struct.pn_directory, ((const struct device_opaque *) t)->key->family_code); default: break; } } /* Show the pn_directory->type (statistics, system, ...) entries */ /* Only the top levels, the rest will be shown by FS_devdir */ static ZERO_OR_ERROR FS_typedir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_type_directory) { struct parsedname s_pn_type_device; struct parsedname *pn_type_device = &s_pn_type_device; memcpy(pn_type_device, pn_type_directory, sizeof(struct parsedname)); // shallow copy LEVEL_DEBUG("called on %s", pn_type_directory->path); TYPEDIRLOCK; typedir_action_struct.dirfunc = dirfunc; typedir_action_struct.v = v; typedir_action_struct.pn_directory = pn_type_device; twalk(Tree[pn_type_directory->type], Typediraction); TYPEDIRUNLOCK; return 0; } // must lock a global struct for walking through tree -- limitation of "twalk" // struct for walking through tree -- cannot send data except globally struct { void (*dirfunc) (void *, const struct parsedname *); void *v; struct parsedname *pn_directory; } externaldir_action_struct; static void Externaldiraction(const void *nodep, const VISIT which, const int depth) { const struct sensor_node *p = *(struct sensor_node * const *) nodep; uint32_t ignoreflag ; (void) depth; switch (which) { case leaf: case postorder: FS_dir_plus(externaldir_action_struct.dirfunc, externaldir_action_struct.v, &ignoreflag, externaldir_action_struct.pn_directory,p->name); default: break; } } /* Show the external entries */ /* Only the sensors */ static ZERO_OR_ERROR FS_externaldir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_external_directory) { struct parsedname s_pn_external_device; struct parsedname *pn_external_device = &s_pn_external_device; memcpy(pn_external_device, pn_external_directory, sizeof(struct parsedname)); // shallow copy LEVEL_DEBUG("called on %s", pn_external_directory->path); EXTERNALDIRLOCK; externaldir_action_struct.dirfunc = dirfunc; externaldir_action_struct.v = v; externaldir_action_struct.pn_directory = pn_external_device; twalk( sensor_tree, Externaldiraction); EXTERNALDIRUNLOCK; return 0; } /* Show the bus entries */ static ZERO_OR_ERROR FS_busdir(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn_directory) { char bus[OW_FULLNAME_MAX]; struct connection_in * in ; uint32_t ignoreflag ; if (!RootNotBranch(pn_directory)) { return 0; } for ( in = Inbound_Control.head ; in != NO_CONNECTION ; in = in->next ) { UCLIBCLOCK; snprintf(bus, OW_FULLNAME_MAX, "bus.%d", in->index); UCLIBCUNLOCK; FS_dir_plus(dirfunc, v, &ignoreflag, pn_directory, bus); } return 0; } /* Parse and show */ static ZERO_OR_ERROR FS_dir_plus(void (*dirfunc) (void *, const struct parsedname *), void *v, uint32_t * flags, const struct parsedname *pn_directory, const char *file) { struct parsedname s_pn_plus_directory; struct parsedname *pn_plus_directory = &s_pn_plus_directory; if (FS_ParsedNamePlus(pn_directory->path, file, pn_plus_directory) == 0) { switch ( FS_visible(pn_plus_directory) ) { // hide hidden properties case visible_now : case visible_always: FS_dir_entry_aliased( dirfunc, v, pn_plus_directory) ; if ( pn_plus_directory->selected_device ){ flags[0] |= pn_plus_directory->selected_device->flags; } break ; default: break ; } FS_ParsedName_destroy(pn_plus_directory) ; return 0; } return -ENOENT; } owfs-2.8p15/module/owlib/src/c/ow_net_client.c0000644000175000017500000001110211736626772016233 00000000000000/* $Id: ow_net_client.c,v 1.27 2012/04/01 18:20:44 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" GOOD_OR_BAD ClientAddr(char *sname, char * default_port, struct connection_in *in) { struct addrinfo hint; struct address_pair ap ; int ret; Parse_Address( sname, &ap ) ; switch ( ap.entries ) { case 0: // Complete default address SOC(in)->dev.tcp.host = NULL; SOC(in)->dev.tcp.service = owstrdup(default_port); break ; case 1: // single entry -- usually port unless a dotted quad switch ( ap.first.type ) { case address_none: SOC(in)->dev.tcp.host = NULL; SOC(in)->dev.tcp.service = owstrdup(default_port); break ; case address_dottedquad: // looks like an IP address SOC(in)->dev.tcp.host = owstrdup(ap.first.alpha); SOC(in)->dev.tcp.service = owstrdup(default_port); break ; case address_numeric: SOC(in)->dev.tcp.host = NULL; SOC(in)->dev.tcp.service = owstrdup(ap.first.alpha); break ; default: // assume it's a port if it's the SERVER if ( strcasecmp( default_port, DEFAULT_SERVER_PORT ) == 0 ) { SOC(in)->dev.tcp.host = NULL; SOC(in)->dev.tcp.service = owstrdup(ap.first.alpha); } else { SOC(in)->dev.tcp.host = owstrdup(ap.first.alpha); SOC(in)->dev.tcp.service = owstrdup(default_port); } break ; } break ; case 2: default: // address:port format -- unambiguous SOC(in)->dev.tcp.host = ( ap.first.type == address_none ) ? NULL : owstrdup(ap.first.alpha) ; SOC(in)->dev.tcp.service = ( ap.second.type == address_none ) ? owstrdup(default_port) : owstrdup(ap.second.alpha) ; break ; } Free_Address( &ap ) ; memset(&hint, 0, sizeof(struct addrinfo)); // hint.ai_socktype = SOCK_STREAM | SOCK_CLOEXEC ; hint.ai_socktype = SOCK_STREAM ; #if OW_CYGWIN hint.ai_family = AF_INET; if( SOC(in)->dev.tcp.host == NULL) { /* getaddrinfo doesn't work with host=NULL for cygwin */ SOC(in)->dev.tcp.host = owstrdup("127.0.0.1"); } #else hint.ai_family = AF_UNSPEC; #endif LEVEL_DEBUG("IP address=[%s] port=[%s]", SAFESTRING( SOC(in)->dev.tcp.host), SOC(in)->dev.tcp.service); ret = getaddrinfo( SOC(in)->dev.tcp.host, SOC(in)->dev.tcp.service, &hint, &( SOC(in)->dev.tcp.ai) ) ; if ( ret != 0 ) { LEVEL_CONNECT("GETADDRINFO error %s", gai_strerror(ret)); return gbBAD; } return gbGOOD; } void FreeClientAddr(struct connection_in *in) { SAFEFREE( SOC(in)->dev.tcp.host) ; SAFEFREE( SOC(in)->dev.tcp.service) ; if ( SOC(in)->dev.tcp.ai != NULL ) { freeaddrinfo( SOC(in)->dev.tcp.ai); SOC(in)->dev.tcp.ai = NULL; } SOC(in)->dev.tcp.ai_ok = NULL; } /* Usually called with BUS locked, to protect ai settings */ FILE_DESCRIPTOR_OR_ERROR ClientConnect(struct connection_in *in) { FILE_DESCRIPTOR_OR_ERROR file_descriptor; struct addrinfo *ai; if ( SOC(in)->dev.tcp.ai == NULL) { LEVEL_DEBUG("Client address not yet parsed"); return FILE_DESCRIPTOR_BAD; } /* Can't change ai_ok without locking the in-device. * First try the last working address info, if it fails lock * the in-device and loop through the list until it works. * Not a perfect solution, but it should work at least. */ ai = SOC(in)->dev.tcp.ai_ok; if (ai) { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if ( FILE_DESCRIPTOR_VALID(file_descriptor) ) { fcntl (file_descriptor, F_SETFD, FD_CLOEXEC); // for safe forking if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) { return file_descriptor; } close(file_descriptor); } } ai = SOC(in)->dev.tcp.ai; // loop from first address info since it failed. do { file_descriptor = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if ( FILE_DESCRIPTOR_VALID(file_descriptor) ) { fcntl (file_descriptor, F_SETFD, FD_CLOEXEC); // for safe forking if (connect(file_descriptor, ai->ai_addr, ai->ai_addrlen) == 0) { SOC(in)->dev.tcp.ai_ok = ai; return file_descriptor; } close(file_descriptor); } } while ((ai = ai->ai_next)); SOC(in)->dev.tcp.ai_ok = NULL; ERROR_CONNECT("Socket problem"); STAT_ADD1(NET_connection_errors); return FILE_DESCRIPTOR_BAD; } owfs-2.8p15/module/owlib/src/c/ow_eprom_write.c0000664000175000017500000000471711367606004016445 00000000000000/* $Id: ow_eprom_write.c,v 1.10 2010/05/03 17:46:44 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Changes 7/2004 Extensive improvements based on input from Serg Oskin */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ----------- */ static GOOD_OR_BAD COMMON_write_eprom_mem(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_write_eprom_byte(BYTE code, BYTE data, off_t offset, const struct parsedname *pn); #define _1W_WRITE_MEMORY 0x0F #define _1W_WRITE_STATUS 0x55 // use owq instead of components ZERO_OR_ERROR COMMON_write_eprom_mem_owq(struct one_wire_query * owq) { return GB_to_Z_OR_E(COMMON_write_eprom_mem( OWQ_explode(owq))); } static GOOD_OR_BAD COMMON_write_eprom_mem(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { int byte_number; for (byte_number = 0; byte_number < (int) size; ++byte_number) { RETURN_BAD_IF_BAD( OW_write_eprom_byte(_1W_WRITE_MEMORY, data[byte_number], offset + byte_number, pn) ) ; } return gbGOOD; } static GOOD_OR_BAD OW_write_eprom_byte(BYTE code, BYTE data, off_t offset, const struct parsedname *pn) { BYTE p[6] = { code, LOW_HIGH_ADDRESS(offset), data, }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 4, 0), TRXN_PROGRAM, TRXN_END, }; return BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_server_message.c0000644000175000017500000006222211731463643017121 00000000000000/* $Id: ow_server_message.c,v 1.31 2012/03/14 03:48:40 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_standard.h" // for FS_?_alias struct server_connection_state { FILE_DESCRIPTOR_OR_ERROR file_descriptor ; enum persistent_state { persistent_yes, persistent_no, } persistence ; struct connection_in * in ; } ; struct directory_element_structure { const struct parsedname * pn_whole_directory ; struct dirblob db ; void (*dirfunc) (void *, const struct parsedname * const) ; void * v ; } ; static uint32_t SetupControlFlags(const struct parsedname *pn); static ZERO_OR_ERROR ServerDIRALL(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags); static ZERO_OR_ERROR ServerDIR(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags); static void Directory_Element_Init( struct directory_element_structure * des ); static void Directory_Element_Finish( struct directory_element_structure * des ); static ZERO_OR_ERROR Directory_Element( char * current_file, struct directory_element_structure * des ); static void Close_Persistent( struct server_connection_state * scs) ; static void Release_Persistent( struct server_connection_state * scs, int granted ) ; static GOOD_OR_BAD To_Server( struct server_connection_state * scs, struct server_msg * sm, struct serverpackage *sp) ; static SIZE_OR_ERROR WriteToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp); static SIZE_OR_ERROR From_Server( struct server_connection_state * scs, struct client_msg *cm, char *msg, size_t size) ; static void *From_ServerAlloc(struct server_connection_state * scs, struct client_msg *cm) ; // Send to an owserver using the READ message SIZE_OR_ERROR ServerRead(struct one_wire_query *owq) { struct server_msg sm; struct client_msg cm; struct parsedname *pn_file_entry = PN(owq); struct serverpackage sp = { pn_file_entry->path_to_server, NULL, 0, pn_file_entry->tokenstring, pn_file_entry->tokens, }; struct server_connection_state scs ; // initialization scs.in = pn_file_entry->selected_connection ; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_read; sm.size = OWQ_size(owq); sm.offset = OWQ_offset(owq); // Alias should show local understanding except if bus.x specified if ( pn_file_entry->selected_filetype->format == ft_alias && ! SpecifiedRemoteBus(pn_file_entry) ) { ignore_result = FS_r_alias( owq ) ; return OWQ_length(owq) ; } LEVEL_CALL("SERVER(%d) path=%s", pn_file_entry->selected_connection->index, SAFESTRING(pn_file_entry->path_to_server)); // Send to owserver sm.control_flags = SetupControlFlags(pn_file_entry); if ( BAD( To_Server( &scs, &sm, &sp) ) ) { Release_Persistent( &scs, 0); return -EIO ; } // Receive from owserver if ( From_Server( &scs, &cm, OWQ_buffer(owq), OWQ_size(owq)) < 0 ) { Release_Persistent( &scs, 0); return -EIO ; } Release_Persistent( &scs, cm.control_flags & PERSISTENT_MASK); return cm.ret; } // Send to an owserver using the PRESENT message INDEX_OR_ERROR ServerPresence( struct parsedname *pn_file_entry) { struct server_msg sm; struct client_msg cm; struct serverpackage sp = { pn_file_entry->path_to_server, NULL, 0, pn_file_entry->tokenstring, pn_file_entry->tokens, }; BYTE * serial_number ; struct server_connection_state scs ; // initialization scs.in = pn_file_entry->selected_connection ; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_presence; LEVEL_CALL("SERVER(%d) path=%s", pn_file_entry->selected_connection->index, SAFESTRING(pn_file_entry->path_to_server)); // Send to owserver sm.control_flags = SetupControlFlags( pn_file_entry); if ( BAD( To_Server( &scs, &sm, &sp) ) ) { Release_Persistent( &scs, 0 ) ; return INDEX_BAD ; } // Receive from owserver serial_number = (BYTE *) From_ServerAlloc( &scs, &cm) ; if (cm.ret < 0) { Release_Persistent(&scs, 0 ); return INDEX_BAD ; } // Newer owservers return the serial number -- relevant for alias propagation if ( serial_number ) { memcpy( pn_file_entry->sn, serial_number, SERIAL_NUMBER_SIZE ) ; owfree( serial_number) ; } Release_Persistent(&scs, cm.control_flags & PERSISTENT_MASK); return INDEX_VALID(cm.ret) ? pn_file_entry->selected_connection->index : INDEX_BAD; } // Send to an owserver using the WRITE message ZERO_OR_ERROR ServerWrite(struct one_wire_query *owq) { struct server_msg sm; struct client_msg cm; struct parsedname *pn_file_entry = PN(owq); struct serverpackage sp = { pn_file_entry->path_to_server, (BYTE *) OWQ_buffer(owq), OWQ_size(owq), pn_file_entry->tokenstring, pn_file_entry->tokens, }; struct server_connection_state scs ; // initialization scs.in = pn_file_entry->selected_connection ; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_write; sm.size = OWQ_size(owq); sm.offset = OWQ_offset(owq); LEVEL_CALL("SERVER(%d) path=%s", pn_file_entry->selected_connection->index, SAFESTRING(pn_file_entry->path_to_server)); // Send to owserver sm.control_flags = SetupControlFlags( pn_file_entry); if ( BAD( To_Server( &scs, &sm, &sp) ) ) { Release_Persistent( &scs, 0 ) ; return -EIO ; } // Receive from owserver if ( From_Server( &scs, &cm, NULL, 0) < 0) { Release_Persistent( &scs, 0 ) ; return -EIO ; } { int32_t control_flags = cm.control_flags & ~(SHOULD_RETURN_BUS_LIST | PERSISTENT_MASK | SAFEMODE); // keep current safemode control_flags |= LocalControlFlags & SAFEMODE ; CONTROLFLAGSLOCK; if (LocalControlFlags != control_flags) { // replace control flags (except safemode persists) //printf("ServerRead: cm.control_flags changed! controlflags=%X cm.control_flags=%X\n", SemiGlobal, cm.control_flags); LocalControlFlags = control_flags; } CONTROLFLAGSUNLOCK; } Release_Persistent(&scs, cm.control_flags & PERSISTENT_MASK); return cm.ret; } // Send to an owserver using either the DIR or DIRALL message ZERO_OR_ERROR ServerDir(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags) { ZERO_OR_ERROR ret; struct connection_in * in = pn_whole_directory->selected_connection ; // Do we know this server doesn't support DIRALL? if (in->master.tcp.no_dirall) { return ServerDIR(dirfunc, v, pn_whole_directory, flags); } // Did we ask for no DIRALL explicitly? if (Globals.no_dirall) { return ServerDIR(dirfunc, v, pn_whole_directory, flags); } // device directories have lower latency with DIR if (IsRealDir(pn_whole_directory) || IsAlarmDir(pn_whole_directory)) { return ServerDIR(dirfunc, v, pn_whole_directory, flags); } // try DIRALL and see if supported if ((ret = ServerDIRALL(dirfunc, v, pn_whole_directory, flags)) == -ENOMSG) { in->master.tcp.no_dirall = 1; return ServerDIR(dirfunc, v, pn_whole_directory, flags); } return ret; } // Send to an owserver using the DIR message static ZERO_OR_ERROR ServerDIR(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags) { struct server_msg sm; struct client_msg cm; struct connection_in * in = pn_whole_directory->selected_connection ; struct serverpackage sp = { pn_whole_directory->path_to_server, NULL, 0, pn_whole_directory->tokenstring, pn_whole_directory->tokens, }; struct server_connection_state scs ; struct directory_element_structure des ; char *return_path; // initialization scs.in = pn_whole_directory->selected_connection ; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_dir; LEVEL_CALL("SERVER(%d) path=%s path_to_server=%s", in->index, SAFESTRING(pn_whole_directory->path), SAFESTRING(pn_whole_directory->path_to_server)); // Send to owserver sm.control_flags = SetupControlFlags( pn_whole_directory); if ( BAD( To_Server( &scs, &sm, &sp) ) ) { Release_Persistent( &scs, 0 ) ; return -EIO ; } des.dirfunc = dirfunc ; des.v = v ; des.pn_whole_directory = pn_whole_directory ; Directory_Element_Init( &des ) ; // Receive from owserver -- in a loop for each directory entry while ( (return_path = From_ServerAlloc(&scs, &cm)) != NO_PATH ) { ZERO_OR_ERROR ret; return_path[cm.payload - 1] = '\0'; /* Ensure trailing null */ ret = Directory_Element( return_path, &des ) ; owfree(return_path); if (ret) { cm.ret = ret; break; } } Directory_Element_Finish( &des ) ; DIRLOCK; /* flags are sent back in "offset" of final blank entry */ flags[0] |= cm.offset; DIRUNLOCK; Release_Persistent(&scs, cm.control_flags & PERSISTENT_MASK); return cm.ret; } // Send to an owserver using the DIRALL message static ZERO_OR_ERROR ServerDIRALL(void (*dirfunc) (void *, const struct parsedname * const), void *v, const struct parsedname *pn_whole_directory, uint32_t * flags) { ASCII *comma_separated_list; struct server_msg sm; struct client_msg cm; struct serverpackage sp = { pn_whole_directory->path_to_server, NULL, 0, pn_whole_directory->tokenstring, pn_whole_directory->tokens, }; struct connection_in * in = pn_whole_directory->selected_connection ; struct server_connection_state scs ; // initialization scs.in = in ; memset(&sm, 0, sizeof(struct server_msg)); memset(&cm, 0, sizeof(struct client_msg)); sm.type = msg_dirall; LEVEL_CALL("SERVER(%d) path=%s path_to_server=%s", in->index, SAFESTRING(pn_whole_directory->path), SAFESTRING(pn_whole_directory->path_to_server)); // Send to owserver sm.control_flags = SetupControlFlags( pn_whole_directory); if ( BAD( To_Server( &scs, &sm, &sp) ) ) { Release_Persistent( &scs, 0 ) ; return -EIO ; } // Receive from owserver comma_separated_list = From_ServerAlloc(&scs, &cm); LEVEL_DEBUG("got %s", SAFESTRING(comma_separated_list)); if (cm.ret == 0) { ASCII *current_file; ASCII *rest_of_comma_list = comma_separated_list; struct directory_element_structure des ; des.dirfunc = dirfunc ; des.v = v ; des.pn_whole_directory = pn_whole_directory ; Directory_Element_Init( &des ) ; while ((current_file = strsep(&rest_of_comma_list, ",")) != NULL) { ZERO_OR_ERROR ret = Directory_Element( current_file, &des ); if (ret) { cm.ret = ret; break; } } Directory_Element_Finish( &des ) ; DIRLOCK; /* flags are sent back in "offset" */ flags[0] |= cm.offset; DIRUNLOCK; } // free the allocated memory SAFEFREE(comma_separated_list) ; Release_Persistent( &scs, cm.control_flags & PERSISTENT_MASK ); return cm.ret; } static void Directory_Element_Init( struct directory_element_structure * des ) { /* If cacheable, try to allocate a blob for storage */ /* only for "read devices" and not alarm */ DirblobInit(&(des->db) ); if (IsRealDir(des->pn_whole_directory) && NotAlarmDir(des->pn_whole_directory) && !SpecifiedBus(des->pn_whole_directory) && des->pn_whole_directory->selected_device == NO_DEVICE) { if (RootNotBranch(des->pn_whole_directory)) { /* root dir */ BUSLOCK(des->pn_whole_directory); des->db.allocated = des->pn_whole_directory->selected_connection->last_root_devs; // root dir estimated length BUSUNLOCK(des->pn_whole_directory); } } else { DirblobPoison( &(des->db) ); // don't cache other directories } } static void Directory_Element_Finish( struct directory_element_structure * des ) { /* Add to the cache (full list as a single element */ if ( DirblobPure( &(des->db) ) ) { Cache_Add_Dir( &(des->db), des->pn_whole_directory); // end with a null entry if (RootNotBranch(des->pn_whole_directory)) { BUSLOCK(des->pn_whole_directory); des->pn_whole_directory->selected_connection->last_root_devs = DirblobElements( &(des->db) ); // root dir estimated length BUSUNLOCK(des->pn_whole_directory); } } DirblobClear( & (des->db) ); } static ZERO_OR_ERROR Directory_Element( char * current_file, struct directory_element_structure * des ) { struct parsedname s_pn_directory_element; struct parsedname * pn_directory_element = & s_pn_directory_element ; struct connection_in * in = des->pn_whole_directory->selected_connection ; ZERO_OR_ERROR ret ; LEVEL_DEBUG("got=[%s]", current_file); if (SpecifiedRemoteBus(des->pn_whole_directory)) { // Specified remote bus, add the bus to the path (in front) int path_length = strlen(current_file); char BigBuffer[path_length + 12]; int sn_ret ; char * no_leading_slash = ¤t_file[(current_file[0] == '/') ? 1 : 0] ; UCLIBCLOCK ; sn_ret = snprintf(BigBuffer, path_length + 11, "/bus.%d/%s",in->index, no_leading_slash ) ; UCLIBCUNLOCK ; if (sn_ret < 0) { return -EINVAL ; } ret = FS_ParsedName_BackFromRemote(BigBuffer, pn_directory_element); } else { ret = FS_ParsedName_BackFromRemote(current_file, pn_directory_element); } if ( ret < 0 ) { DirblobPoison( &(des->db) ); // don't cache a mistake return ret; } /* we got a device on bus_nr = pn_whole_directory->selected_connection->index. Cache it so we find it quicker next time we want to do read values from the the actual device */ if (IsRealDir(des->pn_whole_directory)) { /* If we get a device then cache the bus_nr */ Cache_Add_Device(in->index, pn_directory_element->sn); } /* Add to cache Blob -- snlist is also a flag for cachable */ if (DirblobPure( &(des->db) ) ) { /* only add if there is a blob allocated successfully */ DirblobAdd(pn_directory_element->sn, &(des->db) ); } // Now actually do the directory function on this element FS_dir_entry_aliased(des->dirfunc,des->v,pn_directory_element) ; // Cleanup FS_ParsedName_destroy(pn_directory_element); // destroy the last parsed name return 0 ; } /* read from server, free return pointer if not Null */ /* Adds an extra null byte at end */ static void *From_ServerAlloc(struct server_connection_state * scs, struct client_msg *cm) { BYTE *msg; struct timeval tv = { Globals.timeout_network + 1, 0, }; size_t actual_size ; do { /* loop until non delay message (payload>=0) */ tcp_read(scs->file_descriptor, (BYTE *) cm, sizeof(struct client_msg), &tv, &actual_size); if (actual_size != sizeof(struct client_msg)) { memset(cm, 0, sizeof(struct client_msg)); cm->ret = -EIO; return NO_PATH; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->control_flags = ntohl(cm->control_flags); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); if (cm->payload == 0) { return NO_PATH; } if (cm->ret < 0) { return NO_PATH; } if (cm->payload > MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE) { return NO_PATH; } msg = owmalloc((size_t) cm->payload + 1) ; if ( msg != NO_PATH ) { tcp_read(scs->file_descriptor, msg, (size_t) (cm->payload), &tv, &actual_size); if ((ssize_t)actual_size != cm->payload) { cm->payload = 0; cm->offset = 0; cm->ret = -EIO; owfree(msg); msg = NO_PATH; } } if(msg != NO_PATH) { msg[cm->payload] = '\0'; // safety NULL } return msg; } /* Read from server -- return negative on error, return 0 or positive giving size of data element */ static SIZE_OR_ERROR From_Server( struct server_connection_state * scs, struct client_msg *cm, char *msg, size_t size) { size_t rtry; size_t actual_read ; struct timeval tv = { Globals.timeout_network + 1, 0, }; do { // read regular header, or delay (delay when payload<0) tcp_read(scs->file_descriptor, (BYTE *) cm, sizeof(struct client_msg), &tv, &actual_read); if (actual_read != sizeof(struct client_msg)) { cm->size = 0; cm->ret = -EIO; return -EIO; } cm->payload = ntohl(cm->payload); cm->size = ntohl(cm->size); cm->ret = ntohl(cm->ret); cm->control_flags = ntohl(cm->control_flags); cm->offset = ntohl(cm->offset); } while (cm->payload < 0); // flag to show a delay message if (cm->payload == 0) { return 0; // No payload, done. } rtry = cm->payload < (ssize_t) size ? (size_t) cm->payload : size; tcp_read(scs->file_descriptor, (BYTE *) msg, rtry, &tv, &actual_read); // read expected payload now. if (actual_read != rtry) { LEVEL_DEBUG("Read only %d of %d\n",(int)actual_read,(int)rtry) ; cm->ret = -EIO; return -EIO; } if (cm->payload > (ssize_t) size) { // Uh oh. payload bigger than expected. close the connection Close_Persistent( scs ) ; return size; } return cm->payload; } static GOOD_OR_BAD To_Server( struct server_connection_state * scs, struct server_msg * sm, struct serverpackage *sp) { struct connection_in * in = scs->in ; // for convenience BYTE test_read[1] ; int old_flags ; ssize_t rcv_value ; int saved_errno ; // initialize the variables scs->file_descriptor = FILE_DESCRIPTOR_BAD ; scs->persistence = Globals.no_persistence ? persistent_no : persistent_yes ; // First set up the file descriptor based on persistent state if (scs->persistence == persistent_no) { // no persistence wanted scs->file_descriptor = ClientConnect(in); } else { // Persistence desired BUSLOCKIN(in); switch ( SOC(in)->file_descriptor ) { case FILE_DESCRIPTOR_PERSISTENT_IN_USE: // Currently in use, so make new non-persistent connection scs->file_descriptor = ClientConnect(in); scs->persistence = persistent_no ; break ; case FILE_DESCRIPTOR_BAD: // no conection currently, so make a new one scs->file_descriptor = ClientConnect(in); if ( FILE_DESCRIPTOR_VALID( scs->file_descriptor ) ) { SOC(in)->file_descriptor = FILE_DESCRIPTOR_PERSISTENT_IN_USE ; } break ; default: // persistent connection idle and waiting for use // connection_in is locked so this is safe scs->file_descriptor = SOC(in)->file_descriptor; SOC(in)->file_descriptor = FILE_DESCRIPTOR_PERSISTENT_IN_USE; break ; } BUSUNLOCKIN(in); } // Check if the server closed the connection // This is contributed by Jacob Joseph to fix a timeout problem. // http://permalink.gmane.org/gmane.comp.file-systems.owfs.devel/7306 //rcv_value = recv(scs->file_descriptor, test_read, 1, MSG_DONTWAIT | MSG_PEEK) ; old_flags = fcntl( scs->file_descriptor, F_GETFL, 0 ) ; // save socket flags if ( old_flags == -1 ) { rcv_value = -2 ; } else if ( fcntl( scs->file_descriptor, F_SETFL, old_flags | O_NONBLOCK ) == -1 ) { // set non-blocking rcv_value = -2 ; } else { rcv_value = recv(scs->file_descriptor, test_read, 1, MSG_PEEK) ; // test read the socket to see if closed saved_errno = errno ; if ( fcntl( scs->file_descriptor, F_SETFL, old_flags ) == -1 ) { // restore socket flags rcv_value = -2 ; } } switch ( rcv_value ) { case -1: if ( saved_errno==EAGAIN || saved_errno==EWOULDBLOCK ) { // No data to be read -- so connection healthy break ; } // real error, fall through to close connection case case -2: // fnctl error, fall through again case 0: LEVEL_DEBUG("Server connection was closed. Reconnecting."); Close_Persistent( scs); scs->file_descriptor = ClientConnect(in); if ( FILE_DESCRIPTOR_VALID( scs->file_descriptor ) ) { SOC(in)->file_descriptor = FILE_DESCRIPTOR_PERSISTENT_IN_USE ; } break ; default: // data to be read, so a good connection break ; } // Now test if ( FILE_DESCRIPTOR_NOT_VALID( scs->file_descriptor ) ) { STAT_ADD1(in->reconnect_state); Close_Persistent( scs ) ; return gbBAD ; } // Do the real work if (WriteToServer(scs->file_descriptor, sm, sp) >= 0) { // successful message return gbGOOD; } // This is where it gets a bit tricky. For non-persistent conections we're done' if ( scs->persistence == persistent_no ) { // not persistent, so no reconnection needed Close_Persistent( scs ) ; return gbBAD ; } // perhaps the persistent connection is stale? // Make a new one scs->file_descriptor = ClientConnect(in) ; // Now retest if ( FILE_DESCRIPTOR_NOT_VALID( scs->file_descriptor ) ) { // couldn't make that new connection -- free everything STAT_ADD1(in->reconnect_state); Close_Persistent( scs ) ; return gbBAD ; } // Leave in->file_descriptor = FILE_DESCRIPTOR_PERSISTENT_IN_USE // Second attempt at the write, now with new connection if (WriteToServer(scs->file_descriptor, sm, sp) >= 0) { // successful message return gbGOOD; } // bad write the second time -- clear everything Close_Persistent( scs ) ; return gbBAD ; } static void Close_Persistent( struct server_connection_state * scs) { // First set up the file descriptor based on persistent state if (scs->persistence == persistent_yes) { // no persistence wanted BUSLOCKIN(scs->in); SOC(scs->in)->file_descriptor = FILE_DESCRIPTOR_BAD ; BUSUNLOCKIN(scs->in); } scs->persistence = persistent_no ; Test_and_Close( &(scs->file_descriptor) ) ; } // should be const char * data but iovec has problems with const arguments static SIZE_OR_ERROR WriteToServer(int file_descriptor, struct server_msg *sm, struct serverpackage *sp) { int payload = 0; int tokens = 0; int nio = 0; int traffic_counter ; int server_type = Globals.program_type==program_type_server || Globals.program_type==program_type_external ; struct iovec io[5] = { {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, }; struct server_msg net_sm ; // First block to send, the header io[nio].iov_base = &net_sm; io[nio].iov_len = sizeof(struct server_msg); nio++; // Next block, the path if (sp->path != 0) { // send path (if not null) io[nio].iov_base = sp->path ; // gives a spurious compiler error -- constant is OK HERE! io[nio].iov_len = strlen(sp->path) + 1; payload = io[nio].iov_len ; nio++; } // next block, data (only for writes) if ((sp->datasize>0) && (sp->data!=NULL)) { // send data only for writes (if datasize not zero) io[nio].iov_base = sp->data ; io[nio].iov_len = sp->datasize ; payload += sp->datasize; nio++; } sm->version = MakeServerprotocol(OWSERVER_PROTOCOL_VERSION); if ( server_type ) { tokens = sp->tokens; sm->version |= MakeServermessage; // next block prior tokens (if an owserver) if (tokens > 0) { // owserver: send prior tags io[nio].iov_base = sp->tokenstring; io[nio].iov_len = tokens * sizeof(union antiloop); nio++; } // final block, new token (if an owserver) ++tokens; sm->version |= MakeServertokens(tokens); io[nio].iov_base = &(Globals.Token); // owserver: add our tag io[nio].iov_len = sizeof(union antiloop); nio++; } LEVEL_DEBUG("version=%u payload=%d size=%d type=%d SG=%X offset=%d",sm->version,payload,sm->size,sm->type,sm->control_flags,sm->offset); // encode in network order (just the header) net_sm.version = htonl( sm->version ); net_sm.payload = htonl( payload ); net_sm.size = htonl( sm->size ); net_sm.type = htonl( sm->type ); net_sm.control_flags = htonl( sm->control_flags ); net_sm.offset = htonl( sm->offset ); traffic_counter = 0 ; TrafficOutFD("write header" ,io[traffic_counter].iov_base,io[traffic_counter].iov_len,file_descriptor); ++traffic_counter; TrafficOutFD("write path" ,io[traffic_counter].iov_base,io[traffic_counter].iov_len,file_descriptor); if ((sp->datasize>0) && (sp->data!=NULL)) { // send data only for writes (if datasize not zero) ++traffic_counter; TrafficOutFD("write data" ,io[traffic_counter].iov_base,io[traffic_counter].iov_len,file_descriptor); } if ( server_type ) { if (sp->tokens > 0) { // owserver: send prior tags ++traffic_counter; TrafficOutFD("write old tokens" ,io[traffic_counter].iov_base,io[traffic_counter].iov_len,file_descriptor); } ++traffic_counter; TrafficOutFD("write new tokens" ,io[traffic_counter].iov_base,io[traffic_counter].iov_len,file_descriptor); } return writev(file_descriptor, io, nio) != (ssize_t) (payload + sizeof(struct server_msg) + tokens * sizeof(union antiloop)); } /* flag the sg for "virtual root" -- the remote bus was specifically requested */ static uint32_t SetupControlFlags(const struct parsedname *pn) { uint32_t control_flags = pn->control_flags; control_flags &= ~PERSISTENT_MASK; if (Globals.no_persistence == 0) { control_flags |= PERSISTENT_MASK; } /* from owlib to owserver never wants alias */ control_flags &= ~ALIAS_REQUEST ; control_flags &= ~SHOULD_RETURN_BUS_LIST; if (SpecifiedBus(pn)) { control_flags |= SHOULD_RETURN_BUS_LIST; } return control_flags; } /* Clean up at end of routine, either leave connection open and persistent flag available, or close */ static void Release_Persistent( struct server_connection_state * scs, int granted ) { if ( granted == 0 ) { Close_Persistent( scs ) ; return ; } if ( FILE_DESCRIPTOR_NOT_VALID( scs->file_descriptor) ) { Close_Persistent( scs ) ; return ; } if (scs->persistence == persistent_no) { // non-persistence from the start Close_Persistent( scs ) ; return ; } // mark as available BUSLOCKIN(scs->in); SOC(scs->in)->file_descriptor = scs->file_descriptor; BUSUNLOCKIN(scs->in); scs->persistence = persistent_no ; // we no longer own this connection scs->file_descriptor = FILE_DESCRIPTOR_BAD ; } owfs-2.8p15/module/owlib/src/c/ow_connect.c0000644000175000017500000001237611741156523015542 00000000000000/* $Id: ow_connect.c,v 1.141 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" /* Routines for handling a linked list of connections in*/ /* typical connection in would be the serial port or USB */ /* Globals */ struct inbound_control Inbound_Control = { .active = 0, .next_index = 0, .head = NO_CONNECTION, .next_fake = 0, .next_tester = 0, .next_mock = 0, .w1_monitor = NO_CONNECTION , .external = NO_CONNECTION , }; struct connection_in *find_connection_in(int bus_number) { struct connection_in *c_in; // step through inbound linked list for (c_in = Inbound_Control.head; c_in != NO_CONNECTION; c_in = c_in->next) { if (c_in->index == bus_number) { return c_in; } } LEVEL_DEBUG("Couldn't find bus number %d",bus_number); return NO_CONNECTION; } int SetKnownBus( int bus_number, struct parsedname * pn) { struct connection_in * found = find_connection_in( bus_number ) ; if ( found == NO_CONNECTION ) { return 1 ; } pn->state |= ePS_bus; pn->selected_connection=found ; pn->known_bus=found; return 0 ; } enum bus_mode get_busmode(struct connection_in *in) { if (in == NO_CONNECTION) { return bus_unknown; } return in->busmode; } // return true (non-zero) if the connection_in exists, and is remote int BusIsServer(struct connection_in *in) { if ( in == NO_CONNECTION ) { return 0 ; } return (in->busmode == bus_server) || (in->busmode == bus_zero); } /* Make a new connection_in entry, but DON'T place it in the chain (yet)*/ /* Based on a shallow copy of "in" if not NULL */ struct connection_in *AllocIn(const struct connection_in *old_in) { size_t len = sizeof(struct connection_in); struct connection_in *new_in = (struct connection_in *) owmalloc(len); if (new_in != NO_CONNECTION) { if (old_in == NO_CONNECTION) { // Not a copy memset(new_in, 0, len); SOC(new_in)->file_descriptor = FILE_DESCRIPTOR_BAD ; SOC(new_in)->type = ct_unknown ; SOC(new_in)->state = cs_virgin ; SOC(new_in)->devicename = NULL ; /* Indirection to head of list for multichannel devices */ OW_channel_init(new_in) ; /* Not yet a valid bus */ new_in->iroutines.flags = ADAP_FLAG_sham ; } else { // Copy of prior bus memcpy(new_in, old_in, len); if ( SOC(new_in)->devicename != NULL ) { // Don't make the name point to the same string, make a copy SOC(new_in)->devicename = owstrdup( SOC(old_in)->devicename ) ; } /* Indirection to head of list for multichannel devices */ new_in->channel_info.head = old_in ; } /* not yet linked */ new_in->next = NO_CONNECTION ; /* Support DS1994/DS2404 which require longer delays, and is automatically * turned on in *_next_both(). * If it's turned off, it will result into a faster reset-sequence. */ new_in->ds2404_found = 0; /* Flag first pass as need to clear all branches if DS2409 present */ new_in->branch.branch = eBranch_bad ; /* Arbitrary guess at root directory size for allocating cache blob */ new_in->last_root_devs = 10; new_in->AnyDevices = anydevices_unknown ; } else { LEVEL_DEFAULT("Cannot allocate memory for bus master structure"); } return new_in; } /* Place a new connection in the chain */ struct connection_in *LinkIn(struct connection_in *now) { if (now) { // Housekeeping to place in linked list // Locking done at a higher level now->next = Inbound_Control.head; /* put in linked list at start */ Inbound_Control.head = now; now->index = Inbound_Control.next_index++; ++Inbound_Control.active ; _MUTEX_INIT(now->bus_mutex); _MUTEX_INIT(now->dev_mutex); now->dev_db = NULL; } return now; } /* Create a new inbound structure and place it in the chain */ struct connection_in *NewIn(const struct connection_in *in) { return LinkIn( AllocIn(in) ) ; } /* Free all connection_in in reverse order (Added to head on creation, head-first deletion) */ void FreeInAll( void ) { while ( Inbound_Control.head ) { RemoveIn(Inbound_Control.head); } } void RemoveIn( struct connection_in * conn ) { /* NULL safe */ if ( conn == NO_CONNECTION ) { return ; } /* First unlink from list */ if ( Inbound_Control.head == conn ) { /* Head of list, easy */ Inbound_Control.head = conn->next ; --Inbound_Control.active ; } else { struct connection_in * now ; /* find in list and splice out */ for ( now = Inbound_Control.head ; now != NO_CONNECTION ; now = now->next ) { /* Works even if not linked, since won't match and will just fall through */ if ( now->next == conn ) { now->next = conn->next ; --Inbound_Control.active ; break ; } } } /* Now free up thread-sync resources */ if ( conn->next != NO_CONNECTION ) { /* Only if actually linked in and possibly active */ _MUTEX_DESTROY(conn->bus_mutex); _MUTEX_DESTROY(conn->dev_mutex); SAFETDESTROY( conn->dev_db, owfree_func); } /* Close master-specific resources */ BUS_close(conn) ; /* Next free up internal resources */ COM_free( conn ) ; /* Finally delete the structure */ owfree(conn); conn = NO_CONNECTION ; } owfs-2.8p15/module/owlib/src/c/ow_ds9097.c0000664000175000017500000001553211605332071015040 00000000000000/* $Id: ow_ds9097.c,v 1.116 2011/07/07 13:27:21 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* All the rest of the program sees is the DS9907_detect and the entry in iroutines */ static RESET_TYPE DS9097_reset(const struct parsedname *pn); static RESET_TYPE DS9097_reset_in( struct connection_in * in ); static GOOD_OR_BAD DS9097_pre_reset(struct connection_in *in ) ; static void DS9097_post_reset(struct connection_in *in ) ; static GOOD_OR_BAD DS9097_sendback_bits(const BYTE * outbits, BYTE * inbits, const size_t length, const struct parsedname *pn); static void DS9097_setroutines(struct connection_in *in); static GOOD_OR_BAD DS9097_send_and_get(const BYTE * bussend, BYTE * busget, const size_t length, struct connection_in *in); #define OneBit 0xFF //#define ZeroBit 0xC0 // Should be all zero's when we send 8 bits. digitemp write 0xFF or 0x00 #define ZeroBit 0x00 // at slower speed of course #define RESET_BYTE 0xF0 /* Device-specific functions */ static void DS9097_setroutines(struct connection_in *in) { in->iroutines.detect = DS9097_detect; in->iroutines.reset = DS9097_reset; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_bits = DS9097_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = COM_close; in->iroutines.flags = ADAP_FLAG_default; in->bundling_length = UART_FIFO_SIZE / 10; } /* _detect is a bit of a misnomer, no detection is actually done */ // no bus locking here (higher up) GOOD_OR_BAD DS9097_detect(struct connection_in *in) { /* Set up low-level routines */ DS9097_setroutines(in); in->Adapter = adapter_DS9097; // in->adapter_name already set, to support HA3 and HA4B in->busmode = bus_passive; // in case initially tried DS9097U /* open the COM port in 9600 Baud */ COM_set_standard( in ) ; // standard COM port settings SOC(in)->vmin = 1; // minimum chars SOC(in)->vtime = 0; // decisec wait RETURN_BAD_IF_BAD(COM_open(in)) ; SOC(in)->flow = flow_first; // flow control switch( DS9097_reset_in(in) ) { case BUS_RESET_OK: case BUS_RESET_SHORT: return gbGOOD ; default: break ; } /* open the COM port in 9600 Baud */ /* Second pass */ SOC(in)->flow = flow_second ; RETURN_BAD_IF_BAD(COM_change(in)) ; switch( DS9097_reset_in(in) ) { case BUS_RESET_OK: case BUS_RESET_SHORT: return gbGOOD ; default: break ; } /* open the COM port in 9600 Baud */ /* Third pass, hardware flow control */ SOC(in)->flow = flow_first ; RETURN_BAD_IF_BAD(COM_change(in)) ; switch( DS9097_reset_in(in) ) { case BUS_RESET_OK: case BUS_RESET_SHORT: return gbGOOD ; default: break ; } return gbBAD ; } /* DS9097 Reset -- A little different from DS2480B */ /* Puts in 9600 baud, sends 11110000 then reads response */ static RESET_TYPE DS9097_reset(const struct parsedname *pn) { return DS9097_reset_in( pn->selected_connection ) ; } /* DS9097 Reset -- A little different from DS2480B */ /* Puts in 9600 baud, sends 11110000 then reads response */ static RESET_TYPE DS9097_reset_in( struct connection_in * in ) { BYTE resetbyte = RESET_BYTE; BYTE responsebyte; if ( BAD( DS9097_pre_reset( in ) ) ) { return BUS_RESET_ERROR ; } if ( BAD( DS9097_send_and_get(&resetbyte, &responsebyte, 1, in )) ) { DS9097_post_reset( in) ; return BUS_RESET_ERROR ; } DS9097_post_reset(in) ; switch (responsebyte) { case 0x00: return BUS_RESET_SHORT; case RESET_BYTE: // no presence in->AnyDevices = anydevices_no ; return BUS_RESET_OK; default: in->AnyDevices = anydevices_yes ; return BUS_RESET_OK; } } /* Puts in 9600 baud */ static GOOD_OR_BAD DS9097_pre_reset(struct connection_in *in ) { RETURN_BAD_IF_BAD( COM_test(in) ) ; /* 8 data bits */ SOC(in)->bits = 8 ; SOC(in)->baud = B9600 ; if ( BAD( COM_change(in)) ) { ERROR_CONNECT("Cannot set attributes: %s", SAFESTRING(SOC(in)->devicename)); DS9097_post_reset( in ) ; return gbBAD; } return gbGOOD; } /* Restore terminal settings (serial port settings) */ static void DS9097_post_reset(struct connection_in *in ) { if (Globals.eightbit_serial) { /* coninue with 8 data bits */ SOC(in)->bits = 8; } else { /* 6 data bits, Receiver enabled, Hangup, Dont change "owner" */ SOC(in)->bits = 6; } #ifndef B115200 /* MacOSX support max 38400 in termios.h ? */ SOC(in)->baud = B38400 ; #else SOC(in)->baud = B115200 ; #endif /* Flush the input and output buffers */ COM_flush(in); // Adds no appreciable time COM_change(in) ; } /* Symmetric */ /* send bits -- read bits */ /* Actually uses bit zero of each byte */ /* So each "byte" has already been expanded to 1 bit/byte */ /* Dispatches DS9097_MAX_BITS "bits" at a time */ #define DS9097_MAX_BITS 24 static GOOD_OR_BAD DS9097_sendback_bits(const BYTE * outbits, BYTE * inbits, const size_t length, const struct parsedname *pn) { BYTE local_data[DS9097_MAX_BITS]; size_t global_counter ; size_t local_counter ; size_t offset ; struct connection_in * in = pn->selected_connection ; /* Split into smaller packets? */ for ( local_counter = global_counter = offset = 0 ; offset < length ; ) { // encode this bit local_data[local_counter] = outbits[global_counter] ? OneBit : ZeroBit; // point to next one ++local_counter ; ++global_counter ; // test if enough bits to send to master if (local_counter == DS9097_MAX_BITS || global_counter == length) { /* Communication with DS9097 routine */ /* Up to DS9097_MAX_BITS bits at a time */ if ( BAD( DS9097_send_and_get( local_data, &inbits[offset], local_counter, in )) ) { STAT_ADD1_BUS(e_bus_errors, in); return gbBAD; } offset += local_counter ; local_counter = 0 ; } } /* Decode Bits */ for (global_counter = 0; global_counter < length; ++global_counter) { inbits[global_counter] &= 0x01; // mask out all but lowest bit } return gbGOOD; } /* Routine to send a string of bits and get another string back */ static GOOD_OR_BAD DS9097_send_and_get(const BYTE * bussend, BYTE * busget, const size_t length, struct connection_in * in) { switch( SOC(in)->type ) { case ct_telnet: RETURN_BAD_IF_BAD( telnet_write_binary( bussend, length, in) ) ; break ; case ct_serial: default: RETURN_BAD_IF_BAD( COM_write( bussend, length, in ) ) ; break ; } /* get back string -- with timeout and partial read loop */ return COM_read( busget, length, in ) ; } owfs-2.8p15/module/owlib/src/c/getopt.c0000664000175000017500000005564611026222110014675 00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * Modified for uClibc by Manuel Novoa III on 1/5/01. * Modified once again for uClibc by Erik Andersen 8/7/02 */ #include #include "owfs_config.h" #include "compat_getopt.h" #include "ow.h" // only for UINT #ifndef HAVE_GETOPT_LONG #include #include #include #include #undef _ #define _(X) X /* Treat '-W foo' the same as the long option '--foo', * disabled for the moment since it costs about 2k... */ #undef SPECIAL_TREATMENT_FOR_W /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ extern int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only); /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ static int __getopt_initialized; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; # include # define my_index strchr /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char *_getopt_initialize(int argc, char *const *argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv("POSIXLY_CORRECT") != NULL) { ordering = REQUIRE_ORDER; } else { ordering = PERMUTE; } return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { int print_errors = opterr; if (optstring[0] == ':') { print_errors = 0; } if (argc < 1) { return -1; } optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) { optind = 1; /* Don't scan ARGV[0], the program name. */ } optstring = _getopt_initialize(argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) { last_nonopt = optind; } if (first_nonopt > optind) { first_nonopt = optind; } if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) { exchange((char **) argv); } else if (last_nonopt != optind) { first_nonopt = optind; } /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) { optind++; } last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp(argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) { exchange((char **) argv); } else if (first_nonopt == last_nonopt) { first_nonopt = optind; } last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) { optind = first_nonopt; } return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) { return -1; } optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind] [1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == (UINT) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) { optarg = nameend + 1; } else { if (print_errors) { if (argv[optind - 1][1] == '-') { /* --option */ fprintf(stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); } else { /* +option or -option */ fprintf(stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } } nextchar += strlen(nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) { optarg = argv[optind++]; } else { if (print_errors) { fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) { *longind = option_index; } if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) { if (print_errors) { if (argv[optind][1] == '-') { /* --option */ fprintf(stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); } else { /* +option or -option */ fprintf(stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index(optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') { ++optind; } if (temp == NULL || c == ':') { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: illegal option -- %c\n"), argv[0], c); } optopt = c; return '?'; } #ifdef SPECIAL_TREATMENT_FOR_W /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') { c = ':'; } else { c = '?'; } return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((UINT) (nameend - nextchar) == strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) { optarg = nameend + 1; } else { if (print_errors) { fprintf(stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); } nextchar += strlen(nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) { optarg = argv[optind++]; } else { if (print_errors) { fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) { *longind = option_index; } if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } #endif if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') { c = ':'; } else { c = '?'; } } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal(argc, argv, options, long_options, opt_index, 1); } #endif /* HAVE_GETOPT_LONG */ #ifndef HAVE_GETOPT int getopt(int argc, char *const *argv, const char *optstring) { return _getopt_internal(argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* HAVE_GETOPT */ owfs-2.8p15/module/owlib/src/c/ow_bae.c0000644000175000017500000023613211756315500014634 00000000000000/* $Id: ow_bae.c,v 1.71 2012/05/20 20:35:52 pascalbaerten Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Pascal Baerten's BAE 910 device -- functional */ /* Pascal Baerten's BAE 911 device -- preliminary */ #include #include "owfs_config.h" #include "ow_bae.h" /* ------- Prototypes ----------- */ /* BAE */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); //READ_FUNCTION(FS_r_flash); WRITE_FUNCTION(FS_w_flash); WRITE_FUNCTION(FS_w_extended); //WRITE_FUNCTION(FS_writebyte); WRITE_FUNCTION(FS_w_iic); WRITE_FUNCTION(FS_r_iic); WRITE_FUNCTION(FS_w_seq_text); WRITE_FUNCTION(FS_w_sector_nr); READ_FUNCTION(FS_r_sector_nr); WRITE_FUNCTION(FS_w_sector_data); READ_FUNCTION(FS_r_sector_data); READ_FUNCTION(FS_version_state) ; READ_FUNCTION(FS_version) ; READ_FUNCTION(FS_version_device) ; READ_FUNCTION(FS_version_bootstrap) ; READ_FUNCTION(FS_type_state) ; READ_FUNCTION(FS_localtype) ; READ_FUNCTION(FS_type_device) ; READ_FUNCTION(FS_type_chip) ; WRITE_FUNCTION(FS_eeprom_erase); READ_FUNCTION(FS_eeprom_r_page); WRITE_FUNCTION(FS_eeprom_w_page); READ_FUNCTION(FS_eeprom_r_mem); WRITE_FUNCTION(FS_eeprom_w_mem); READ_FUNCTION(FS_r_8_ext) ; WRITE_FUNCTION(FS_w_8_ext) ; READ_FUNCTION(FS_r_8) ; WRITE_FUNCTION(FS_w_8) ; READ_FUNCTION(FS_r_16) ; WRITE_FUNCTION(FS_w_16) ; READ_FUNCTION(FS_r_32) ; WRITE_FUNCTION(FS_w_32) ; /* ------- Structures ----------- */ /* common values to all FC chips */ #define _FC_EEPROM_PAGE_SIZE 512 #define _FC_SDCARD_SECTOR_SIZE 512 #define _FC_MAX_EEPROM_PAGES 32 #define _FC_EEPROM_OFFSET 0x0000 //changed adressing scheme, valid from 0911 models #define _FC_MAX_FLASH_SIZE 0x4000 #define _FC_MAX_INTERLEAVE 255 #define _FC02_MEMORY_SIZE 128 #define _FC02_EEPROM_OFFSET 0xE000 #define _FC02_EEPROM_PAGES 2 #define _FC03_EEPROM_PAGES 8 #define _FC02_MAX_WRITE_GULP 32 #define _FC02_MAX_READ_GULP 32 #define _FC02_MAX_COMMAND_GULP 255 /* BAE registers -- memory mapped */ #define _FC02_ADC 50 /* u8 */ #define _FC02_ADC10 62 /* u16 */ #define _FC02_ADCAN 24 /* u16 */ #define _FC02_ADCAP 22 /* u16 */ #define _FC02_ADCC 2 /* u8 */ #define _FC02_ADCTOTN 36 /* u32 */ #define _FC02_ADCTOTP 32 /* u32 */ #define _FC02_ALAN 66 /* u16 */ #define _FC02_ALAP 64 /* u16 */ #define _FC02_ALARM 52 /* u8 */ #define _FC02_ALARMC 6 /* u8 */ #define _FC02_ALCPS 68 /* u16 */ #define _FC02_ALCT 70 /* u32 */ #define _FC02_ALRT 74 /* u32 */ #define _FC02_CNT 51 /* u8 */ #define _FC02_CNTC 3 /* u8 */ #define _FC02_COUNT 44 /* u32 */ #define _FC02_CPS 30 /* u16 */ #define _FC02_DUTY1 14 /* u16 */ #define _FC02_DUTY2 16 /* u16 */ #define _FC02_DUTY3 18 /* u16 */ #define _FC02_DUTY4 20 /* u16 */ #define _FC02_MAXAN 28 /* u16 */ #define _FC02_MAXAP 26 /* u16 */ #define _FC02_MAXCPS 94 /* u16 */ #define _FC02_OUT 48 /* u8 */ #define _FC02_OUTC 4 /* u8 */ #define _FC02_OVRUNCNT 92 /* u16 */ #define _FC02_PC0 54 /* u16 */ #define _FC02_PC1 56 /* u16 */ #define _FC02_PC2 58 /* u16 */ #define _FC02_PC3 60 /* u16 */ #define _FC02_PERIOD1 10 /* u16 */ #define _FC02_PERIOD2 12 /* u16 */ #define _FC02_PIO 49 /* u8 */ #define _FC02_PIOC 5 /* u8 */ #define _FC02_RESETCNT 86 /* u16 */ #define _FC02_RTC 40 /* u32 */ #define _FC02_RTCC 7 /* u8 */ #define _FC02_SELECTCNT 88 /* u16 */ #define _FC02_STALLEDCNT 90 /* u16 */ #define _FC02_TPM1C 8 /* u8 */ #define _FC02_TPM2C 9 /* u8 */ #define _FC02_USERA 96 /* u8 */ #define _FC02_USERB 97 /* u8 */ #define _FC02_USERC 98 /* u8 */ #define _FC02_USERD 99 /* u8 */ #define _FC02_USERE 100 /* u8 */ #define _FC02_USERF 101 /* u8 */ #define _FC02_USERG 102 /* u8 */ #define _FC02_USERH 103 /* u8 */ #define _FC02_USERI 104 /* u16 */ #define _FC02_USERJ 106 /* u16 */ #define _FC02_USERK 108 /* u16 */ #define _FC02_USERL 110 /* u16 */ #define _FC02_USERM 112 /* u32 */ #define _FC02_USERN 116 /* u32 */ #define _FC02_USERO 120 /* u32 */ #define _FC02_USERP 124 /* u32 */ #define _FC03_IICC 0x7E00 /* u8 */ #define _FC03_LCDC 0x7E01 /* u8 */ #define _FC03_SDC 0x7E04 /* u8 */ #define _FC03_SPIC 0x7E05 /* u16 */ #define _FC03_PC0 0x7E07 /* u16 */ #define _FC03_CLATCH 0x7E09 /* u8 */ #define _FC03_SCIC 0x7E0A /* u8 */ #define _FC03_SEQW_LCDD 0x00 #define _FC03_SEQW_SD 0x02 #define _FC03_SEQW_IIC 0x03 #define _FC03_SEQW_SCI 0x04 #define _FC03_SEQR_SD 0x00 #define _FC03_SEQR_IIC 0x01 #define _FC03_SEQR_SCI 0x02 #define _FC03_WR_BEGIN_IIC 0x00 #define _FC03_WR_END_IIC 0x01 #define _FC03_WR_BEGIN_SD_W 0x02 #define _FC03_WR_END_SD_W 0x03 #define _FC03_WR_BEGIN_SD_R 0x04 #define _FC03_WR_END_SD_R 0x05 #define _FC03_ADC0 0x7F00 /* u16 */ #define _FC03_ADC1 0x7F02 /* u16 */ #define _FC03_ADC2 0x7F04 /* u16 */ #define _FC03_ADC3 0x7F06 /* u16 */ #define _FC03_ADC4 0x7F08 /* u16 */ #define _FC03_ADC5 0x7F0A /* u16 */ #define _FC03_ADC6 0x7F0C /* u16 */ #define _FC03_ADC7 0x7F0E /* u16 */ #define _FC03_ADC8 0x7F10 /* u16 */ #define _FC03_ADC9 0x7F12 /* u16 */ #define _FC03_ADC10 0x7F14 /* u16 */ #define _FC03_ADC11 0x7F16 /* u16 */ #define _FC03_ADC12 0x7F18 /* u16 */ #define _FC03_ADC13 0x7F1A /* u16 */ #define _FC03_ADC14 0x7F1C /* u16 */ #define _FC03_ADC15 0x7F1E /* u16 */ #define _FC03_COUNT0 0x7F20 /* u32 */ #define _FC03_COUNT1 0x7F24 /* u32 */ #define _FC03_COUNT2 0x7F28 /* u32 */ #define _FC03_COUNT3 0x7F2C /* u32 */ #define _FC03_COUNT4 0x7F30 /* u32 */ #define _FC03_COUNT5 0x7F34 /* u32 */ #define _FC03_COUNT6 0x7F38 /* u32 */ #define _FC03_COUNT7 0x7F3C /* u32 */ #define _FC03_COUNT8 0x7F40 /* u32 */ #define _FC03_COUNT9 0x7F44 /* u32 */ #define _FC03_COUNT10 0x7F48 /* u32 */ #define _FC03_COUNT11 0x7F4C /* u32 */ #define _FC03_COUNT12 0x7F50 /* u32 */ #define _FC03_COUNT13 0x7F54 /* u32 */ #define _FC03_COUNT14 0x7F58 /* u32 */ #define _FC03_COUNT15 0x7F5C /* u32 */ #define _FC03_COUNT16 0x7F60 /* u32 */ #define _FC03_COUNT17 0x7F64 /* u32 */ #define _FC03_COUNT18 0x7F68 /* u32 */ #define _FC03_COUNT19 0x7F6C /* u32 */ #define _FC03_COUNT20 0x7F70 /* u32 */ #define _FC03_COUNT21 0x7F74 /* u32 */ #define _FC03_EALARMC 0x7F78 /* u8 */ #define _FC03_OWIDLETIME 0x7F79 /* u8 */ #define _FC03_RTCH 0x7F7A /* u32 */ #define _FC03_RTCL 0x7F7E /* u8 */ #define _FC03_TIMER1 0x7F7F /* u16 */ #define _FC03_TIMER2 0x7F81 /* u16 */ #define _FC03_UALARM 0x7F83 /* u32 */ #define _FC03_UALARM_EN 0x7F87 /* u32 */ #define _FC03_USER_ARRAY 0x7F8B /* u256 */ #define _FC03_USER_BYTES 0x7FAB /* u128 */ #define _FC03_USER_WORDS 0x7FBB /* u256 */ #define _FC03_USER_DW 0x7FDB /* u256 */ #define _FC03_PIO0 0x7900 /* u8 */ #define _FC03_PIO1 0x7901 /* u8 */ #define _FC03_PIO2 0x7902 /* u8 */ #define _FC03_PIO3 0x7903 /* u8 */ #define _FC03_PIO4 0x7904 /* u8 */ #define _FC03_PIO5 0x7905 /* u8 */ #define _FC03_PIO6 0x7906 /* u8 */ #define _FC03_PIO7 0x7907 /* u8 */ #define _FC03_PIO8 0x7908 /* u8 */ #define _FC03_PIO9 0x7909 /* u8 */ #define _FC03_PIO10 0x790A /* u8 */ #define _FC03_PIO11 0x790B /* u8 */ #define _FC03_PIO12 0x790C /* u8 */ #define _FC03_PIO13 0x790D /* u8 */ #define _FC03_PIO14 0x790E /* u8 */ #define _FC03_PIO15 0x790F /* u8 */ #define _FC03_PIO16 0x7910 /* u8 */ #define _FC03_PIO17 0x7911 /* u8 */ #define _FC03_PIO18 0x7912 /* u8 */ #define _FC03_PIO19 0x7913 /* u8 */ #define _FC03_PIO20 0x7914 /* u8 */ #define _FC03_PIO21 0x7915 /* u8 */ #define _FC03_PIODIR0 0x7916 /* u8 */ #define _FC03_PIODIR1 0x7917 /* u8 */ #define _FC03_PIODIR2 0x7918 /* u8 */ #define _FC03_PIODIR3 0x7919 /* u8 */ #define _FC03_PIODIR4 0x791A /* u8 */ #define _FC03_PIODIR5 0x791B /* u8 */ #define _FC03_PIODIR6 0x791C /* u8 */ #define _FC03_PIODIR7 0x791D /* u8 */ #define _FC03_PIODIR8 0x791E /* u8 */ #define _FC03_PIODIR9 0x791F /* u8 */ #define _FC03_PIODIR10 0x7920 /* u8 */ #define _FC03_PIODIR11 0x7921 /* u8 */ #define _FC03_PIODIR12 0x7922 /* u8 */ #define _FC03_PIODIR13 0x7923 /* u8 */ #define _FC03_PIODIR14 0x7924 /* u8 */ #define _FC03_PIODIR15 0x7925 /* u8 */ #define _FC03_PIODIR16 0x7926 /* u8 */ #define _FC03_PIODIR17 0x7927 /* u8 */ #define _FC03_PIODIR18 0x7928 /* u8 */ #define _FC03_PIODIR19 0x7929 /* u8 */ #define _FC03_PIODIR20 0x792A /* u8 */ #define _FC03_PIODIR21 0x792B /* u8 */ #define _FC03_PIODS0 0x792C /* u8 */ #define _FC03_PIODS1 0x792D /* u8 */ #define _FC03_PIODS2 0x792E /* u8 */ #define _FC03_PIODS3 0x792F /* u8 */ #define _FC03_PIODS4 0x7930 /* u8 */ #define _FC03_PIODS5 0x7931 /* u8 */ #define _FC03_PIODS6 0x7932 /* u8 */ #define _FC03_PIODS7 0x7933 /* u8 */ #define _FC03_PIODS8 0x7934 /* u8 */ #define _FC03_PIODS9 0x7935 /* u8 */ #define _FC03_PIODS10 0x7936 /* u8 */ #define _FC03_PIODS11 0x7937 /* u8 */ #define _FC03_PIODS12 0x7938 /* u8 */ #define _FC03_PIODS13 0x7939 /* u8 */ #define _FC03_PIODS14 0x793A /* u8 */ #define _FC03_PIODS15 0x793B /* u8 */ #define _FC03_PIODS16 0x793C /* u8 */ #define _FC03_PIODS17 0x793D /* u8 */ #define _FC03_PIODS18 0x793E /* u8 */ #define _FC03_PIODS19 0x793F /* u8 */ #define _FC03_PIODS20 0x7940 /* u8 */ #define _FC03_PIODS21 0x7941 /* u8 */ #define _FC03_PIOPE0 0x7942 /* u8 */ #define _FC03_PIOPE1 0x7943 /* u8 */ #define _FC03_PIOPE2 0x7944 /* u8 */ #define _FC03_PIOPE3 0x7945 /* u8 */ #define _FC03_PIOPE4 0x7946 /* u8 */ #define _FC03_PIOPE5 0x7947 /* u8 */ #define _FC03_PIOPE6 0x7948 /* u8 */ #define _FC03_PIOPE7 0x7949 /* u8 */ #define _FC03_PIOPE8 0x794A /* u8 */ #define _FC03_PIOPE9 0x794B /* u8 */ #define _FC03_PIOPE10 0x794C /* u8 */ #define _FC03_PIOPE11 0x794D /* u8 */ #define _FC03_PIOPE12 0x794E /* u8 */ #define _FC03_PIOPE13 0x794F /* u8 */ #define _FC03_PIOPE14 0x7950 /* u8 */ #define _FC03_PIOPE15 0x7951 /* u8 */ #define _FC03_PIOPE16 0x7952 /* u8 */ #define _FC03_PIOPE17 0x7953 /* u8 */ #define _FC03_PIOPE18 0x7954 /* u8 */ #define _FC03_PIOPE19 0x7955 /* u8 */ #define _FC03_PIOPE20 0x7956 /* u8 */ #define _FC03_PIOPE21 0x7957 /* u8 */ #define _FC03_LATCH0 0x7958 /* u8 */ #define _FC03_LATCH1 0x7959 /* u8 */ #define _FC03_LATCH2 0x795A /* u8 */ #define _FC03_LATCH3 0x795B /* u8 */ #define _FC03_LATCH4 0x795C /* u8 */ #define _FC03_LATCH5 0x795D /* u8 */ #define _FC03_LATCH6 0x795E /* u8 */ #define _FC03_LATCH7 0x795F /* u8 */ #define _FC03_LATCH8 0x7960 /* u8 */ #define _FC03_LATCH9 0x7961 /* u8 */ #define _FC03_LATCH10 0x7962 /* u8 */ #define _FC03_LATCH11 0x7963 /* u8 */ #define _FC03_LATCH12 0x7964 /* u8 */ #define _FC03_LATCH13 0x7965 /* u8 */ #define _FC03_LATCH14 0x7966 /* u8 */ #define _FC03_LATCH15 0x7967 /* u8 */ #define _FC03_LATCH16 0x7968 /* u8 */ #define _FC03_LATCH17 0x7969 /* u8 */ #define _FC03_LATCH18 0x796A /* u8 */ #define _FC03_LATCH19 0x796B /* u8 */ #define _FC03_LATCH20 0x796C /* u8 */ #define _FC03_LATCH21 0x796D /* u8 */ #define _FC03_ECOUNT0 0x796E /* u8 */ #define _FC03_ECOUNT1 0x796F /* u8 */ #define _FC03_ECOUNT2 0x7970 /* u8 */ #define _FC03_ECOUNT3 0x7971 /* u8 */ #define _FC03_ECOUNT4 0x7972 /* u8 */ #define _FC03_ECOUNT5 0x7973 /* u8 */ #define _FC03_ECOUNT6 0x7974 /* u8 */ #define _FC03_ECOUNT7 0x7975 /* u8 */ #define _FC03_ECOUNT8 0x7976 /* u8 */ #define _FC03_ECOUNT9 0x7977 /* u8 */ #define _FC03_ECOUNT10 0x7978 /* u8 */ #define _FC03_ECOUNT11 0x7979 /* u8 */ #define _FC03_ECOUNT12 0x797A /* u8 */ #define _FC03_ECOUNT13 0x797B /* u8 */ #define _FC03_ECOUNT14 0x797C /* u8 */ #define _FC03_ECOUNT15 0x797D /* u8 */ #define _FC03_ECOUNT16 0x797E /* u8 */ #define _FC03_ECOUNT17 0x797F /* u8 */ #define _FC03_ECOUNT18 0x7980 /* u8 */ #define _FC03_ECOUNT19 0x7981 /* u8 */ #define _FC03_ECOUNT20 0x7982 /* u8 */ #define _FC03_ECOUNT21 0x7983 /* u8 */ #define _FC03_ALARM0 0x7984 /* u8 */ #define _FC03_ALARM1 0x7985 /* u8 */ #define _FC03_ALARM2 0x7986 /* u8 */ #define _FC03_ALARM3 0x7987 /* u8 */ #define _FC03_ALARM4 0x7988 /* u8 */ #define _FC03_ALARM5 0x7989 /* u8 */ #define _FC03_ALARM6 0x798A /* u8 */ #define _FC03_ALARM7 0x798B /* u8 */ #define _FC03_ALARM8 0x798C /* u8 */ #define _FC03_ALARM9 0x798D /* u8 */ #define _FC03_ALARM10 0x798E /* u8 */ #define _FC03_ALARM11 0x798F /* u8 */ #define _FC03_ALARM12 0x7990 /* u8 */ #define _FC03_ALARM13 0x7991 /* u8 */ #define _FC03_ALARM14 0x7992 /* u8 */ #define _FC03_ALARM15 0x7993 /* u8 */ #define _FC03_ALARM16 0x7994 /* u8 */ #define _FC03_ALARM17 0x7995 /* u8 */ #define _FC03_ALARM18 0x7996 /* u8 */ #define _FC03_ALARM19 0x7997 /* u8 */ #define _FC03_ALARM20 0x7998 /* u8 */ #define _FC03_ALARM21 0x7999 /* u8 */ #define _FC03_EENCODER0 0x799A /* u8 */ #define _FC03_EENCODER5 0x799B /* u8 */ #define _FC03_EENCODER8 0x799C /* u8 */ #define _FC03_EENCODER9 0x799D /* u8 */ #define _FC03_EENCODER16 0x799E /* u8 */ #define _FC03_EENCODER17 0x799F /* u8 */ #define _FC03_PULLDOWN0 0x79A0 /* u8 */ #define _FC03_PULLDOWN1 0x79A1 /* u8 */ #define _FC03_PULLDOWN2 0x79A2 /* u8 */ #define _FC03_PULLDOWN3 0x79A3 /* u8 */ #define _FC03_PULLDOWN4 0x79A4 /* u8 */ #define _FC03_PULLDOWN5 0x79A5 /* u8 */ #define _FC03_PULLDOWN6 0x79A6 /* u8 */ #define _FC03_PULLDOWN7 0x79A7 /* u8 */ #define _FC03_CAPFLAG1 0x79A8 /* u8 */ #define _FC03_CAPFLAG2 0x79A9 /* u8 */ #define _FC03_CAPFLAG3 0x79AA /* u8 */ #define _FC03_CAPFLAG4 0x79AB /* u8 */ #define _FC03_ACMPE 0x79AC /* u8 */ #define _FC03_ACMPIS 0x79AD /* u8 */ #define _FC03_ACMPLATCH 0x79AE /* u8 */ #define _FC03_ACMPO 0x79AF /* u8 */ #define _FC03_ACMPOE 0x79B0 /* u8 */ #define _FC03_TPM1C 0x7A00 /* u8 */ #define _FC03_TPM2C 0x7A01 /* u8 */ #define _FC03_TPM1C 0x7A00 /* u8 */ #define _FC03_TPM2C 0x7A01 /* u8 */ #define _FC03_PERIOD1 0x7A02 /* u16 */ #define _FC03_PERIOD2 0x7A04 /* u16 */ #define _FC03_DUTY1C0 0x7A06 /* u16 */ #define _FC03_DUTY1C1 0x7A08 /* u16 */ #define _FC03_DUTY2C0 0x7A0A /* u16 */ #define _FC03_DUTY2C1 0x7A0C /* u16 */ #define _FC03_C1CH0 0x7A0E /* u8 */ #define _FC03_C1CH1 0x7A0F /* u8 */ #define _FC03_C2CH0 0x7A10 /* u8 */ #define _FC03_C2CH1 0x7A11 /* u8 */ #define _FC03_NBYTES 0x7A12 /* u8 */ #define _FC03_BAUDDIV 0x7A13 /* u16 */ #define _FC03_GLOBAL_MEM 0x7C00 /* u8[64]*/ /* Placeholder for special vsibility code for firmware types "personalities" */ static enum e_visibility VISIBLE_eeprom_pages( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_eeprom_bytes( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_generic( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_910( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_911( const struct parsedname * pn ) ; static struct aggregate ABAEeeprom = { _FC_MAX_EEPROM_PAGES, ag_numbers, ag_separate, }; static struct aggregate A911pio = { 22, ag_numbers, ag_separate, }; static struct aggregate A911piodd = { 22, ag_numbers, ag_separate, }; static struct aggregate A911piods = { 22, ag_numbers, ag_separate, }; static struct aggregate A911piope = { 22, ag_numbers, ag_separate, }; static struct aggregate A911piopd = { 8, ag_numbers, ag_separate, }; static struct aggregate A911latch = { 22, ag_numbers, ag_separate, }; static struct aggregate A911elatch = { 22, ag_numbers, ag_separate, }; static struct aggregate A911counter = { 18, ag_numbers, ag_separate, }; static struct aggregate A911ecount = { 18, ag_numbers, ag_separate, }; static struct aggregate A911adc = { 16, ag_numbers, ag_separate, }; static struct aggregate A911userb = { 16, ag_numbers, ag_separate, }; static struct aggregate A911userw = { 16, ag_numbers, ag_separate, }; static struct aggregate A911userdw = { 8, ag_numbers, ag_separate, }; static struct aggregate A911userarray = { 32, ag_numbers, ag_separate, }; static struct aggregate A911globalmem = { 64, ag_numbers, ag_separate, }; static struct aggregate A911globalmemory = { 0, ag_numbers, ag_sparse, }; static struct filetype BAE[] = { F_STANDARD, {"command", _FC02_MAX_COMMAND_GULP, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_extended, VISIBLE, NO_FILETYPE_DATA, }, //{"writebyte", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, NO_READ_FUNCTION, FS_writebyte, VISIBLE, NO_FILETYPE_DATA, }, {"versionstate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_version_state, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"version", 5, NON_AGGREGATE, ft_ascii, fc_link, FS_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device_version", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_version_device, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"bootstrap_version", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_version_bootstrap, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"typestate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_type_state, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"localtype", 5, NON_AGGREGATE, ft_ascii, fc_link, FS_localtype, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device_type", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_type_device, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"chip_type", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_type_chip, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"firmware", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"firmware/function", _FC_MAX_FLASH_SIZE, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_flash, VISIBLE, NO_FILETYPE_DATA, }, {"eeprom", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, // {"eeprom/memory",_FC_EEPROM_PAGE_SIZE*_FC_MAX_EEPROM_PAGES, NON_AGGREGATE, ft_binary, fc_link, FS_eeprom_r_mem, FS_eeprom_w_mem, VISIBLE_eeprom_bytes, NO_FILETYPE_DATA, }, {"eeprom/page",_FC_EEPROM_PAGE_SIZE, &ABAEeeprom, ft_binary, fc_page, FS_eeprom_r_page, FS_eeprom_w_page, VISIBLE_eeprom_pages, NO_FILETYPE_DATA, }, {"eeprom/erase", PROPERTY_LENGTH_YESNO, &ABAEeeprom, ft_yesno, fc_link, NO_READ_FUNCTION, FS_eeprom_erase, VISIBLE_eeprom_pages, NO_FILETYPE_DATA, }, {"generic", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_generic, NO_FILETYPE_DATA, }, {"generic/memory", _FC02_MEMORY_SIZE, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE_generic, NO_FILETYPE_DATA, }, {"910", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_910, NO_FILETYPE_DATA, }, {"910/adcc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_ADCC,}, }, {"910/cntc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_CNTC,}, }, {"910/outc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_OUTC,}, }, {"910/pioc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_PIOC,}, }, {"910/alarmc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_ALARMC,}, }, {"910/rtcc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_RTCC,}, }, {"910/tpm1c", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_TPM1C,}, }, {"910/tpm2c", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_TPM2C,}, }, {"910/period1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PERIOD1,}, }, {"910/period2", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PERIOD2,}, }, {"910/duty1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_DUTY1,}, }, {"910/duty2", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_DUTY2,}, }, {"910/duty3", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_DUTY3,}, }, {"910/duty4", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_DUTY4,}, }, {"910/alap", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_ALAP,}, }, {"910/alan", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_ALAN,}, }, {"910/cps", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_CPS,}, }, {"910/alcps", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_ALCPS,}, }, {"910/alct", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_ALCT,}, }, {"910/adcap", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_ADCAP,}, }, {"910/adcan", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_ADCAN,}, }, {"910/maxap", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_MAXAP,}, }, {"910/maxan", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_MAXAN,}, }, {"910/maxcps", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_MAXCPS,}, }, {"910/adctotp", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_ADCTOTP,}, }, {"910/adctotn", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_ADCTOTN,}, }, {"910/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_RTC,}, }, {"910/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE_910, {a:"910/udate"}, }, {"910/count", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_COUNT,}, }, {"910/out", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_read_stable, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_OUT,}, }, {"910/pio", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_PIO,}, }, {"910/adc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_ADC,}, }, {"910/adc10", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_ADC10,}, }, {"910/cnt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, VISIBLE_910, {u:_FC02_CNT,}, }, {"910/alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_ALARM,}, }, {"910/ovruncnt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_OVRUNCNT,}, }, {"910/resetcnt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_RESETCNT,}, }, {"910/selectcnt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_SELECTCNT,}, }, {"910/stalledcnt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_STALLEDCNT,}, }, {"910/usera", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERA,}, }, {"910/userb", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERB,}, }, {"910/userc", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERC,}, }, {"910/userd", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERD,}, }, {"910/usere", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERE,}, }, {"910/userf", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERF,}, }, {"910/userg", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERG,}, }, {"910/userh", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_910, {u:_FC02_USERH,}, }, {"910/useri", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_USERI,}, }, {"910/userj", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_USERJ,}, }, {"910/userk", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_USERK,}, }, {"910/userl", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_USERL,}, }, {"910/userm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_USERM,}, }, {"910/usern", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_USERN,}, }, {"910/usero", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_USERO,}, }, {"910/userp", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_910, {u:_FC02_USERP,}, }, {"910/pc0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PC0,}, }, {"910/pc1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PC1,}, }, {"910/pc2", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PC2,}, }, {"910/pc3", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_910, {u:_FC02_PC3,}, }, {"911", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/automation_engine", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/automation_engine/pc0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_PC0,}, }, {"911/automation_engine/global_mem", PROPERTY_LENGTH_UNSIGNED, &A911globalmem, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_GLOBAL_MEM,}, }, {"911/automation_engine/global_memory", PROPERTY_LENGTH_UNSIGNED, &A911globalmemory, ft_unsigned, fc_volatile, FS_r_8_ext, FS_w_8_ext, VISIBLE_911, {v:(int[2]){_FC03_GLOBAL_MEM, 64,},}, }, {"911/pio", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA,}, {"911/pio/pio", PROPERTY_LENGTH_YESNO, &A911pio , ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_PIO0,}, }, {"911/pio/direction", PROPERTY_LENGTH_YESNO, &A911piodd, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_PIODIR0,}, }, {"911/pio/strenght", PROPERTY_LENGTH_YESNO, &A911piods, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_PIODS0,}, }, {"911/pio/pull_enable", PROPERTY_LENGTH_YESNO, &A911piope, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_PIOPE0,}, }, {"911/pio/pull_down", PROPERTY_LENGTH_YESNO, &A911piopd, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_PULLDOWN0,}, }, {"911/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/alarm/latch", PROPERTY_LENGTH_YESNO, &A911latch, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_LATCH0,}, }, {"911/alarm/enable_latch", PROPERTY_LENGTH_YESNO, &A911elatch, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ALARM0,}, }, {"911/alarm/clear_latchs", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_CLATCH,}, }, {"911/alarm/enable_global", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EALARMC,}, }, {"911/alarm/userbits", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_UALARM,}, }, {"911/alarm/userbits_enable", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_UALARM_EN,}, }, {"911/counters", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/counters/count", PROPERTY_LENGTH_UNSIGNED, &A911counter, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_COUNT0,}, }, {"911/counters/enable_counter", PROPERTY_LENGTH_YESNO, &A911ecount, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ECOUNT0,}, }, {"911/counters/enable_encoder0", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER0,}, }, {"911/counters/enable_encoder5", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER5,}, }, {"911/counters/enable_encoder8", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER8,}, }, {"911/counters/enable_encoder9", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER9,}, }, {"911/counters/enable_encoder16", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER16,}, }, {"911/counters/enable_encoder17", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_EENCODER17,}, }, {"911/timers", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/timers/countdown", PROPERTY_LENGTH_UNSIGNED, &A911userarray, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_USER_ARRAY,}, }, {"911/timers/countdown_number", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_NBYTES,}, }, {"911/timers/clock", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_RTCH,}, }, {"911/timers/random", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, VISIBLE_911, {u:_FC03_RTCL,}, }, {"911/user_registers", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/user_registers/byte", PROPERTY_LENGTH_UNSIGNED, &A911userb, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_USER_BYTES,}, }, {"911/user_registers/word", PROPERTY_LENGTH_UNSIGNED, &A911userw, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_USER_WORDS,}, }, {"911/user_registers/dword", PROPERTY_LENGTH_UNSIGNED, &A911userdw, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_USER_DW,}, }, {"911/analog", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA,}, {"911/analog/adc", PROPERTY_LENGTH_UNSIGNED, &A911adc, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, VISIBLE_911, {u:_FC03_ADC0,}, }, {"911/analog/comparator", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/analog/comparator/acmp_enable", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ACMPE,}, }, {"911/analog/comparator/out_enable", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ACMPOE,}, }, {"911/analog/comparator/out_state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, VISIBLE_911, {u:_FC03_ACMPO,}, }, {"911/analog/comparator/internal_ref", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ACMPIS,}, }, {"911/analog/comparator/changed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_ACMPLATCH,}, }, {"911/pwm1", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/pwm1/ref_clock", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_TPM1C,}, }, {"911/pwm1/period", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_PERIOD1,}, }, {"911/pwm1/mode_ch0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_C1CH0,}, }, {"911/pwm1/mode_ch1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_C1CH1,}, }, {"911/pwm1/duty_ch0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_DUTY1C0,}, }, {"911/pwm1/duty_ch1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_DUTY1C1,}, }, {"911/pwm2", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA,}, {"911/pwm2/ref_clock", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_TPM2C,}, }, {"911/pwm2/period", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_PERIOD2,}, }, {"911/pwm2/mode_ch0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_C2CH0,}, }, {"911/pwm2/mode_ch1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_C2CH1,}, }, {"911/pwm2/duty_ch0", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_DUTY2C0,}, }, {"911/pwm2/duty_ch1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_DUTY2C1,}, }, {"911/iic", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA,}, {"911/iic/init", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_IICC,}, }, {"911/iic/cat9554", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/iic/cat9554/direction", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_iic, FS_w_iic, VISIBLE_911, {a:"x40x03$0-x40x03=$0"}, }, {"911/iic/cat9554/pio", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_iic, FS_w_iic, VISIBLE_911, {a:"x40x01$0-x40x01=$0"}, }, {"911/sdcard", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/sdcard/init", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_SDC,}, }, {"911/sdcard/sector_nr", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_sector_nr, FS_w_sector_nr, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/sdcard/sector_data", _FC_SDCARD_SECTOR_SIZE, NON_AGGREGATE, ft_binary, fc_stable, FS_r_sector_data, FS_w_sector_data, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/lcd", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/lcd/init", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_LCDC,}, }, {"911/lcd/text", 255, NON_AGGREGATE, ft_ascii, fc_volatile, NO_READ_FUNCTION, FS_w_seq_text, VISIBLE_911, {u:_FC03_SEQW_LCDD,}, }, {"911/serial", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA,}, {"911/serial/baud_divisor", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_BAUDDIV,}, }, {"911/serial/scic", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_SCIC,}, }, {"911/serial/dataout", 255, NON_AGGREGATE, ft_ascii, fc_volatile, NO_READ_FUNCTION, FS_w_seq_text, VISIBLE_911, {u:_FC03_SEQW_SCI,}, }, /* {"911/pio/piostate", PROPERTY_LENGTH_UNSIGNED, &A911pio, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u:_FC03_PIO0,}, }, {"911/pio/pio", PROPERTY_LENGTH_YESNO, &A911pio, ft_yesno, fc_link, FS_r_911_pio, FS_w_911_pio, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/pio/pio_config", PROPERTY_LENGTH_UNSIGNED, &A911pioc, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u:_FC03_PIO_CONF,}, }, {"911/pio/pio_ds", PROPERTY_LENGTH_YESNO, &A911pioc, ft_yesno, fc_link, FS_r_pio_bit, FS_w_pio_bit, VISIBLE_911, {u:3,}, }, {"911/pio/pio_pe", PROPERTY_LENGTH_YESNO, &A911pioc, ft_yesno, fc_link, FS_r_pio_bit, FS_w_pio_bit, VISIBLE_911, {u:1,}, }, {"911/pio/pio_dd", PROPERTY_LENGTH_YESNO, &A911pioc, ft_yesno, fc_link, FS_r_pio_bit, FS_w_pio_bit, VISIBLE_911, {u:0,}, }, {"911/counter1", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/counter1/count", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_CNT1,}, }, {"911/counter1/config", PROPERTY_LENGTH_UNSIGNED, &A911cnt1, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u:_FC03_PIO_CONF+10,}, }, {"911/counter1/pulldown", PROPERTY_LENGTH_YESNO, &A911cnt1, ft_yesno, fc_link, FS_r_cnt1_bit, FS_w_cnt1_bit, VISIBLE_911, {u:2,}, }, {"911/counter1/enable", PROPERTY_LENGTH_YESNO, &A911cnt1, ft_yesno, fc_link, FS_r_cnt1_bit, FS_w_cnt1_bit, VISIBLE_911, {u:4,}, }, {"911/counter2", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/counter2/count", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_32, FS_w_32, VISIBLE_911, {u:_FC03_CNT2,}, }, {"911/counter2/config", PROPERTY_LENGTH_UNSIGNED, &A911cnt2, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u:_FC03_PIO_CONF+16,}, }, {"911/counter2/pulldown", PROPERTY_LENGTH_YESNO, &A911cnt2, ft_yesno, fc_link, FS_r_cnt2_bit, FS_w_cnt2_bit, VISIBLE_911, {u:2,}, }, {"911/counter2/enable", PROPERTY_LENGTH_YESNO, &A911cnt2, ft_yesno, fc_link, FS_r_cnt2_bit, FS_w_cnt2_bit, VISIBLE_911, {u:4,}, }, {"911/pwm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/pwm/tpm1c", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_TPM1C,}, }, {"911/pwm/tpm2c", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_TPM2C,}, }, {"911/pwm/period1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_PERIOD1,}, }, {"911/pwm/period2", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_PERIOD2,}, }, {"911/pwm/duty", PROPERTY_LENGTH_UNSIGNED, &A911pwm, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_DUTY,}, }, {"911/spi", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/spi/spic", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_SPIC,}, }, {"911/spi/spibr", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_SPIBR,}, }, {"911/spi/spid", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_911, {u:_FC03_SPID,}, }, {"911/serial", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_911, NO_FILETYPE_DATA, }, {"911/serial/scic", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, VISIBLE_911, {u:_FC03_SCIC,}, }, */ }; DeviceEntryExtended(FC, BAE, DEV_resume | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE ); /* path)) ; if ( BAD( GetVisibilityCache( &visibility_parameter, pn ) ) ) { struct one_wire_query * owq = OWQ_create_from_path(pn->path) ; // for read if ( owq != NULL) { UINT device_type ; if ( FS_r_sibling_U( &device_type, "device_type", owq ) == 0 ) { switch (device_type) { case 2: visibility_parameter = 910 ; SetVisibilityCache( visibility_parameter, pn ) ; break ; case 3: visibility_parameter = 911 ; SetVisibilityCache( visibility_parameter, pn ) ; break ; default: visibility_parameter = -1 ; } } OWQ_destroy(owq) ; } } return visibility_parameter ; } static enum e_visibility VISIBLE_eeprom_pages( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case -1: return visible_not_now ; case 910: //modify ABAEeeprom.elements to number of pages; pn->selected_filetype->ag->elements=_FC02_EEPROM_PAGES; return visible_now ; case 911: pn->selected_filetype->ag->elements=_FC03_EEPROM_PAGES; return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_eeprom_bytes( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case -1: return visible_not_now ; case 910: pn->selected_filetype->suglen=_FC02_EEPROM_PAGES * _FC_EEPROM_PAGE_SIZE; return visible_now ; case 911: pn->selected_filetype->suglen=_FC03_EEPROM_PAGES * _FC_EEPROM_PAGE_SIZE; return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_generic( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case -1: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_910( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case 910: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_911( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case 911: return visible_now ; default: return visible_not_now ; } } static size_t eeprom_offset( const struct parsedname * pn ) { switch ( VISIBLE_BAE(pn) ) { case 910: //future vesion of 910 will work with uniform eeprom offset return _FC02_EEPROM_OFFSET ; default: return _FC_EEPROM_OFFSET ; } } static ZERO_OR_ERROR FS_r_sector_nr(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT sector_nr; if ( BAD( Cache_Get_SlaveSpecific((void *) §or_nr, sizeof(UINT), SlaveSpecificTag(SNR), pn)) ) { // record doesn't (yet) exist sector_nr=0; } OWQ_U(owq) = sector_nr; if (Cache_Add_SlaveSpecific((void *) §or_nr, sizeof(UINT), SlaveSpecificTag(SNR), pn)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_sector_nr(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT sector_nr; sector_nr = OWQ_U(owq); FS_del_sibling( "911/sdcard/sector_data", owq ) ; if (Cache_Add_SlaveSpecific((void *) §or_nr, sizeof(UINT), SlaveSpecificTag(SNR), pn)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_sector_data(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE *buffer = (BYTE*)OWQ_buffer(owq); BYTE rparam[_FC02_MAX_WRITE_GULP+1]; BYTE wparam[4] ; UINT sector_nr; int size=(int)OWQ_size(owq); int wlen,rlen,i,retry; int timeout=100; if (BAD( Cache_Get_SlaveSpecific((void *) §or_nr, sizeof(UINT), SlaveSpecificTag(SNR), pn))) sector_nr=0; // record doesn't (yet) exist LEVEL_DEBUG("write SD sector %d data len=%d",sector_nr,size ) ; if (OWQ_offset(owq)) return -ERANGE; if (size!=512) return -ERANGE; BAE_uint32_to_bytes( sector_nr*512, wparam ); // convert 32bit value to msb first rlen=0; wlen=4; RETURN_ERROR_IF_BAD(OW_wr_complete_transaction(wlen,_FC03_WR_BEGIN_SD_W, &rlen, wparam, rparam, timeout, pn)); wlen= _FC02_MAX_WRITE_GULP; retry=0; for(i=size;i;) { if (i>_FC02_MAX_WRITE_GULP) wlen=_FC02_MAX_WRITE_GULP; else wlen=i; LEVEL_DEBUG("WRITE SD %d bytes at offset %d ",size,512-i ) ; if (BAD(OW_seqw_complete_transaction(wlen,_FC03_SEQW_SD, buffer, timeout, pn))) { if (retry++>3) return gbBAD; } else { buffer+=wlen; i-=wlen; retry=0; } } rlen=0; wlen=0; LEVEL_DEBUG("WRITE SD END, send trailer " ) ; return OW_wr_complete_transaction(wlen,_FC03_WR_END_SD_W, &rlen, wparam, rparam, timeout, pn); } static ZERO_OR_ERROR FS_r_sector_data(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE *buffer = (BYTE*)OWQ_buffer(owq); BYTE rparam[_FC02_MAX_READ_GULP+1]; BYTE wparam[4] ; UINT sector_nr; int size=(int)OWQ_size(owq); int wlen,rlen,i,retry; int timeout=100; if (BAD( Cache_Get_SlaveSpecific((void *) §or_nr, sizeof(UINT), SlaveSpecificTag(SNR), pn))) sector_nr=0; // record doesn't (yet) exist LEVEL_DEBUG("read SD sector %d data len=%d",sector_nr,size ) ; if (OWQ_offset(owq)) return -ERANGE; if (size!=512) return -ERANGE; BAE_uint32_to_bytes( sector_nr*512, wparam ); // convert 32bit value to msb first rlen=0; wlen=4; retry=0; RETURN_ERROR_IF_BAD(OW_wr_complete_transaction(wlen,_FC03_WR_BEGIN_SD_R, &rlen, wparam, rparam, timeout, pn)); rlen= _FC02_MAX_READ_GULP; for(i=size;i;) { if (i>_FC02_MAX_READ_GULP) rlen=_FC02_MAX_WRITE_GULP; else rlen=i; LEVEL_DEBUG("READ SD %d bytes at offset %d ",size,512-i ) ; if (BAD(OW_seqr_complete_transaction(&rlen,_FC03_SEQR_SD, buffer, timeout, pn))) { if (retry++>3) return gbBAD; } else { buffer+=rlen; i-=rlen; retry=0; } } OWQ_length(owq) = OWQ_size(owq); rlen=0; wlen=0; LEVEL_DEBUG("READ SD END, send trailer " ) ; return OW_wr_complete_transaction(wlen,_FC03_WR_END_SD_R, &rlen, wparam, rparam, timeout, pn); } int hex_digit(BYTE c) { int v; if ((c>='0') && (c<='9')) v=c-'0'; else if ((c>='a') && (c<='f')) v=c-'a'+10; else if ((c>='A') && (c<='F')) v=c-'A'+10; else v=-1000; return v; } GOOD_OR_BAD scan_token_read(char* mask,BYTE *buffer, struct one_wire_query *owq) { int i,j,v; char *pt=mask; LEVEL_DEBUG("begin token read loop: " ) ; OWQ_U(owq)=0; for(i=0;*pt;pt++) { v=hex_digit(*pt)*16 + hex_digit(*(pt+1)); if (v>=0) { pt+=2; if (buffer[i++]!=v) return gbBAD; //if the received byte doen not match the mask, return error } switch (*pt) { case '?': i++; // '?' in mask means to ignore this received byte case '$': if ((*(pt+1)>='0') && (*(pt+1) <='7')) //store received byte on position j { pt++; j=*pt-'0'; OWQ_U(owq)|= buffer[i++]<=0) { buffer[i++]=v;pt+=2;} switch (*pt) { case '=': *plenw=i; //write limit, after '=' this is the receive mask break; case '$': if ((*(pt+1)>='0') && (*(pt+1)<='7')) { pt++; j=*pt-'0'; LEVEL_DEBUG("token test: @%d= %d", j,BYTE_MASK(OWQ_U(owq)>>j) ) ; buffer[i++]= BYTE_MASK(OWQ_U(owq)>>j); // BYTE_MASK(OWQ_array_U(owq,j)); } break; } } if (*plenw<0) *plenw=i; *plenr=i-*plenw; buffer[i]='\0'; //just for level debug } static ZERO_OR_ERROR FS_w_iic(struct one_wire_query *owq) //generic write to iic { struct parsedname *pn = PN(owq); BYTE wparam[(_FC02_MAX_WRITE_GULP+1)*2]; BYTE *rparam; int wlen,rlen,timeout; char mask[255],*pt; rparam=wparam+_FC02_MAX_WRITE_GULP+1; if (OWQ_offset(owq)) return -ERANGE; strcpy(mask,pn->selected_filetype->data.a); pt=strchr(mask,'-'); if (pt==NULL) return -EINVAL; //invalid mask for generic iic *pt=0; //split mask write and mask read scan_token_write(mask, wparam, &wlen, &rlen, owq); timeout=100; LEVEL_DEBUG("iic write: wlen=%d mask=%s wparam=%s", wlen,mask,wparam ) ; RETURN_ERROR_IF_BAD(OW_wr_complete_transaction(wlen,_FC03_WR_BEGIN_IIC, &rlen, wparam, rparam, timeout, pn)); pt=strchr(mask,'='); if (pt) RETURN_ERROR_IF_BAD(scan_token_read(pt+1, rparam, owq)); wlen=rlen=0; return OW_wr_complete_transaction(wlen,_FC03_WR_END_IIC, &rlen, wparam, rparam, timeout, pn); } static ZERO_OR_ERROR FS_r_iic(struct one_wire_query *owq) //generic read from iic { BYTE wparam[(_FC02_MAX_WRITE_GULP+1)*2]; BYTE *rparam; int wlen, rlen, timeout; char mask[255],*pt; struct parsedname *pn = PN(owq); rparam=wparam+_FC02_MAX_WRITE_GULP+1; if (OWQ_offset(owq)) return -ERANGE; strcpy(mask,pn->selected_filetype->data.a); pt=strchr(mask,'-'); if (pt==NULL) return -EINVAL; //invalid mask for generic iic scan_token_write(pt+1, wparam, &wlen, &rlen, owq); pt=strchr(mask,'='); if (pt==NULL) return -EINVAL; //read mask has no '=' token! timeout=100; LEVEL_DEBUG("iic read: wlen=%d mask=%s wparam=%s", wlen,mask,wparam ) ; RETURN_ERROR_IF_BAD(OW_wr_complete_transaction(wlen,_FC03_WR_BEGIN_IIC, &rlen, wparam, rparam, timeout, pn)); RETURN_ERROR_IF_BAD(scan_token_read(pt+1, rparam, owq)); wlen=rlen=0; return OW_wr_complete_transaction(wlen,_FC03_WR_END_IIC, &rlen, wparam, rparam, timeout, pn); } static ZERO_OR_ERROR FS_w_seq_text(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE *start_of_text = (BYTE*)OWQ_buffer(owq); int i,retry,wlen,timeout; int size=(int)OWQ_size(owq); BYTE func=BYTE_MASK(PN(owq)->selected_filetype->data.u); LEVEL_DEBUG("SEQ text func=%d len=%d, offset=%d",func, size,OWQ_offset(owq) ) ; if (func==_FC03_SEQW_LCDD) size--; //remove last CR for lcd retry=0; timeout=100; if (size<=0) return -EINVAL; for(i=size;i;) { if (i>_FC02_MAX_WRITE_GULP) wlen=_FC02_MAX_WRITE_GULP; else wlen=i; LEVEL_DEBUG("WRITE seq %d bytes at position %d ",wlen,size-i ) ; if (BAD(OW_seqw_complete_transaction(wlen,func, start_of_text, timeout, pn))) { if (retry++>3) return -EINVAL; } else { start_of_text+=wlen; i-=wlen; retry=0; } } LEVEL_DEBUG("SEQ text end" ) ; return 0; } /* BAE memory functions */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { RETURN_ERROR_IF_BAD(OW_r_mem( (BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq), PN(owq))) ; OWQ_length(owq) = OWQ_size(owq) ; return 0; } static ZERO_OR_ERROR FS_eeprom_r_mem(struct one_wire_query *owq) { return COMMON_offset_process(FS_r_mem,owq, eeprom_offset(PN(owq))) ; } static ZERO_OR_ERROR FS_eeprom_r_page(struct one_wire_query *owq) { return COMMON_offset_process(FS_eeprom_r_mem,owq, _FC_EEPROM_PAGE_SIZE * OWQ_pn(owq).extension) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_mem( (BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq), PN(owq)) ) ; } static ZERO_OR_ERROR FS_eeprom_w_mem(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; size_t size = OWQ_size(owq) ; /* BYTE * eeprom = owmalloc( size ) ; if ( eeprom==NULL ) { return -ENOMEM ; } // read existing eeprom pattern if ( BAD( OW_r_mem(eeprom, size, OWQ_offset(owq)+eeprom_offset(pn), pn)) ) { LEVEL_DEBUG("Cannot read eeprom prior to writing") ; owfree(eeprom) ; return -EINVAL ; } // modify eeprom with new data OW_siumulate_eeprom(eeprom, (const BYTE *) OWQ_buffer(owq), size) ; */ // write back if ( BAD( OW_w_mem_eeprom((BYTE *) OWQ_buffer(owq), size, OWQ_offset(owq)+eeprom_offset(pn), pn)) ) { LEVEL_DEBUG("Cannot write to eeprom") ; //owfree(eeprom) ; return -EINVAL ; } //owfree(eeprom) ; return 0 ; } static ZERO_OR_ERROR FS_eeprom_w_page(struct one_wire_query *owq) { return COMMON_offset_process(FS_eeprom_w_mem,owq, _FC_EEPROM_PAGE_SIZE * OWQ_pn(owq).extension) ; } static ZERO_OR_ERROR FS_eeprom_erase(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; if (OWQ_Y(owq)) { off_t offset = _FC_EEPROM_PAGE_SIZE * pn->extension + eeprom_offset(pn) ; return GB_to_Z_OR_E( OW_eeprom_erase(offset,pn) ) ; } else{ return 0 ; } } /* BAE flash functions */ static ZERO_OR_ERROR FS_w_flash(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; BYTE * rom_image = (BYTE *) OWQ_buffer(owq) ; size_t rom_offset,expected_size ; if ( OWQ_size(owq) % 0x200 ) { LEVEL_DEBUG("Flash size of %d is not a multiple of 512.", (int)OWQ_size(owq) ) ; return -EBADMSG ; } if ( OWQ_offset(owq) % 0x200 ) { LEVEL_DEBUG("Flash offset %d is not a multiple of 512.", (int)OWQ_offset(owq) ) ; return -EBADMSG ; } //flash firmware may exceed 8192bytes, thus FS_w_flash is called more than once with successive buffers if ( OWQ_offset(owq) == 0 ) { LEVEL_DEBUG("Beginning of flash (from start of buffer).") ; // test size expected_size=1+(rom_image[7]+rom_image[6]*256)-(rom_image[5]+rom_image[4]*256); LEVEL_DEBUG("Flash size=%d, (size calculated from header=%d) .", (int)OWQ_size(owq), (int)expected_size ) ; if ( OWQ_size(owq) > expected_size ) { LEVEL_DEBUG("Flash size of %d is greater than expected %d bytes .", (int)OWQ_size(owq), (int)expected_size ) ; return -ERANGE ; } // start flash process, added duration param calculated as 1ms for 16 bytes if ( BAD( OW_initiate_flash( rom_image, pn, expected_size>>4 ) ) ) { LEVEL_DEBUG("Unsuccessful flash initialization"); return -EFAULT ; } } // loop though pages, up to 5 attempts for each page for ( rom_offset=0 ; rom_offset 4 ) { LEVEL_DEBUG( "Too many failures writing flash at offset %d.", rom_offset ) ; return -EIO ; } LEVEL_DEBUG( "retry %d of 5 when writing flash.", tries ) ; } } LEVEL_DEBUG("Successfully flashed full rom.") ; return 0; } /* static ZERO_OR_ERROR FS_r_flash( struct one_wire_query *owq) { RETURN_ERROR_IF_BAD( OW_r_mem( (BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq)+_FC02_FUNCTION_FLASH_OFFSET, PN(owq) ) ); OWQ_length(owq) = OWQ_size(owq) ; return 0 ; } */ /* BAE extended command */ static ZERO_OR_ERROR FS_w_extended(struct one_wire_query *owq) { // Write data 255 bytes maximum (1byte minimum) if ( OWQ_size(owq) == 0 ) { return -EINVAL ; } return GB_to_Z_OR_E( OW_w_extended( (BYTE *) OWQ_buffer(owq), OWQ_size(owq), PN(owq) ) ) ; } /*static ZERO_OR_ERROR FS_writebyte(struct one_wire_query *owq) { off_t location = OWQ_U(owq)>>8 ; BYTE data = OWQ_U(owq) & 0xFF ; // Write 1 byte , return GB_to_Z_OR_E( OW_w_mem( &data, 1, location, PN(owq) ) ) ; }*/ /* BAE version */ static ZERO_OR_ERROR FS_version_state(struct one_wire_query *owq) { UINT v ; RETURN_ERROR_IF_BAD( OW_version( &v, PN(owq) ) ) ; OWQ_U(owq) = v ; return 0 ; } static ZERO_OR_ERROR FS_version(struct one_wire_query *owq) { char v[6]; UINT version ; if ( FS_r_sibling_U( &version, "versionstate", owq ) != 0 ) { return -EINVAL ; } UCLIBCLOCK; snprintf(v,6,"%.2X.%.2X",version&0xFF, (version>>8)&0xFF); UCLIBCUNLOCK; return OWQ_format_output_offset_and_size(v, 5, owq); } static ZERO_OR_ERROR FS_version_device(struct one_wire_query *owq) { UINT version = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &version, "versionstate", owq ) ; OWQ_U(owq) = (version>>8) & 0xFF ; return z_or_e ; } static ZERO_OR_ERROR FS_version_bootstrap(struct one_wire_query *owq) { UINT version = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &version, "versionstate", owq ) ; OWQ_U(owq) = version & 0xFF ; return z_or_e ; } /* BAE type */ static ZERO_OR_ERROR FS_type_state(struct one_wire_query *owq) { UINT t ; RETURN_ERROR_IF_BAD( OW_type( &t, PN(owq) ) ); OWQ_U(owq) = t ; return 0 ; } static ZERO_OR_ERROR FS_localtype(struct one_wire_query *owq) { char t[6]; UINT localtype ; if ( FS_r_sibling_U( &localtype, "typestate", owq ) != 0 ) { return -EINVAL ; } UCLIBCLOCK; snprintf(t,6,"%.2X.%.2X",localtype&0xFF, (localtype>>8)&0xFF); UCLIBCUNLOCK; return OWQ_format_output_offset_and_size(t, 5, owq); } static ZERO_OR_ERROR FS_type_device(struct one_wire_query *owq) { UINT t = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &t, "typestate", owq ) ; OWQ_U(owq) = (t>>8) & 0xFF ; return z_or_e ; } static ZERO_OR_ERROR FS_type_chip(struct one_wire_query *owq) { UINT t = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &t, "typestate", owq ) ; OWQ_U(owq) = t & 0xFF ; return z_or_e ; } static ZERO_OR_ERROR FS_r_8_ext(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; int array_index, ofs, uplimit, *v; array_index = pn->extension ; v=(int*) pn->selected_filetype->data.v; ofs= v[0]; uplimit=v[1]; LEVEL_DEBUG("test numeric extension : ofs=%d, uplimit=%d extension=%d", ofs,uplimit,array_index ) ; if ((array_index<0) || (array_index>=uplimit)) return -EINVAL ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, ofs + bytes * array_index, pn ) ); OWQ_U(owq) = data[0] ; return 0 ; } static ZERO_OR_ERROR FS_w_8_ext(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; int array_index, ofs, uplimit, *v; array_index = pn->extension ; v=(int*) pn->selected_filetype->data.v; ofs= v[0]; uplimit=v[1]; if ((array_index<0) || (array_index>=uplimit)) return -EINVAL ; data[0] = BYTE_MASK( OWQ_U(owq) ) ; return GB_to_Z_OR_E(OW_w_mem(data, bytes, ofs + bytes * array_index, pn ) ) ; } /* read an 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_r_8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = data[0] ; return 0 ; } /* write an 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_w_8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; data[0] = BYTE_MASK( OWQ_U(owq) ) ; return GB_to_Z_OR_E(OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read a 16 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_r_16(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 16/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = BAE_uint16(data) ; return 0 ; } /* write a 16 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_w_16(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 16/8 ; BYTE data[bytes] ; BAE_uint16_to_bytes( OWQ_U(owq), data ) ; return GB_to_Z_OR_E( OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read a 32 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_r_32(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 32/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = BAE_uint32(data) ; return 0 ; } /* write a 32 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_w_32(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 32/8 ; BYTE data[bytes] ; BAE_uint32_to_bytes( OWQ_U(owq), data ) ; return GB_to_Z_OR_E( OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* Lower level functions */ // Extended command -- insert length, The first byte of the payload is a subcommand but that is invisible to us. static GOOD_OR_BAD OW_w_extended(BYTE * data, size_t size, struct parsedname *pn) { BYTE p[1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_EXTENDED_COMMAND, BYTE_MASK(size-1), }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1+1+size, 0), TRXN_WRITE1(q), TRXN_DELAY(2), TRXN_END, }; /* Copy to write buffer */ memcpy(&p[2], data, size); return BUS_transaction(t, pn) ; } // Flow write command without crc /* static GOOD_OR_BAD OW_w_flow_nocrc(BYTE wf, BYTE * param, size_t plen, BYTE * data, size_t size, struct parsedname *pn) { BYTE p[1 + 1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_FLOW, BYTE_MASK(plen),wf, 0, }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 4+plen, 0), TRXN_WRITE1(q), TRXN_DELAY(1), TRXN_WRITE(data, size), TRXN_END, }; LEVEL_DEBUG("Send flow command") ; // Copy to write buffer memcpy(&p[4], param, plen); RETURN_BAD_IF_BAD( BUS_transaction(t, pn) ); return gbGOOD ; } // Flow write command WITH crc interleave static GOOD_OR_BAD OW_w_flow_crc(BYTE wf, BYTE * param, size_t plen, BYTE * data, size_t size,size_t chunksize, struct parsedname *pn) { BYTE *pt; size_t i; BYTE p[1 + 1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_FLOW, BYTE_MASK(plen),wf, chunksize, }; BYTE chunk[_FC_MAX_INTERLEAVE+2] ; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log header[] = { TRXN_START, TRXN_WR_CRC16(p, 4+plen, 0), TRXN_WRITE1(q), TRXN_DELAY(1), }; struct transaction_log content[] = { TRXN_WR_CRC16(chunk, chunksize,0), }; struct transaction_log remainder[] = { TRXN_WRITE(chunk, size % chunksize), //remainder of bloc if not multiple }; struct transaction_log trailer[] = { TRXN_END, }; LEVEL_DEBUG("Begin stream write of %d bytes", (int)size ) ; memcpy(&p[4], param, plen); RETURN_BAD_IF_BAD(BUS_transaction(header, pn)); pt=data; for(i=size/chunksize;i;i--){ memcpy(chunk, pt, chunksize); pt+=chunksize; RETURN_BAD_IF_BAD(BUS_transaction(content, pn)); LEVEL_DEBUG("chunk write ok, remaining chunks=%d", (int)i ) ; } if (size % chunksize){ memcpy(chunk, pt, size % chunksize); RETURN_BAD_IF_BAD( BUS_transaction(remainder, pn) ) ; } RETURN_BAD_IF_BAD( BUS_transaction(trailer, pn) ) ; return gbGOOD ; } // Flow read command without crc static GOOD_OR_BAD OW_r_flow_nocrc(BYTE wf, BYTE * param, size_t plen, BYTE * data, size_t size, struct parsedname *pn) { BYTE p[1 + 1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_FLOW, BYTE_MASK(plen), wf, 0, }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 4+plen, 0), TRXN_WRITE1(q), TRXN_DELAY(1), TRXN_READ(data, size), TRXN_END, }; // Copy to write buffer memcpy(&p[4], param, plen); RETURN_ERROR_IF_BAD( BUS_transaction(t, pn)) ; Debug_Bytes("BAE flow read",data,size) ; return gbGOOD ; } */ static GOOD_OR_BAD OW_poll_until_timeout(int *prlen, BYTE * rparam, int timeout, struct parsedname *pn) { UINT tries; BYTE retcode; int rlen; //temporary var to hold len received rlen when retcode==0xff GOOD_OR_BAD r; LEVEL_DEBUG("BAE Query result until timeout (%d ms), expected rlen=%d", timeout, *prlen) ; tries=0; while (1) { LEVEL_DEBUG( "try %d when querying result from previous function.", tries ) ; r=OW_query_cmd(&rlen, &retcode,rparam,pn ); if (BAD(r)) { ++tries ; if ( tries > 5 ) { LEVEL_DEBUG( "Too many failures getting result from previous function." ) ; return -EIO ; } } else { if (retcode==0xff) { timeout-=10; if (timeout<=0) { LEVEL_DEBUG( "Timeout getting result from previous function." ) ; return -EINVAL ; } UT_delay(10); //10ms delay if slave still busy } else { *prlen=rlen; //only when retcode is not 0xff LEVEL_DEBUG( "Previous command terminated with retcode=%d, rlen=%d.", retcode,rlen ) ; if (retcode==0) return gbGOOD; return -EINVAL ; } } } } //WR command 0X17 with query until return of result static GOOD_OR_BAD OW_wr_complete_transaction( int wlen,BYTE func, int *rlen, BYTE * wparam, BYTE * rparam, int timeout, struct parsedname *pn) { BYTE p[1 + 1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_WRCMD, BYTE_MASK(wlen), BYTE_MASK(func), BYTE_MASK(*rlen), 0, }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 4+wlen, 0), TRXN_WRITE1(q), TRXN_DELAY(1), //any WR commands require at least 1ms before query result TRXN_END, }; LEVEL_DEBUG("BAE WR transaction function=%d, wlen=%d, rlen=%d", func, wlen, *rlen) ; Debug_Bytes("WR_cmd, data:",wparam,wlen) ; memcpy(p+4, wparam, wlen); RETURN_ERROR_IF_BAD(BUS_transaction(t, pn)) ; return OW_poll_until_timeout(rlen, rparam, timeout, pn); } // SEQW command 0X18 with query until return of result static GOOD_OR_BAD OW_seqw_complete_transaction(int wlen, BYTE func, BYTE * wparam, int timeout, struct parsedname *pn) { BYTE p[1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_SEQWCMD, BYTE_MASK(wlen), BYTE_MASK(func), 0, }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3+wlen, 0), TRXN_WRITE1(q), TRXN_DELAY(1), //any SEQ commands require at least 1ms before query result TRXN_END, }; int rlen=0; LEVEL_DEBUG("BAE SEQWR transaction function=%d, wlen=%d", func, wlen) ; Debug_Bytes("SEQW_cmd, data:",wparam,wlen) ; memcpy(p+3, wparam, wlen); RETURN_ERROR_IF_BAD( BUS_transaction(t, pn)) ; return OW_poll_until_timeout(&rlen, p, timeout, pn); } //SEQR command 0X19 with query until return of result static GOOD_OR_BAD OW_seqr_complete_transaction(int *rlen,BYTE func,BYTE * rparam, int timeout, struct parsedname *pn) { BYTE p[1 + 1 + 1 + 2] = { _1W_SEQRCMD, BYTE_MASK(*rlen), BYTE_MASK(func), 0, }; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 0), TRXN_WRITE1(q), TRXN_DELAY(1), //any SEQ commands require at least 1ms before query result TRXN_END, }; LEVEL_DEBUG( "BAE SEQR transaction: function=%d, rlen= %d", func, *rlen ) ; RETURN_ERROR_IF_BAD(BUS_transaction(t, pn)); return OW_poll_until_timeout(rlen, rparam, timeout, pn); } //QUERY command 0x1A static GOOD_OR_BAD OW_query_cmd(int *prlen, BYTE *retcode,BYTE * rparam , struct parsedname *pn) { BYTE p[1 + 1 + 1 + _FC02_MAX_COMMAND_GULP + 2] = { _1W_QUERY_DATA_COMMAND }; int rlen; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), //query command TRXN_READ2(p+1), //retcode and len TRXN_END, }; LEVEL_DEBUG( "query_cmd: getting header ") ; RETURN_BAD_IF_BAD( BUS_transaction(t, pn)) ; LEVEL_DEBUG( "query_cmd: header received: retcode=%d, rlen=%d ", p[1],p[2]) ; retcode[0]=p[1]; //retcode of previous command rlen=p[2]; *prlen=rlen; if (p[1]==0xff) return gbGOOD; //no communication error, but still busy processing the previous command else { struct transaction_log t2[] = { TRXN_READ(p+3,rlen+2), TRXN_CRC16(p,rlen+3+2), TRXN_END, }; RETURN_BAD_IF_BAD( BUS_transaction(t2, pn)) ; memcpy(rparam,p+3, rlen); Debug_Bytes("BAE query_cmd, received:",rparam,rlen) ; return gbGOOD ; } } //read bytes[size] from position static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname * pn) { size_t remain = size ; off_t local_offset = 0 ; while ( remain > 0 ) { size_t gulp = remain ; if ( gulp > _FC02_MAX_READ_GULP ) { gulp = _FC02_MAX_READ_GULP ; } RETURN_BAD_IF_BAD( OW_r_mem_small( &data[local_offset], gulp, offset+local_offset, pn )); remain -= gulp ; local_offset += gulp ; } return gbGOOD ; } //write bytes[size] to position static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname * pn) { size_t remain = size ; off_t local_offset = 0 ; while ( remain > 0 ) { size_t gulp = remain ; if ( gulp > _FC02_MAX_READ_GULP ) { gulp = _FC02_MAX_READ_GULP ; } RETURN_BAD_IF_BAD( OW_w_mem_small( &data[local_offset], gulp, offset+local_offset, pn )); remain -= gulp ; local_offset += gulp ; } return gbGOOD ; } //write bytes[size] to eeprom position ( only difference is eeprom delay) static GOOD_OR_BAD OW_w_mem_eeprom(BYTE * data, size_t size, off_t offset, struct parsedname * pn) { size_t remain = size ; off_t local_offset = 0 ; while ( remain > 0 ) { size_t gulp = remain ; if ( gulp > _FC02_MAX_READ_GULP ) { gulp = _FC02_MAX_READ_GULP ; } RETURN_BAD_IF_BAD( OW_w_mem_small( &data[local_offset], gulp, offset+local_offset, pn )); UT_delay(2) ; //1.5 msec remain -= gulp ; local_offset += gulp ; } return gbGOOD ; } /* the crc returned is calculated on buffer transmitted and not on resulting memory contents // Simulate eeprom (for correct CRC) static void OW_siumulate_eeprom(BYTE * eeprom, const BYTE * data, size_t size) { size_t i ; for ( i=0 ; i integer */ static uint16_t BAE_uint16(BYTE * p) { return (((uint16_t) p[0]) << 8) | ((uint16_t) p[1]); } static uint32_t BAE_uint32(BYTE * p) { return (((uint32_t) p[0]) << 24) | (((uint32_t) p[1]) << 16) | (((uint32_t) p[2]) << 8) | ((uint32_t) p[3]); } static void BAE_uint16_to_bytes( uint16_t num, unsigned char * p ) { p[1] = num&0xFF ; p[0] = (num>>8)&0xFF ; } static void BAE_uint32_to_bytes( uint32_t num, unsigned char * p ) { p[3] = num&0xFF ; p[2] = (num>>8)&0xFF ; p[1] = (num>>16)&0xFF ; p[0] = (num>>24)&0xFF ; } static GOOD_OR_BAD OW_initiate_flash( BYTE * data, struct parsedname * pn , int duration) { BYTE p[1+1+1+32+2] = { _1W_EXTENDED_COMMAND, 32,_1W_ECMD_ERASE_FIRMWARE, } ; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1+1+1+32, 0), TRXN_WRITE1(q), TRXN_DELAY(duration), TRXN_END, } ; memcpy(&p[3], data, 32 ) ; return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_write_flash( BYTE * data, struct parsedname * pn ) { BYTE p[1+1+1+32+2] = { _1W_EXTENDED_COMMAND, 32,_1W_ECMD_FLASH_FIRMWARE, } ; BYTE q[] = { _1W_CONFIRM_WRITE, } ; GOOD_OR_BAD ret; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1+1+1+32, 0), TRXN_WRITE1(q), TRXN_DELAY(2), TRXN_END, } ; memcpy(&p[3], data, 32 ) ; ret=BUS_transaction(t, pn) ; _Debug_Bytes("write flash buffer details",p,37); return ret; } static GOOD_OR_BAD OW_eeprom_erase( off_t offset, struct parsedname * pn ) { BYTE p[1+2+2] = { _1W_ERASE_EEPROM_PAGE, LOW_HIGH_ADDRESS(offset), } ; BYTE q[] = { _1W_CONFIRM_WRITE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1+2, 0), TRXN_WRITE1(q), TRXN_END, } ; return BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_write_external.c0000644000175000017500000001056111740204352017130 00000000000000/* $Id: ow_write_external.c,v 1.2 2012/04/08 03:41:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_external.h" /* strategy for external write: A common write function for all communication schemes e.g. script The actual device record and actual family record is obtained from the trees. The script is called (via popen) or other method for other types The device should be locked for the communication arguments include fields from the tree records and owq the returned value is obvious */ static ZERO_OR_ERROR OW_trees_for_write( char * device, char * property, struct one_wire_query * owq ) ; static ZERO_OR_ERROR OW_write_external_script( struct sensor_node * sensor_n, struct property_node * property_n, struct one_wire_query * owq ) ; static ZERO_OR_ERROR OW_script_write( FILE * script_f, struct one_wire_query * owq ) ; // ------------------------ ZERO_OR_ERROR FS_w_external( struct one_wire_query * owq ) { ZERO_OR_ERROR zoe = -ENOENT ; // default char * device_property = owstrdup( PN(owq)->device_name ) ; // copy of device/property part of path if ( device_property != NULL ) { char * property = device_property ; char * device = strsep( &property, "/" ) ; // separate out property char * extension = property ; if ( property != NULL ) { // pare off extension property = strsep( &extension, "." ) ; } zoe = OW_trees_for_write( device, property, owq ) ; owfree( device_property ) ; // clean up } return zoe ; } static ZERO_OR_ERROR OW_trees_for_write( char * device, char * property, struct one_wire_query * owq ) { // find sensor node struct sensor_node * sense_n = Find_External_Sensor( device ) ; if ( sense_n != NULL ) { // found // find property node struct property_node * property_n = Find_External_Property( sense_n->family, property ) ; if ( property_n != NULL ) { switch ( property_n->et ) { case et_none: return 0 ; case et_internal: return -ENOTSUP ; case et_script: return OW_write_external_script( sense_n, property_n, owq ) ; default: return -ENOTSUP ; } } } return -ENOENT ; } static ZERO_OR_ERROR OW_write_external_script( struct sensor_node * sensor_n, struct property_node * property_n, struct one_wire_query * owq ) { char cmd[PATH_MAX+1] ; struct parsedname * pn = PN(owq) ; FILE * script_f ; int snp_return ; ZERO_OR_ERROR zoe ; // load the command script and arguments if ( pn->sparse_name == NULL ) { // not a text sparse name snp_return = snprintf( cmd, PATH_MAX+1, "%s %s %s %d %s %d %d %s %s", property_n->read, // command sensor_n->name, // sensor name property_n->property, // property, pn->extension, // extension "write", // mode (int) OWQ_size(owq), // size (int) OWQ_offset(owq), // offset sensor_n->data, // sensor-specific data property_n->data // property-specific data ) ; } else { snp_return = snprintf( cmd, PATH_MAX+1, "%s %s %s %s %s %d %d %s %s", property_n->read, // command sensor_n->name, // sensor name property_n->property, // property, pn->sparse_name, // extension "write", // mode (int) OWQ_size(owq), // size (int) OWQ_offset(owq), // offset sensor_n->data, // sensor-specific data property_n->data // property-specific data ) ; } if ( snp_return < 0 ) { LEVEL_DEBUG("Problem creating script string for %s/%s",sensor_n->name,property_n->property) ; return -EINVAL ; } script_f = popen( cmd, "w" ) ; if ( script_f == NULL ) { ERROR_DEBUG("Cannot create external program link for writing %s/%s",sensor_n->name,property_n->property); return -EIO ; } zoe = OW_script_write( script_f, owq ) ; fclose( script_f ) ; return zoe ; } static ZERO_OR_ERROR OW_script_write( FILE * script_f, struct one_wire_query * owq ) { size_t fr_return ; int po_return = OWQ_parse_output(owq) ; // load data in buffer if ( po_return < 0 ) { return -EINVAL ; } fr_return = fwrite( OWQ_buffer(owq), po_return, 1, script_f ) ; if ( fr_return == 0 && ferror(script_f) != 0 ) { LEVEL_DEBUG( "Could not write script data back for %s",PN(owq)->path ) ; return -EIO ; } return 0 ; } owfs-2.8p15/module/owlib/src/c/ow_w1_print.c0000644000175000017500000000734411664034153015651 00000000000000/* $Id: ow_w1_print.c,v 1.6 2011/11/26 00:52:59 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 #include "ow_w1.h" #include "ow_connection.h" #define printcase( flag ) case flag: printf(#flag); break static void NLM_print( struct nlmsghdr * nlm ) { if ( nlm == NULL ) { printf("NLMSGHDR: NULL nlm field\n") ; return ; } printf("NLMSGHDR: len=%u type=%u (",nlm->nlmsg_len, nlm->nlmsg_type) ; switch ( nlm->nlmsg_type ) { printcase( NLMSG_NOOP ); printcase( NLMSG_ERROR ); printcase( NLMSG_DONE ); printcase( NLMSG_OVERRUN ); default: printf("NLMSG unknown message type %d",nlm->nlmsg_type); break ; } printf(") flags=%u seq=%u|%u pid=%u\n",nlm->nlmsg_flags, NL_BUS(nlm->nlmsg_seq), NL_SEQ(nlm->nlmsg_seq), nlm->nlmsg_pid ) ; } static void CN_print( struct cn_msg * cn ) { if ( cn == NULL ) { printf("CN_MSG: NULL cn field\n") ; return ; } printf("CN_MSG: idx/val=%u/%u (",cn->id.idx,cn->id.val) ; switch(cn->id.idx) { printcase( CN_IDX_PROC ); printcase( CN_IDX_CIFS ); printcase( CN_W1_IDX ); printcase( CN_IDX_V86D ); default: printf("CN unknown message type %d",cn->id.idx); break ; } printf(") seq=%u|%u ack=%u len=%u flags=%u\n",NL_BUS(cn->seq),NL_SEQ(cn->seq),cn->ack,cn->len,cn->flags) ; } static void W1M_print( struct w1_netlink_msg * w1m ) { if ( w1m == NULL ) { printf("W1_NETLINK_MSG: NULL w1m field\n") ; return ; } printf("W1_NETLINK_MSG: type=%u (",w1m->type) ; switch(w1m->type) { printcase( W1_SLAVE_ADD ); printcase( W1_SLAVE_REMOVE ); printcase( W1_MASTER_ADD ); printcase( W1_MASTER_REMOVE ); printcase( W1_MASTER_CMD ); printcase( W1_SLAVE_CMD ); printcase( W1_LIST_MASTERS ); default: printf("W1_NETLINK_MSG unknown message type %d",w1m->type); break ; } printf(") len=%u id=%u\n",w1m->len, w1m->id.mst.id ) ; } static void W1C_print( struct w1_netlink_cmd * w1c ) { if ( w1c == NULL ) { printf("W1_NETLINK_CMD: NULL w1c field\n") ; return ; } printf("W1_NETLINK_CMD: cmd=%u (",w1c->cmd ) ; switch(w1c->cmd) { printcase( W1_CMD_READ ); printcase( W1_CMD_WRITE ); printcase( W1_CMD_SEARCH ); printcase( W1_CMD_ALARM_SEARCH ); printcase( W1_CMD_TOUCH ); printcase( W1_CMD_RESET ); default: printf("W1_NETLINK_CMD unknown message type %d",w1c->cmd); break ; } printf(") len=%u\n", w1c->len) ; } void Netlink_Print( struct nlmsghdr * nlm, struct cn_msg * cn, struct w1_netlink_msg * w1m, struct w1_netlink_cmd * w1c, unsigned char * data, int length ) { if ( Globals.error_level>=e_err_call ) { NLM_print( nlm ) ; CN_print( cn ) ; W1M_print( w1m ) ; W1C_print( w1c ) ; if ( data != NULL ) { _Debug_Bytes("Data", data, length) ; } else { printf("NULL data\n"); } } } #endif /* OW_W1 */ owfs-2.8p15/module/owlib/src/c/ow_fs_address.c0000664000175000017500000000406311535564273016230 00000000000000/* $Id: ow_fs_address.c,v 1.4 2011/03/09 02:40:59 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_address(struct one_wire_query *owq) { ASCII ad[SERIAL_NUMBER_SIZE*2]; struct parsedname *pn = PN(owq); bytes2string(ad, pn->sn, SERIAL_NUMBER_SIZE); return OWQ_format_output_offset_and_size(ad, SERIAL_NUMBER_SIZE*2, owq); } ZERO_OR_ERROR FS_r_address(struct one_wire_query *owq) { int sn_index, ad_index; ASCII ad[SERIAL_NUMBER_SIZE*2]; struct parsedname *pn = PN(owq); for (sn_index = SERIAL_NUMBER_SIZE-1, ad_index = 0; sn_index >= 0; --sn_index, ad_index += 2) { num2string(&ad[ad_index], pn->sn[sn_index]); } return OWQ_format_output_offset_and_size(ad, SERIAL_NUMBER_SIZE*2, owq); } owfs-2.8p15/module/owlib/src/c/ow_ha7e.c0000664000175000017500000002400311611434674014727 00000000000000/* $Id: ow_ha7e.c,v 1.53 2011/07/20 02:13:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" //static void byteprint( const BYTE * b, int size ) ; static RESET_TYPE HA7E_reset(const struct parsedname *pn); static enum search_status HA7E_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD HA7E_sendback_part(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) ; static GOOD_OR_BAD HA7E_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void HA7E_setroutines(struct connection_in *in); static void HA7E_close(struct connection_in *in); static GOOD_OR_BAD HA7E_directory( struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD HA7E_select( const struct parsedname * pn ) ; static GOOD_OR_BAD HA7E_resync( const struct parsedname * pn ) ; static void HA7E_powerdown(struct connection_in * in) ; static void HA7E_setroutines(struct connection_in *in) { in->iroutines.detect = HA7E_detect; in->iroutines.reset = HA7E_reset; in->iroutines.next_both = HA7E_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = HA7E_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = HA7E_select ; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE ; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = HA7E_close; in->iroutines.flags = ADAP_FLAG_dirgulp | ADAP_FLAG_bundle | ADAP_FLAG_dir_auto_reset | ADAP_FLAG_no2404delay ; in->bundling_length = HA7E_FIFO_SIZE; } GOOD_OR_BAD HA7E_detect(struct connection_in *in) { struct parsedname pn; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed pn.selected_connection = in; /* Set up low-level routines */ HA7E_setroutines(in); // Poison current "Address" for adapter in->master.ha7e.sn[0] = 0 ; // so won't match /* Open the com port */ COM_set_standard( in ) ; // standard COM port settings RETURN_BAD_IF_BAD(COM_open(in)) ; COM_slurp(in) ; if ( GOOD( gbRESET( HA7E_reset(&pn) ) ) ) { in->Adapter = adapter_HA7E ; in->adapter_name = "HA7E/S"; return gbGOOD; } SOC(in)->flow = flow_second; // flow control RETURN_BAD_IF_BAD(COM_change(in)) ; COM_slurp(in) ; if ( GOOD( gbRESET( HA7E_reset(&pn) ) ) ) { in->Adapter = adapter_HA7E ; in->adapter_name = "HA7E/S"; return gbGOOD; } LEVEL_DEFAULT("Error in HA7E detection: can't perform RESET"); return gbBAD; } static RESET_TYPE HA7E_reset(const struct parsedname *pn) { BYTE resp[1]; COM_flush(pn->selected_connection); if ( BAD(COM_write((BYTE*)"R", 1, pn->selected_connection)) ) { LEVEL_DEBUG("Error sending HA7E reset"); return BUS_RESET_ERROR; } if ( BAD(COM_read(resp, 1, pn->selected_connection)) ) { LEVEL_DEBUG("Error reading HA7E reset"); return BUS_RESET_ERROR; } if (resp[0]!=0x0D) { LEVEL_DEBUG("Error HA7E reset bad "); return BUS_RESET_ERROR; } return BUS_RESET_OK; } static enum search_status HA7E_next_both(struct device_search *ds, const struct parsedname *pn) { if (ds->LastDevice) { return search_done; } COM_flush(pn->selected_connection); if (ds->index == -1) { if ( BAD( HA7E_directory(ds, pn) ) ) { return search_error; } } // LOOK FOR NEXT ELEMENT ++ds->index; LEVEL_DEBUG("Index %d", ds->index); switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp)) ) { case 0: LEVEL_DEBUG("SN found: " SNformat "\n", SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } /************************************************************************/ /* HA7E_directory: searches the Directory stores it in a dirblob */ /* & stores in in a dirblob object depending if it */ /* Supports conditional searches of the bus for */ /* /alarm branch */ /* */ /* Only called for the first element, everything else comes from dirblob */ /* returns 0 even if no elements, errors only on communication errors */ /************************************************************************/ static GOOD_OR_BAD HA7E_directory(struct device_search *ds, const struct parsedname *pn) { char resp[17]; BYTE sn[SERIAL_NUMBER_SIZE]; char *first, *next, *current ; DirblobClear( &(ds->gulp) ); //Depending on the search type, the HA7E search function //needs to be selected //tEC -- Conditional searching //tF0 -- Normal searching // Send the configuration command and check response if (ds->search == _1W_CONDITIONAL_SEARCH_ROM) { first = "C" ; next = "c" ; } else { first = "S" ; next = "s" ; } current = first ; while (1) { if ( BAD(COM_write((BYTE*)current, 1, pn->selected_connection)) ) { return HA7E_resync(pn) ; } current = next ; // set up for next pass //One needs to check the first character returned. //If nothing is found, the ha7e will timeout rather then have a quick //return. This happens when looking at the alarm directory and //there are no alarms pending //So we grab the first character and check it. If not an E leave it //in the resp buffer and get the rest of the response from the HA7E //device if ( BAD(COM_read((BYTE*)resp, 1, pn->selected_connection)) ) { return HA7E_resync(pn) ; } if ( resp[0] == 0x0D ) { return gbGOOD ; // end of list } if ( BAD(COM_read((BYTE*)&resp[1], 16, pn->selected_connection)) ) { return HA7E_resync(pn) ; } sn[7] = string2num(&resp[0]); sn[6] = string2num(&resp[2]); sn[5] = string2num(&resp[4]); sn[4] = string2num(&resp[6]); sn[3] = string2num(&resp[8]); sn[2] = string2num(&resp[10]); sn[1] = string2num(&resp[12]); sn[0] = string2num(&resp[14]); // Set as current "Address" for adapter memcpy( pn->selected_connection->master.ha7e.sn, sn, SERIAL_NUMBER_SIZE) ; LEVEL_DEBUG("SN found: " SNformat, SNvar(sn)); if ( resp[16]!=0x0D ) { return HA7E_resync(pn) ; } // CRC check if (CRC8(sn, SERIAL_NUMBER_SIZE) || (sn[0] == 0)) { /* A minor "error" and should perhaps only return -1 */ /* to avoid reconnect */ LEVEL_DEBUG("sn = %s", sn); return HA7E_resync(pn) ; } DirblobAdd(sn, &(ds->gulp) ); } } static GOOD_OR_BAD HA7E_resync( const struct parsedname * pn ) { COM_flush(pn->selected_connection); HA7E_reset(pn); COM_flush(pn->selected_connection); // Poison current "Address" for adapter pn->selected_connection->master.ha7e.sn[0] = 0 ; // so won't match return gbBAD ; } static GOOD_OR_BAD HA7E_select( const struct parsedname * pn ) { char send_address[18] ; char resp_address[17] ; if ( (pn->selected_device==NO_DEVICE) || (pn->selected_device==DeviceThermostat) ) { return gbRESET( HA7E_reset(pn) ) ; } send_address[0] = 'A' ; num2string( &send_address[ 1], pn->sn[7] ) ; num2string( &send_address[ 3], pn->sn[6] ) ; num2string( &send_address[ 5], pn->sn[5] ) ; num2string( &send_address[ 7], pn->sn[4] ) ; num2string( &send_address[ 9], pn->sn[3] ) ; num2string( &send_address[11], pn->sn[2] ) ; num2string( &send_address[13], pn->sn[1] ) ; num2string( &send_address[15], pn->sn[0] ) ; send_address[17] = 0x0D; if ( memcmp( pn->sn, pn->selected_connection->master.ha7e.sn, SERIAL_NUMBER_SIZE ) ) { if ( BAD(COM_write((BYTE*)send_address,18,pn->selected_connection)) ) { LEVEL_DEBUG("Error with sending HA7E A-ddress") ; return HA7E_resync(pn) ; } } else { if ( BAD(COM_write((BYTE*)"M",1,pn->selected_connection)) ) { LEVEL_DEBUG("Error with sending HA7E M-atch") ; return HA7E_resync(pn) ; } } if ( BAD(COM_read((BYTE*)resp_address,17,pn->selected_connection)) ) { LEVEL_DEBUG("Error with reading HA7E select") ; return HA7E_resync(pn) ; } if ( memcmp( &resp_address[0],&send_address[1],17) ) { LEVEL_DEBUG("Error with HA7E select response") ; return HA7E_resync(pn) ; } // Set as current "Address" for adapter memcpy( pn->selected_connection->master.ha7e.sn, pn->sn, SERIAL_NUMBER_SIZE) ; return gbGOOD ; } // Send data and return response block -- up to 32 bytes static GOOD_OR_BAD HA7E_sendback_part(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { char send_data[1+2+32*2+1] ; char get_data[32*2+1] ; send_data[0] = 'W' ; num2string( &send_data[1], size ) ; bytes2string(&send_data[3], data, size) ; send_data[3+2*size] = 0x0D ; if ( BAD(COM_write((BYTE*)send_data,size*2+4,pn->selected_connection)) ) { LEVEL_DEBUG("Error with sending HA7E block") ; HA7E_resync(pn) ; return gbBAD ; } if ( BAD(COM_read((BYTE*)get_data,size*2+1,pn->selected_connection)) ) { LEVEL_DEBUG("Error with reading HA7E block") ; HA7E_resync(pn) ; return gbBAD ; } string2bytes(get_data, resp, size) ; return gbGOOD ; } static GOOD_OR_BAD HA7E_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { int left; for ( left=size ; left>0 ; left -= 32 ) { size_t pass_start = size - left ; size_t pass_size = (left>32)?32:left ; RETURN_BAD_IF_BAD( HA7E_sendback_part( &data[pass_start], &resp[pass_start], pass_size, pn ) ) ; } return gbGOOD; } /********************************************************/ /* HA7E_close ** clean local resources before */ /* closing the serial port */ /* */ /********************************************************/ static void HA7E_close(struct connection_in *in) { HA7E_powerdown(in) ; COM_close(in); } static void HA7E_powerdown(struct connection_in * in) { struct parsedname pn; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed pn.selected_connection = in; COM_write((BYTE*)"P", 1, in) ; COM_slurp(in) ; } owfs-2.8p15/module/owlib/src/c/ow_select.c0000644000175000017500000001527411671012635015365 00000000000000/* $Id: ow_select.c,v 1.60 2011/12/11 02:29:49 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" static GOOD_OR_BAD Turnoff(const struct parsedname *pn); static GOOD_OR_BAD BUS_select_subbranch(const struct ds2409_hubs *bp, const struct parsedname *pn); static GOOD_OR_BAD BUS_Skip_Rom(const struct parsedname *pn); static GOOD_OR_BAD BUS_select_opening(const struct parsedname *pn) ; static GOOD_OR_BAD BUS_select_closing(const struct parsedname *pn) ; /* DS2409 commands */ #define _1W_STATUS_READ_WRITE 0x5A #define _1W_ALL_LINES_OFF 0x66 #define _1W_DISCHARGE_LINES 0x99 #define _1W_DIRECT_ON_MAIN 0xA5 #define _1W_SMART_ON_MAIN 0xCC #define _1W_SMART_ON_AUX 0x33 //-------------------------------------------------------------------------- /** Select -- selects a 1-wire device to respond to further commands. First resets, then climbs down the branching tree, finally 'selects' the device. If no device is listed in the parsedname structure, only the reset and branching is done. This allows selective listing. Return 0=good, else reset, send_data, sendback_data */ GOOD_OR_BAD BUS_select(const struct parsedname *pn) { // match Serial Number command 0x55 BYTE sent[9] = { _1W_MATCH_ROM, }; int ds2409_depth = pn->ds2409_depth; struct connection_in * in = pn->selected_connection ; if ( BusIsServer(in) ) { LEVEL_DEBUG("Calling local select on remote bus for <%s>",SAFESTRING(pn->path) ) ; return gbBAD ; } if (Globals.one_device) { return BUS_Skip_Rom(pn); } if (!RootNotBranch(pn) && !AdapterSupports2409(pn)) { LEVEL_CALL("Attempt to use a branched path (DS2409 main or aux) when bus master doesn't support it."); return gbBAD; /* cannot do branching with eg. LINK ascii */ } LEVEL_DEBUG("Selecting a path (and device) path=%s SN=" SNformat " last path=" SNformat, SAFESTRING(pn->path), SNvar(pn->sn), SNvar(in->branch.sn)); /* Adapter-specific select routine? */ if ( in->iroutines.select != NO_SELECT_ROUTINE ) { LEVEL_DEBUG("Use adapter-specific select routine"); return (in->iroutines.select) (pn); } /* Very messy, we may need to clear all the DS2409 couplers up the the current branch */ if (RootNotBranch(pn)) { /* no branches, overdrive possible */ if (in->branch.branch != eBranch_bad ) { // need clear root branch */ LEVEL_DEBUG("Clearing root branch"); BUS_select_closing(pn) ; } else { LEVEL_DEBUG("Continuing root branch"); //BUS_reselect_branch(pn) ; } in->branch.branch = eBranch_bad; // flag as no branches turned on if (in->overdrive) { // overdrive? sent[0] = _1W_OVERDRIVE_MATCH_ROM; } } else { if ( (memcmp(in->branch.sn, pn->bp[ds2409_depth - 1].sn, SERIAL_NUMBER_SIZE) != 0) || ( in->branch.branch != pn->bp[ds2409_depth - 1].branch) ) { /* different path */ LEVEL_DEBUG("Clearing all branches to level %d", ds2409_depth); BUS_select_closing(pn) ; } else { LEVEL_DEBUG("Reselecting branch at level %d", ds2409_depth); //BUS_reselect_branch(pn) ; } memcpy(in->branch.sn, pn->bp[ds2409_depth - 1].sn, SERIAL_NUMBER_SIZE); in->branch.branch = pn->bp[ds2409_depth - 1].branch; } if ( BAD( BUS_select_opening(pn) ) ) { in->branch.branch = eBranch_bad ; return gbBAD ; } /* proper path now "turned on" */ if ((pn->selected_device != NO_DEVICE) && (pn->selected_device != DeviceThermostat)) { memcpy(&sent[1], pn->sn, SERIAL_NUMBER_SIZE); if ( BAD(BUS_send_data(sent, 1+SERIAL_NUMBER_SIZE, pn))) { STAT_ADD1_BUS(e_bus_select_errors, in); LEVEL_CONNECT("Select error for %s on bus %s", pn->selected_device->readable_name, SOC(in)->devicename); return gbBAD; } } return gbGOOD; } static GOOD_OR_BAD BUS_Skip_Rom(const struct parsedname *pn) { BYTE skip[1]; struct transaction_log t[] = { TRXN_WRITE1(skip), TRXN_END, }; RETURN_BAD_IF_BAD( gbRESET( BUS_reset(pn) ) ) ; skip[0] = pn->selected_connection->overdrive ? _1W_OVERDRIVE_SKIP_ROM : _1W_SKIP_ROM; return BUS_transaction_nolock(t, pn); } /* All the railroad switches need to be opened in order */ static GOOD_OR_BAD BUS_select_opening(const struct parsedname *pn) { int level ; RETURN_BAD_IF_BAD( gbRESET( BUS_reset(pn) ) ) ; for ( level=0 ; level<(int)pn->ds2409_depth ; ++level ) { RETURN_BAD_IF_BAD( BUS_select_subbranch(&(pn->bp[level]), pn) ) ; } return gbGOOD ; } /* All need to be closed at every level */ static GOOD_OR_BAD BUS_select_closing(const struct parsedname *pn) { int turnoff_level ; // step through turning off levels for ( turnoff_level=0 ; turnoff_level<=(int)pn->ds2409_depth ; ++turnoff_level ) { int level ; RETURN_BAD_IF_BAD( gbRESET( BUS_reset(pn) ) ) ; RETURN_BAD_IF_BAD(Turnoff(pn) ) ; for ( level=0 ; levelbp[level]), pn) ) ; } } return gbGOOD ; } /* Select the specific branch */ static GOOD_OR_BAD BUS_select_subbranch(const struct ds2409_hubs *bp, const struct parsedname *pn) { BYTE sent[11] = { _1W_MATCH_ROM, }; BYTE resp[2]; struct transaction_log t[] = { TRXN_WRITE(sent, 11), TRXN_READ2(resp), TRXN_END, }; // bp->branch has an index into the branch (main=0, aux=1) set in Parsename from the DS2409 file data field. memcpy(&sent[1], bp->sn, SERIAL_NUMBER_SIZE); //We'll test the range here for safety switch( bp->branch ) { case eBranch_main: sent[SERIAL_NUMBER_SIZE+1] = _1W_SMART_ON_MAIN; break ; case eBranch_aux: sent[SERIAL_NUMBER_SIZE+1] = _1W_SMART_ON_AUX; break; default: LEVEL_DEBUG("Calling illegal branch path"); return gbBAD ; } sent[SERIAL_NUMBER_SIZE+2] = 0xFF; // Response to "Smart-ON" commands: // first byte reset status (which we ignore) // second byte, echo of smart-on command (which we test) LEVEL_DEBUG("Selecting subbranch " SNformat, SNvar(bp->sn)); if ( BAD(BUS_transaction_nolock(t, pn)) || (resp[1] != sent[SERIAL_NUMBER_SIZE+1])) { STAT_ADD1_BUS(e_bus_select_errors, pn->selected_connection); LEVEL_CONNECT("Select subbranch error on bus %s", SOC(pn->selected_connection)->devicename); return gbBAD; } //printf("subbranch stop\n"); return gbGOOD; } /* find every DS2409 (family code 1F) and switch off, at this depth */ static GOOD_OR_BAD Turnoff(const struct parsedname *pn) { BYTE sent[2] = { _1W_SKIP_ROM, _1W_ALL_LINES_OFF, }; struct transaction_log t[] = { TRXN_WRITE2(sent), TRXN_END, }; //printf("Attempting turnoff\n"); return BUS_transaction_nolock(t, pn); } owfs-2.8p15/module/owlib/src/c/ow_transaction.c0000644000175000017500000003271211716535456016442 00000000000000/* $Id: ow_transaction.c,v 1.47 2012/02/14 19:51:10 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include struct transaction_bundle { const struct transaction_log *start; int packets; size_t max_size; struct memblob mb; int select_first; }; // static int BUS_transaction_length( const struct transaction_log * tl, const struct parsedname * pn ) ; static GOOD_OR_BAD BUS_transaction_single(const struct transaction_log *t, const struct parsedname *pn); static GOOD_OR_BAD Bundle_pack(const struct transaction_log *tl, const struct parsedname *pn); static GOOD_OR_BAD Pack_item(const struct transaction_log *tl, struct transaction_bundle *tb); static GOOD_OR_BAD Bundle_ship(struct transaction_bundle *tb, const struct parsedname *pn); static GOOD_OR_BAD Bundle_enroute(struct transaction_bundle *tb, const struct parsedname *pn); static GOOD_OR_BAD Bundle_unpack(struct transaction_bundle *tb); static void Bundle_init(struct transaction_bundle *tb, const struct parsedname *pn); #define TRANSACTION_INCREMENT 1000 /* Bus transaction */ /* Encapsulates communication with a device, including locking the bus, reset and selection */ /* Then a series of bytes is sent and returned, including sending data and reading the return data */ GOOD_OR_BAD BUS_transaction(const struct transaction_log *tl, const struct parsedname *pn) { GOOD_OR_BAD ret ; if (tl == NULL) { return gbGOOD; } BUSLOCK(pn); ret = BUS_transaction_nolock(tl, pn); BUSUNLOCK(pn); return ret; } GOOD_OR_BAD BUS_transaction_nolock(const struct transaction_log *tl, const struct parsedname *pn) { const struct transaction_log *t = tl; GOOD_OR_BAD ret = gbGOOD; if (pn->selected_connection->iroutines.flags & ADAP_FLAG_bundle) { return Bundle_pack(tl, pn); } do { //printf("Transact type=%d\n",t->type) ; ret = BUS_transaction_single(t, pn); if (ret == gbOTHER) { // trxn_done flag ret = gbGOOD; // restore no error code break; // but stop looping anyways } ++t; } while ( GOOD(ret) ); return ret; } static GOOD_OR_BAD BUS_transaction_single(const struct transaction_log *t, const struct parsedname *pn) { GOOD_OR_BAD ret = gbGOOD; switch (t->type) { case trxn_select: // select a 1-wire device (by unique ID) ret = BUS_select(pn); LEVEL_DEBUG("select = %d", ret); break; case trxn_compare: // match two strings -- no actual 1-wire if ((t->in == NULL) || (t->out == NULL) || (memcmp(t->in, t->out, t->size) != 0)) { ret = gbBAD; } LEVEL_DEBUG("compare = %d", ret); break; case trxn_bitcompare: // match two strings -- no actual 1-wire if ((t->in == NULL) || (t->out == NULL) || BAD( BUS_compare_bits( t->in, t->out, t->size)) ) { ret = gbBAD; } LEVEL_DEBUG("compare = %d", ret); break; case trxn_match: // send data and compare response assert(t->in == NULL); // else use trxn_compare if (t->size == 0) { /* ignore for both cases */ break; } else { ret = BUS_send_data(t->out, t->size, pn); LEVEL_DEBUG("send = %d", ret); } break; case trxn_bitmatch: // send data and compare response assert(t->in == NULL); // else use trxn_compare if (t->size == 0) { /* ignore for both cases */ break; } else { ret = BUS_send_bits(t->out, t->size, pn); LEVEL_DEBUG("send bits = %d", ret); } break; case trxn_read: assert(t->out == NULL); // pure read if (t->size == 0) { /* ignore for all cases */ break; } else if (t->out == NULL) { ret = BUS_readin_data(t->in, t->size, pn); LEVEL_DEBUG("readin = %d", ret); } break; case trxn_bitread: assert(t->out == NULL); // pure read if (t->size == 0) { /* ignore for all cases */ break; } else if (t->out == NULL) { ret = BUS_readin_bits(t->in, t->size, pn); LEVEL_DEBUG("readin bits = %d", ret); } break; case trxn_modify: // write data and read response. No match needed ret = BUS_sendback_data(t->out, t->in, t->size, pn); LEVEL_DEBUG("modify = %d", ret); break; case trxn_bitmodify: // write data and read response. No match needed ret = BUS_sendback_bits(t->out, t->in, t->size, pn); LEVEL_DEBUG("bit modify = %d", ret); break; case trxn_blind: // write data ignore response { BYTE *dummy = owmalloc(t->size); if (dummy != NULL) { ret = BUS_sendback_data(t->out, dummy, t->size, pn); owfree(dummy); } else { ret = gbBAD; } } LEVEL_DEBUG("blind = %d", ret); break; case trxn_power: ret = BUS_PowerByte(t->out[0], t->in, t->size, pn); LEVEL_DEBUG("power (%d usec) = %d", t->size, ret); break; case trxn_bitpower: ret = BUS_PowerBit(t->out[0], t->in, t->size, pn); LEVEL_DEBUG("power bit (%d usec) = %d", t->size, ret); break; case trxn_program: ret = BUS_ProgramPulse(pn); LEVEL_DEBUG("program pulse = %d", ret); break; case trxn_crc8: ret = CRC8(t->out, t->size); LEVEL_DEBUG("CRC8 = %d", ret); break; case trxn_crc8seeded: ret = CRC8seeded(t->out, t->size, ((UINT *) (t->in))[0]); LEVEL_DEBUG("seeded CRC8 = %d", ret); break; case trxn_crc16: ret = CRC16(t->out, t->size); LEVEL_DEBUG("CRC16 = %d", ret); break; case trxn_crc16seeded: ret = CRC16seeded(t->out, t->size, ((UINT *) (t->in))[0]); LEVEL_DEBUG("seeded CRC16 = %d", ret); break; case trxn_delay: if (t->size > 0) { UT_delay(t->size); } LEVEL_DEBUG("Delay %d", t->size); break; case trxn_udelay: if (t->size > 0) { UT_delay_us(t->size); } LEVEL_DEBUG("Micro Delay %d", t->size); break; case trxn_reset: ret = BUS_reset(pn)==BUS_RESET_OK ? gbGOOD : gbBAD; LEVEL_DEBUG("reset = %d", ret); break; case trxn_end: LEVEL_DEBUG("end = %d", ret); return gbOTHER; // special "end" flag case trxn_verify: { struct parsedname pn2; memcpy(&pn2, pn, sizeof(struct parsedname)); //shallow copy pn2.selected_device = NO_DEVICE; if ( BAD( BUS_select(&pn2) )) { ret = gbBAD ; } else if ( BAD(BUS_verify(t->size, pn) )) { ret = gbBAD ; } else { ret = gbGOOD; } LEVEL_DEBUG("verify = %d", ret); } break; case trxn_nop: ret = gbGOOD; break; } return ret; } // initialize the bundle static void Bundle_init(struct transaction_bundle *tb, const struct parsedname *pn) { memset(tb, 0, sizeof(struct transaction_bundle)); MemblobInit(&tb->mb, TRANSACTION_INCREMENT); tb->max_size = pn->selected_connection->bundling_length; } static GOOD_OR_BAD Bundle_pack(const struct transaction_log *tl, const struct parsedname *pn) { const struct transaction_log *t_index; struct transaction_bundle s_tb; struct transaction_bundle *tb = &s_tb; Bundle_init(tb, pn); for (t_index = tl; t_index->type != trxn_end; ++t_index) { switch (Pack_item(t_index, tb)) { case gbGOOD: LEVEL_DEBUG("Item added"); break; case gbBAD: LEVEL_DEBUG("Item cannot be bundled"); RETURN_BAD_IF_BAD(Bundle_ship(tb, pn)) ; RETURN_BAD_IF_BAD(BUS_transaction_single(t_index, pn)) ; break; case gbOTHER: LEVEL_DEBUG("Item too big"); RETURN_BAD_IF_BAD(Bundle_ship(tb, pn)) ; if ( GOOD( Pack_item(t_index, tb) ) ) { break; } RETURN_BAD_IF_BAD(BUS_transaction_single(t_index, pn)) ; break; } } return Bundle_ship(tb, pn); } // Take a bundle, execute the transaction, unpack, and clear the memoblob static GOOD_OR_BAD Bundle_ship(struct transaction_bundle *tb, const struct parsedname *pn) { LEVEL_DEBUG("Ship Packets=%d", tb->packets); if (tb->packets == 0) { return gbGOOD; } if ( BAD( Bundle_enroute(tb, pn) ) ) { // clear the bundle MemblobClear(&tb->mb); tb->packets = 0; tb->select_first = 0; return gbBAD; } return Bundle_unpack(tb); } // Execute a bundle transaction (actual bytes on 1-wire bus) static GOOD_OR_BAD Bundle_enroute(struct transaction_bundle *tb, const struct parsedname *pn) { if (tb->select_first) { return BUS_select_and_sendback(MemblobData(&(tb->mb)), MemblobData(&(tb->mb)), MemblobLength(&(tb->mb)), pn); } else { return BUS_sendback_data(MemblobData(&(tb->mb)), MemblobData(&(tb->mb)), MemblobLength(&(tb->mb)), pn); } } /* See if the item can be packed return gbBAD -- cannot be packed at all return gbOTHER -- should be at start return gbGOOD -- added successfully */ static GOOD_OR_BAD Pack_item(const struct transaction_log *tl, struct transaction_bundle *tb) { GOOD_OR_BAD ret = 0; //default return value for good packets; //printf("PACK_ITEM used=%d size=%d max=%d\n",MemblobLength(&(tl>mb)),tl->size,tb->max_size); switch (tl->type) { case trxn_select: // select a 1-wire device (by unique ID) LEVEL_DEBUG("pack=SELECT"); if (tb->packets != 0) { return gbOTHER; // select must be first } tb->select_first = 1; break; case trxn_compare: // match two strings -- no actual 1-wire case trxn_bitcompare: // match two strings -- no actual 1-wire LEVEL_DEBUG("pack=COMPARE"); break; case trxn_read: case trxn_bitread: LEVEL_DEBUG(" pack=READ"); if (tl->size > tb->max_size) { return gbBAD; // too big for any bundle } if (tl->size + MemblobLength(&(tb->mb)) > tb->max_size) { return gbOTHER; // too big for this partial bundle } if (MemblobAddChar(0xFF, tl->size, &tb->mb)) { return gbBAD; } break; case trxn_match: // write data and match response case trxn_bitmatch: // write data and match response case trxn_modify: // write data and read response. No match needed case trxn_bitmodify: // write data and read response. No match needed case trxn_blind: // write data and ignore response LEVEL_DEBUG("pack=MATCH MODIFY BLIND"); if (tl->size > tb->max_size) { return gbBAD; // too big for any bundle } if (tl->size + MemblobLength(&(tb->mb)) > tb->max_size) { return gbOTHER; // too big for this partial bundle } if (MemblobAdd(tl->out, tl->size, &tb->mb)) { return gbBAD; } break; case trxn_power: case trxn_bitpower: case trxn_program: LEVEL_DEBUG("pack=POWER PROGRAM"); if (1 > tb->max_size) { return gbBAD; // too big for any bundle } if (1 + MemblobLength(&(tb->mb)) > tb->max_size) { return gbOTHER; // too big for this partial bundle } if (MemblobAdd(tl->out, 1, &tb->mb)) { return gbBAD; } ret = gbGOOD; // needs delay break; case trxn_crc8: case trxn_crc8seeded: case trxn_crc16: case trxn_crc16seeded: LEVEL_DEBUG("pack=CRC*"); break; case trxn_delay: case trxn_udelay: LEVEL_DEBUG("pack=(U)DELAYS"); ret = gbGOOD; break; case trxn_reset: case trxn_end: case trxn_verify: LEVEL_DEBUG("pack=RESET END VERIFY"); return gbBAD; case trxn_nop: LEVEL_DEBUG("pack=NOP"); break; } if (tb->packets == 0) { tb->start = tl; } ++tb->packets; return ret; } static GOOD_OR_BAD Bundle_unpack(struct transaction_bundle *tb) { int packet_index; const struct transaction_log *tl; BYTE *data = MemblobData(&(tb->mb)); GOOD_OR_BAD ret = gbGOOD; LEVEL_DEBUG("unpacking"); for (packet_index = 0, tl = tb->start; packet_index < tb->packets; ++packet_index, ++tl) { switch (tl->type) { case trxn_compare: // match two strings -- no actual 1-wire LEVEL_DEBUG("unpacking #%d COMPARE", packet_index); if ((tl->in == NULL) || (tl->out == NULL) || (memcmp(tl->in, tl->out, tl->size) != 0)) { ret = gbBAD; } break; case trxn_bitcompare: // match two strings -- no actual 1-wire if ((tl->in == NULL) || (tl->out == NULL) || BAD( BUS_compare_bits( tl->in, tl->out, tl->size)) ) { ret = gbBAD; } break ; case trxn_match: // send data and compare response LEVEL_DEBUG("unpacking #%d MATCH", packet_index); if (memcmp(tl->out, data, tl->size) != 0) { ret = gbBAD; } data += tl->size; break; case trxn_read: case trxn_modify: // write data and read response. No match needed LEVEL_DEBUG("unpacking #%d READ MODIFY", packet_index); memmove(tl->in, data, tl->size); data += tl->size; break; case trxn_blind: LEVEL_DEBUG("unpacking #%d BLIND", packet_index); data += tl->size; break; case trxn_power: case trxn_program: LEVEL_DEBUG("unpacking #%d POWER PROGRAM", packet_index); memmove(tl->in, data, 1); data += 1; UT_delay(tl->size); break; case trxn_crc8: LEVEL_DEBUG("unpacking #%d CRC8", packet_index); if (CRC8(tl->out, tl->size) != 0) { ret = gbBAD; } break; case trxn_crc8seeded: LEVEL_DEBUG("unpacking #%d CRC8 SEEDED", packet_index); if (CRC8seeded(tl->out, tl->size, ((UINT *) (tl->in))[0]) != 0) { ret = gbBAD; } break; case trxn_crc16: LEVEL_DEBUG("unpacking #%d CRC16", packet_index); if (CRC16(tl->out, tl->size) != 0) { ret = gbBAD; } break; case trxn_crc16seeded: LEVEL_DEBUG("unpacking #%d CRC16 SEEDED", packet_index); if (CRC16seeded(tl->out, tl->size, ((UINT *) (tl->in))[0]) != 0) { ret = gbBAD; } break; case trxn_delay: LEVEL_DEBUG("unpacking #%d DELAY", packet_index); UT_delay(tl->size); break; case trxn_udelay: LEVEL_DEBUG("unpacking #%d UDELAY", packet_index); UT_delay_us(tl->size); break; case trxn_reset: case trxn_end: case trxn_verify: // should never get here LEVEL_DEBUG("unpacking #%d RESET END VERIFY", packet_index); ret = gbBAD; break; case trxn_nop: case trxn_select: LEVEL_DEBUG("unpacking #%d NOP or SELECT", packet_index); break; } if ( BAD(ret) ) { break; } } // clear the bundle MemblobClear(&tb->mb); tb->packets = 0; tb->select_first = 0; return ret; } owfs-2.8p15/module/owlib/src/c/ow_printparse.c0000644000175000017500000000212711667561164016301 00000000000000/* $Id: ow_printparse.c,v 1.8 2011/12/07 03:50:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" void _print_owq(struct one_wire_query *owq) { char c[32]; fprintf(stderr,"OWQ OneWireQuery structure of %s\n", PN(owq)->path); fprintf(stderr," OneWireQuery size=%lu offset=%lu, extension=%d\n", (unsigned long) OWQ_size(owq), (unsigned long) OWQ_offset(owq), (int) OWQ_pn(owq).extension); if ( OWQ_buffer(owq) != NULL ) { Debug_Bytes("OneWireQuery buffer", (BYTE *) OWQ_buffer(owq), OWQ_size(owq)); } fprintf(stderr," Cleanup = %.4X",OWQ_cleanup(owq)); fprintf(stderr," OneWireQuery I=%d U=%u F=%G Y=%d D=%s\n", OWQ_I(owq), OWQ_U(owq), OWQ_F(owq), OWQ_Y(owq), SAFESTRING(ctime_r(&OWQ_D(owq), c))); fprintf(stderr,"--- OneWireQuery done\n"); } owfs-2.8p15/module/owlib/src/c/ow_lcd.c0000644000175000017500000004311611740076517014652 00000000000000/* $Id: ow_lcd.c,v 1.75 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_lcd.h" /* ------- Prototypes ----------- */ /* LCD display */ READ_FUNCTION(FS_r_version); READ_FUNCTION(FS_r_counters); READ_FUNCTION(FS_r_gpio); WRITE_FUNCTION(FS_w_gpio); READ_FUNCTION(FS_r_data); WRITE_FUNCTION(FS_w_data); READ_FUNCTION(FS_r_memory); WRITE_FUNCTION(FS_w_memory); READ_FUNCTION(FS_r_register); WRITE_FUNCTION(FS_w_register); WRITE_FUNCTION(FS_simple_command); #if OW_CACHE READ_FUNCTION(FS_r_cum); WRITE_FUNCTION(FS_w_cum); #endif /* OW_CACHE */ WRITE_FUNCTION(FS_w_screenX); WRITE_FUNCTION(FS_w_lineX); /* ------- Device Constants ----- */ #define _LCD_COMMAND_POWER_OFF 0x05 #define _LCD_COMMAND_POWER_ON 0x03 #define _LCD_COMMAND_BACKLIGHT_OFF 0x07 #define _LCD_COMMAND_BACKLIGHT_ON 0x08 #define _LCD_COMMAND_REGISTER_TO_SCRATCH 0x11 #define _LCD_COMMAND_REGISTER_WRITE_BYTE 0x10 #define _LCD_COMMAND_DATA_TO_SCRATCH 0x13 #define _LCD_COMMAND_DATA_WRITE_BYTE 0x12 #define _LCD_COMMAND_SCRATCHPAD_READ 0xBE #define _LCD_COMMAND_SCRATCHPAD_WRITE 0x4E #define _LCD_COMMAND_PRINT_FROM_SCRATCH 0x48 #define _LCD_COMMAND_EEPROM_READ_TO_SCRATCH 0x37 #define _LCD_COMMAND_EEPROM_WRITE_FROM_SCRATCH 0x39 #define _LCD_COMMAND_GPIO_READ_TO_SCRATCH 0x22 #define _LCD_COMMAND_GPIO_WRITE_BYTE 0x21 #define _LCD_COMMAND_COUNTER_READ_TO_SCRATCH 0x23 #define _LCD_COMMAND_LCD_CLEAR 0x49 #define _LCD_COMMAND_VERSION_READ_TO_SCRATCH 0x41 #define _LCD_PAGE_SIZE 16 #define PACK_ON_OFF(on,off) (((unsigned int)((BYTE)(on))<<8) | ((unsigned int)((BYTE)(off)))) #define UNPACK_ON(u) ((BYTE)((u)>>8)) #define UNPACK_OFF(u) ((BYTE)((u)&0xFF)) /* ------- Structures ----------- */ static struct aggregate ALCD = { 4, ag_numbers, ag_aggregate, }; static struct aggregate ALCD_L16 = { 4, ag_numbers, ag_separate, }; static struct aggregate ALCD_L20 = { 4, ag_numbers, ag_separate, }; static struct aggregate ALCD_L40 = { 2, ag_numbers, ag_separate, }; static struct filetype LCD[] = { F_STANDARD, {"memory", 112, NON_AGGREGATE, ft_binary, fc_stable, FS_r_memory, FS_w_memory, VISIBLE, NO_FILETYPE_DATA, }, {"LCDon", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_simple_command, VISIBLE, {u:PACK_ON_OFF(_LCD_COMMAND_POWER_ON, _LCD_COMMAND_POWER_OFF)}, }, {"backlight", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_simple_command, VISIBLE, {u:PACK_ON_OFF(_LCD_COMMAND_BACKLIGHT_ON, _LCD_COMMAND_BACKLIGHT_OFF)}, }, {"version", _LCD_PAGE_SIZE, NON_AGGREGATE, ft_ascii, fc_stable, FS_r_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"gpio", PROPERTY_LENGTH_BITFIELD, &ALCD, ft_bitfield, fc_volatile, FS_r_gpio, FS_w_gpio, VISIBLE, NO_FILETYPE_DATA, }, {"register", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_register, FS_w_register, VISIBLE, NO_FILETYPE_DATA, }, {"data", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_data, FS_w_data, VISIBLE, NO_FILETYPE_DATA, }, {"counters", PROPERTY_LENGTH_UNSIGNED, &ALCD, ft_unsigned, fc_volatile, FS_r_counters, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, #if OW_CACHE {"cumulative", PROPERTY_LENGTH_UNSIGNED, &ALCD, ft_unsigned, fc_volatile, FS_r_cum, FS_w_cum, VISIBLE, NO_FILETYPE_DATA, }, #endif /*OW_CACHE */ {"screen16", 128, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_screenX, VISIBLE, {i:16}, }, {"screen20", 128, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_screenX, VISIBLE, {i:20}, }, {"screen40", 128, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_screenX, VISIBLE, {i:40}, }, {"line16", 16, &ALCD_L16, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_lineX, VISIBLE, {i:16}, }, {"line20", 20, &ALCD_L20, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_lineX, VISIBLE, {i:20}, }, {"line40", 40, &ALCD_L40, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_w_lineX, VISIBLE, {i:40}, }, }; DeviceEntryExtended(FF, LCD, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ /* LCD by L. Swart */ static GOOD_OR_BAD OW_r_scratch(BYTE * data, int length, const struct parsedname *pn); static GOOD_OR_BAD OW_w_scratch(const BYTE * data, int length, const struct parsedname *pn); static GOOD_OR_BAD OW_w_register(BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_register(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_data(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_data(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_gpio(BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_gpio(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_version(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_counters(UINT * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_memory(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_memory(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_clear(const struct parsedname *pn); static GOOD_OR_BAD OW_w_screen(BYTE lcd_location, const char *text, int size, const struct parsedname *pn); static GOOD_OR_BAD LCD_byte(BYTE b, int delay, const struct parsedname *pn); static GOOD_OR_BAD LCD_2byte(BYTE * bytes, int delay, const struct parsedname *pn); static GOOD_OR_BAD OW_simple_command(BYTE lcd_command_code, const struct parsedname *pn); static GOOD_OR_BAD OW_w_unpaged_to_screen(BYTE lcd_location, BYTE length, const char *text, const struct parsedname *pn); /* Internal files */ Make_SlaveSpecificTag(CUM, fc_persistent); //cumulative /* LCD */ static ZERO_OR_ERROR FS_simple_command(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT lcd_command_pair = (UINT) pn->selected_filetype->data.u; BYTE lcd_command_code = OWQ_Y(owq) ? UNPACK_ON(lcd_command_pair) : UNPACK_OFF(lcd_command_pair); return GB_to_Z_OR_E(OW_simple_command(lcd_command_code, pn)) ; } static ZERO_OR_ERROR FS_r_version(struct one_wire_query *owq) { BYTE v[_LCD_PAGE_SIZE]; RETURN_ERROR_IF_BAD( OW_r_version(v, PN(owq)) ) ; return OWQ_format_output_offset_and_size((ASCII *) v, _LCD_PAGE_SIZE, owq); } static ZERO_OR_ERROR FS_r_gpio(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD( OW_r_gpio(&data, PN(owq)) ); OWQ_U(owq) = (~data) & 0x0F; return 0; } /* 4 value array */ static ZERO_OR_ERROR FS_w_gpio(struct one_wire_query *owq) { BYTE data = ~OWQ_U(owq) & 0x0F; /* Now set pins */ return GB_to_Z_OR_E(OW_w_gpio(data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_register(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD( OW_r_register(&data, PN(owq)) ) ; OWQ_U(owq) = data; return 0; } static ZERO_OR_ERROR FS_w_register(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_register((BYTE) (BYTE_MASK(OWQ_U(owq))), PN(owq))) ; } static ZERO_OR_ERROR FS_r_data(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD( OW_r_data(&data, PN(owq)) ) ; OWQ_U(owq) = data; return 0; } static ZERO_OR_ERROR FS_w_data(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_data((BYTE) (BYTE_MASK(OWQ_U(owq))), PN(owq))) ; } static ZERO_OR_ERROR FS_r_counters(struct one_wire_query *owq) { UINT u[4]; RETURN_ERROR_IF_BAD( OW_r_counters(u, PN(owq)) ) ; OWQ_array_U(owq, 0) = u[0]; OWQ_array_U(owq, 1) = u[1]; OWQ_array_U(owq, 2) = u[2]; OWQ_array_U(owq, 3) = u[3]; return 0; } #if OW_CACHE /* Special code for cumulative counters -- read/write -- uses the caching system for storage */ static ZERO_OR_ERROR FS_r_cum(struct one_wire_query *owq) { UINT u[4]; /* just to prime the "CUM" data */ RETURN_ERROR_IF_BAD( OW_r_counters(u, PN(owq)) ) ; if ( BAD( Cache_Get_SlaveSpecific((void *) u, 4 * sizeof(UINT), SlaveSpecificTag(CUM), PN(owq))) ) { return -EINVAL; } OWQ_array_U(owq, 0) = u[0]; OWQ_array_U(owq, 1) = u[1]; OWQ_array_U(owq, 2) = u[2]; OWQ_array_U(owq, 3) = u[3]; return 0; } static ZERO_OR_ERROR FS_w_cum(struct one_wire_query *owq) { UINT u[4] = { OWQ_array_U(owq, 0), OWQ_array_U(owq, 1), OWQ_array_U(owq, 2), OWQ_array_U(owq, 3), }; return GB_to_Z_OR_E( Cache_Add_SlaveSpecific((const void *) u, 4 * sizeof(UINT), SlaveSpecificTag(CUM), PN(owq)) ); } #endif /*OW_CACHE */ static ZERO_OR_ERROR FS_w_lineX(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int width = pn->selected_filetype->data.i; BYTE lcd_line_start[] = { 0x00, 0x40, 0x00 + width, 0x40 + width }; char line[width]; size_t size = OWQ_size(owq); int start = OWQ_offset(owq); if (start >= width) { return -EADDRNOTAVAIL; } if ((int) (start + size) > width) { size = width - start; } memset(line, ' ', width); memcpy(&line[start], OWQ_buffer(owq), size); return GB_to_Z_OR_E(OW_w_screen(lcd_line_start[pn->extension], line, width, pn)) ; } static ZERO_OR_ERROR FS_w_screenX(struct one_wire_query *owq) { struct one_wire_query * owq_line ; int extension; struct parsedname *pn = PN(owq); int width = pn->selected_filetype->data.i; int rows = (width == 40) ? 2 : 4; /* max number of rows */ char *start_of_remaining_text = OWQ_buffer(owq); char *pointer_after_all_text = OWQ_buffer(owq) + OWQ_size(owq); if (OWQ_offset(owq)) { return -ERANGE; } if (BAD( OW_clear(pn) ) ) { return -EFAULT; } owq_line = OWQ_create_separate( 0, owq ) ; if ( owq_line == NO_ONE_WIRE_QUERY ) { return -ENOMEM ; } for (extension = 0; extension < rows; ++extension) { char *newline_location = memchr(start_of_remaining_text, '\n', pointer_after_all_text - start_of_remaining_text); OWQ_pn(owq_line).extension = extension; OWQ_buffer(owq_line) = start_of_remaining_text; if ((newline_location != NULL) && (newline_location < start_of_remaining_text + width)) { OWQ_size(owq_line) = newline_location - start_of_remaining_text; start_of_remaining_text = newline_location + 1; /* skip over newline */ } else { char *lineend_location = start_of_remaining_text + width; if (lineend_location > pointer_after_all_text) { lineend_location = pointer_after_all_text; } OWQ_size(owq_line) = lineend_location - start_of_remaining_text; start_of_remaining_text = lineend_location; } if (FS_w_lineX(owq_line)) { OWQ_destroy( owq_line ) ; return -EINVAL; } if (start_of_remaining_text >= pointer_after_all_text) break; } OWQ_destroy( owq_line ) ; return 0; } static ZERO_OR_ERROR FS_r_memory(struct one_wire_query *owq) { return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, _LCD_PAGE_SIZE, OW_r_memory)) ; } static ZERO_OR_ERROR FS_w_memory(struct one_wire_query *owq) { return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, _LCD_PAGE_SIZE, OW_w_memory)) ; } static GOOD_OR_BAD OW_w_scratch(const BYTE * data, int length, const struct parsedname *pn) { BYTE write_command[1] = { _LCD_COMMAND_SCRATCHPAD_WRITE, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(write_command), TRXN_WRITE(data, length), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_r_scratch(BYTE * data, int length, const struct parsedname *pn) { BYTE read_command[1] = { _LCD_COMMAND_SCRATCHPAD_READ, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(read_command), TRXN_READ(data, length), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_w_register(BYTE data, const struct parsedname *pn) { BYTE w[] = { _LCD_COMMAND_REGISTER_WRITE_BYTE, data, }; // 100uS return LCD_2byte(w, 1, pn); } static GOOD_OR_BAD OW_r_register(BYTE * data, const struct parsedname *pn) { // 150uS RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_REGISTER_TO_SCRATCH, 1, pn)) ; return OW_r_scratch(data, 1, pn) ; } static GOOD_OR_BAD OW_w_data(const BYTE data, const struct parsedname *pn) { BYTE w[] = { _LCD_COMMAND_DATA_WRITE_BYTE, data, }; // 100uS return LCD_2byte(w, 1, pn); } static GOOD_OR_BAD OW_r_data(BYTE * data, const struct parsedname *pn) { // 150uS RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_DATA_TO_SCRATCH, 1, pn)) ; return OW_r_scratch(data, 1, pn) ; } static GOOD_OR_BAD OW_w_gpio(BYTE data, const struct parsedname *pn) { /* Note, it would be nice to control separately, nut we can't know the set state of the pin, i.e. sensed and set are confused */ /* Datasheet says bit 7 should be 1 */ BYTE w[] = { _LCD_COMMAND_GPIO_WRITE_BYTE, 0x80 | data, }; // 20uS return LCD_2byte(w, 1, pn); } static GOOD_OR_BAD OW_r_gpio(BYTE * data, const struct parsedname *pn) { // 70uS RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_GPIO_READ_TO_SCRATCH, 1, pn)) ; return OW_r_scratch(data, 1, pn) ; } static GOOD_OR_BAD OW_r_counters(UINT * data, const struct parsedname *pn) { BYTE d[8]; UINT cum[4]; RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_COUNTER_READ_TO_SCRATCH, 1, pn)) ; RETURN_BAD_IF_BAD( OW_r_scratch(d, 8, pn)) ; data[0] = ((UINT) d[1]) << 8 | d[0]; data[1] = ((UINT) d[3]) << 8 | d[2]; data[2] = ((UINT) d[5]) << 8 | d[4]; data[3] = ((UINT) d[7]) << 8 | d[6]; //printf("OW_COUNTER key=%s\n",key); if ( BAD( Cache_Get_SlaveSpecific((void *) cum, sizeof(cum), SlaveSpecificTag(CUM), pn)) ) { /* First pass at cumulative */ cum[0] = data[0]; cum[1] = data[1]; cum[2] = data[2]; cum[3] = data[3]; } else { cum[0] += data[0]; cum[1] += data[1]; cum[2] += data[2]; cum[3] += data[3]; } Cache_Add_SlaveSpecific((void *) cum, sizeof(cum), SlaveSpecificTag(CUM), pn); return gbGOOD; } /* memory is 112 bytes */ /* can only read 16 bytes at a time (due to scratchpad size) */ /* Will pretend pagesize = 16 */ /* minor inefficiency if start is not on "page" boundary */ /* Call will not span "page" */ static GOOD_OR_BAD OW_r_memory(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE location_setup[2] = { BYTE_MASK(offset), BYTE_MASK(size), }; // 500uS RETURN_BAD_IF_BAD( OW_w_scratch(location_setup, 2, pn)) ; RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_EEPROM_READ_TO_SCRATCH, 1, pn)) ; return OW_r_scratch(data, BYTE_MASK(size), pn); } /* memory is 112 bytes */ /* can only write 16 bytes at a time (due to scratchpad size) */ /* Will pretend pagesize = 16 */ /* minor inefficiency if start is not on "page" boundary */ /* Call will not span "page" */ static GOOD_OR_BAD OW_w_memory(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE location_and_buffer[1 + _LCD_PAGE_SIZE] = { BYTE_MASK(offset), }; if (size == 0) { return gbGOOD; } memcpy(&location_and_buffer[1], data, size); // 4mS/byte RETURN_BAD_IF_BAD(OW_w_scratch(location_and_buffer, size + 1, pn)) ; return LCD_byte(_LCD_COMMAND_EEPROM_WRITE_FROM_SCRATCH, 4 * size, pn) ; } /* data is 16 bytes */ static GOOD_OR_BAD OW_r_version(BYTE * data, const struct parsedname *pn) { // 500uS RETURN_BAD_IF_BAD( LCD_byte(_LCD_COMMAND_VERSION_READ_TO_SCRATCH, 1, pn)) ; return OW_r_scratch(data, _LCD_PAGE_SIZE, pn) ; } static GOOD_OR_BAD OW_w_screen(BYTE lcd_location, const char *text, int size, const struct parsedname *pn) { int chars_left_to_print = size; while (chars_left_to_print > 0) { int current_index_in_buffer; int chars_printing_now = chars_left_to_print; if (chars_printing_now > _LCD_PAGE_SIZE) { chars_printing_now = _LCD_PAGE_SIZE; } current_index_in_buffer = size - chars_left_to_print; RETURN_BAD_IF_BAD( OW_w_unpaged_to_screen(lcd_location + current_index_in_buffer, chars_printing_now, &text[current_index_in_buffer], pn) ) ; chars_left_to_print -= chars_printing_now; } return gbGOOD; } static GOOD_OR_BAD OW_w_unpaged_to_screen(BYTE lcd_location, BYTE length, const char *text, const struct parsedname *pn) { BYTE location_and_string[1 + _LCD_PAGE_SIZE] = { lcd_location, }; memcpy(&location_and_string[1], text, length); RETURN_BAD_IF_BAD( OW_w_scratch(location_and_string, 1 + length, pn) ) ; return LCD_byte(_LCD_COMMAND_PRINT_FROM_SCRATCH, 2, pn) ; } static GOOD_OR_BAD OW_clear(const struct parsedname *pn) { /* clear */ return LCD_byte(_LCD_COMMAND_LCD_CLEAR, 3, pn); // 2.5mS } static GOOD_OR_BAD OW_simple_command(BYTE lcd_command_code, const struct parsedname *pn) { struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(&lcd_command_code), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD LCD_byte(BYTE b, int delay, const struct parsedname *pn) { struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(&b), TRXN_DELAY(delay), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD LCD_2byte(BYTE * bytes, int delay, const struct parsedname *pn) { struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(bytes), TRXN_DELAY(delay), TRXN_END, }; return BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_lib_setup.c0000644000175000017500000000160411741156523016067 00000000000000/* $Id: ow_lib_setup.c,v 1.15 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" /* For thread ID to aid exitting */ int main_threadid_init = 0 ; pthread_t main_threadid; /* All ow library setup */ void LibSetup(enum enum_program_type program_type) { Return_code_setup() ; /* Setup the multithreading synchronizing locks */ LockSetup(); Globals.program_type = program_type; #if OW_CACHE Cache_Open(); #endif /* OW_CACHE */ StateInfo.start_time = NOW_TIME; SetLocalControlFlags() ; // reset by every option and other change. errno = 0; /* set error level none */ } owfs-2.8p15/module/owlib/src/c/ow_fs_code.c0000664000175000017500000000320611352033033015471 00000000000000/* $Id: ow_fs_code.c,v 1.3 2010/03/23 03:31:39 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_code(struct one_wire_query *owq) { ASCII code[2]; struct parsedname *pn = PN(owq); num2string(code, pn->sn[0]); return OWQ_format_output_offset_and_size(code, 2, owq); } owfs-2.8p15/module/owlib/src/c/ow_ha5.c0000664000175000017500000005477411632166043014575 00000000000000/* $Id: ow_ha5.c,v 1.51 2011/09/08 16:24:03 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" //static void byteprint( const BYTE * b, int size ) ; GOOD_OR_BAD HA5_detect_parsed(struct address_pair *ap, struct connection_in *in); static RESET_TYPE HA5_reset(const struct parsedname *pn); static RESET_TYPE HA5_reset_in(struct connection_in * in) ; static RESET_TYPE HA5_reset_wrapped(struct connection_in * in) ; static enum search_status HA5_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD HA5_sendback_part(char cmd, const BYTE * data, BYTE * resp, const size_t size, struct connection_in * in) ; static GOOD_OR_BAD HA5_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD HA5_select_and_sendback(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void HA5_setroutines(struct connection_in *in); static void HA5_close(struct connection_in *in); static GOOD_OR_BAD HA5_reconnect( const struct parsedname *pn ) ; static enum search_status HA5_directory(struct device_search *ds,const struct parsedname *pn); static GOOD_OR_BAD HA5_select( const struct parsedname * pn ) ; static GOOD_OR_BAD HA5_select_wrapped( const struct parsedname * pn ) ; static GOOD_OR_BAD HA5_resync( struct connection_in * in ) ; static GOOD_OR_BAD HA5_channel_list( char * alpha_string, struct connection_in * initial_in ) ; static GOOD_OR_BAD HA5_test_channel( struct connection_in * in ) ; static GOOD_OR_BAD TestChecksum( unsigned char * check_string, int length ) ; static GOOD_OR_BAD HA5_checksum_support( struct connection_in * in ) ; static GOOD_OR_BAD HA5_find_channel( struct connection_in * in ) ; static void HA5_slurp( struct connection_in *in) ; static void HA5_flush( struct connection_in *in) ; static GOOD_OR_BAD HA5_read( BYTE * data, size_t length, struct connection_in *in) ; static GOOD_OR_BAD HA5_write( char command, char * raw_string, int length, struct connection_in * in ) ; static GOOD_OR_BAD HA5_sendback_bits(const BYTE * outbits, BYTE * inbits, const size_t length, const struct parsedname *pn) ; static GOOD_OR_BAD HA5_bit( BYTE send, BYTE * receive, struct connection_in * in ) ; #define HA5MUTEX_INIT(in) _MUTEX_INIT(in->master.ha5.all_channel_lock) #define HA5MUTEX_LOCK(in) _MUTEX_LOCK(in->master.ha5.all_channel_lock ) ; #define HA5MUTEX_UNLOCK(in) _MUTEX_UNLOCK(in->master.ha5.all_channel_lock); #define HA5MUTEX_DESTROY(in) _MUTEX_DESTROY(in->master.ha5.all_channel_lock); #define CR_char (0x0D) static void HA5_setroutines(struct connection_in *in) { in->iroutines.detect = HA5_detect; in->iroutines.reset = HA5_reset; in->iroutines.next_both = HA5_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = HA5_sendback_data; in->iroutines.sendback_bits = HA5_sendback_bits; in->iroutines.select = HA5_select ; in->iroutines.select_and_sendback = HA5_select_and_sendback; in->iroutines.reconnect = HA5_reconnect; in->iroutines.close = HA5_close; in->iroutines.flags = ADAP_FLAG_dirgulp | ADAP_FLAG_bundle | ADAP_FLAG_dir_auto_reset | ADAP_FLAG_no2404delay | ADAP_FLAG_presence_from_dirblob ; in->bundling_length = HA5_FIFO_SIZE; } GOOD_OR_BAD HA5_detect(struct connection_in *in) { struct address_pair ap ; GOOD_OR_BAD gbResult ; // default /* Set up low-level routines */ HA5_setroutines(in); /* By definition, this is the head adapter on this port */ in->master.ha5.head = in ; HA5MUTEX_INIT(in); // closed in HA5_close // Poison current "Address" for adapter memset( in->master.ha5.sn, 0x00, SERIAL_NUMBER_SIZE ) ; COM_set_standard( in ) ; // standard COM port settings // 9600 isn't valid for the HA5, so we can tell that this value was actually selected if ( Globals.baud != B9600 ) { SOC(in)->baud = Globals.baud ; } else { SOC(in)->baud = B115200 ; // works at this fast rate } // allowable speeds COM_BaudRestrict( &(SOC(in)->baud), B1200, B19200, B38400, B115200, 0 ) ; Parse_Address( SOC(in)->devicename, &ap ) ; gbResult = HA5_detect_parsed( &ap, in) ; Free_Address( &ap ) ; if ( GOOD( gbResult ) ) { HA5_slurp(in) ; HA5_reset_in(in) ; } return gbResult ; } // Detect now that the name has been parsed GOOD_OR_BAD HA5_detect_parsed(struct address_pair *ap, struct connection_in *in) { GOOD_OR_BAD gbResult ; char * channel_list = NULL ; // Create name (ip:port or /dev/tty) and optional channel list switch (SOC(in)->type) { case ct_telnet: // address:port:channel_list if ( ap->first.type != address_none ) { // IP address exists strcpy(SOC(in)->devicename, ap->first.alpha) ; // subset so will fit if ( ap->second.type != address_none ) { // Add :port strcat(SOC(in)->devicename, ":") ; // subset so will fit strcat(SOC(in)->devicename, ap->second.alpha) ; // subset so will fit } } else if ( ap->second.type != address_none ) { // just :port strcpy(SOC(in)->devicename, ap->second.alpha) ; // subset so will fit } else { // No tcp address or port specified return gbBAD ; } switch ( ap->third.type ) { case address_all: channel_list = "abcdefghijklmnopqrstuvwxyz" ; break ; case address_alpha: // Channel specified channel_list = ap->third.alpha ; break ; default: channel_list = NULL ; } break ; case ct_serial: default: // device:channel_list if ( ap->first.type != address_none ) { // device address exists strcpy(SOC(in)->devicename, ap->first.alpha) ; // subset so will fit } else { // No serial port specified return gbBAD ; } switch ( ap->second.type ) { case address_all: channel_list = "abcdefghijklmnopqrstuvwxyz" ; break ; case address_alpha: // Channel specified channel_list = ap->second.alpha ; break ; default: channel_list = NULL ; } break ; } if ( BAD(COM_open(in->master.ha5.head )) ) { // Cannot open serial port return gbBAD ; } in->master.ha5.checksum = 1 ; in->Adapter = adapter_HA5 ; in->adapter_name = "HA5"; /* Find the channels */ if ( channel_list == NULL ) { // scan for channel gbResult = HA5_find_channel(in) ; } else { // A list of channels gbResult = HA5_channel_list( channel_list, in ) ; } return gbResult; } static GOOD_OR_BAD HA5_channel_list( char * alpha_string, struct connection_in * initial_in ) { char * current_char ; int first_time = 1 ; // work-around for new USB com port struct connection_in * current_in = initial_in ; for ( current_char = alpha_string ; current_char[0]!= '\0' ; ++ current_char ) { char c = current_char[0]; if ( !isalpha(c) ) { LEVEL_DEBUG("Urecognized HA5 channel <%c>",c) ; continue ; } current_in->master.ha5.channel = tolower(c) ; LEVEL_DEBUG("Looking for HA5 adapter on %s:%c", SOC(current_in)->devicename, current_in->master.ha5.channel ) ; if ( GOOD( HA5_test_channel(current_in)) || ( first_time && GOOD( HA5_test_channel(current_in)) ) ) { // work around for new USB serial port that seems to need a repeat test first_time = 0 ; LEVEL_CONNECT("HA5 bus master FOUND on port %s at channel %c", SOC(current_in)->devicename, current_in->master.ha5.channel ) ; current_in = NewIn( initial_in ) ; // point to newer space for next candidate if ( current_in == NO_CONNECTION ) { break ; } // Only head has a valid file descriptor SOC(current_in)->file_descriptor = FILE_DESCRIPTOR_BAD ; continue ; } LEVEL_CONNECT("HA5 bus master NOT FOUND on port %s at channel %c", SOC(current_in)->devicename, c ) ; } // Now see if we've added any adapters if ( current_in == initial_in ) { LEVEL_CONNECT("No HA5 adapters found in channel(s): %s",SAFESTRING(alpha_string) ); return gbBAD ; } if ( current_in != NO_CONNECTION ) { // Remove last addition, it is blank RemoveIn( current_in ) ; } return gbGOOD ; } /* Find the HA5 channel (since none specified) */ /* Arbitrarily assign it to "a" if none found */ static GOOD_OR_BAD HA5_find_channel( struct connection_in * in ) { char test_chars[] = "aabcdefghijklmnopqrstuvwxyz" ; // note 'a' is repeated char * c ; for ( c = test_chars ; c[0] != '\0' ; ++c ) { // test char set in->master.ha5.channel = c[0] ; LEVEL_DEBUG("Looking for HA5 adapter on %s:%c", SOC(in)->devicename, in->master.ha5.channel ) ; if ( GOOD( HA5_test_channel(in)) ) { LEVEL_CONNECT("HA5 bus master FOUND on port %s at channel %c", SOC(in)->devicename, in->master.ha5.channel ) ; return gbGOOD ; } } LEVEL_DEBUG("HA5 bus master NOT FOUND on port %s", SOC(in)->devicename ) ; in->master.ha5.channel = '\0' ; return gbBAD; } static GOOD_OR_BAD HA5_write( char command, char * raw_string, int length, struct connection_in * in ) { int i ; unsigned int sum = 0 ; BYTE mod_buffer[length+5] ; // add the channel mod_buffer[0] = in->master.ha5.channel ; // Add the HA5 command mod_buffer[1] = command ; // Copy the string if ( length > 0 ) { memcpy( &mod_buffer[2], raw_string, length ) ; } // Compute a simple checksum for ( i=0 ; i mod_buffer[length+4] = CR_char ; // Write full string to the HA5 if ( BAD(COM_write( mod_buffer, length+5, in->master.ha5.head )) ) { LEVEL_DEBUG("Error with sending HA5 block") ; return gbBAD ; } return gbGOOD ; } static GOOD_OR_BAD HA5_read( BYTE * data, size_t length, struct connection_in * in) { return COM_read( data, length, in->master.ha5.head ) ; } static GOOD_OR_BAD TestChecksum( unsigned char * check_string, int length ) { int i ; unsigned char sum = 0 ; for ( i=0 ; iselected_connection ; COM_close(in->master.ha5.head ) ; RETURN_BAD_IF_BAD( COM_open(in->master.ha5.head ) ) ; return HA5_test_channel( in ) ; } // test char already set static GOOD_OR_BAD HA5_test_channel( struct connection_in * in ) { HA5_slurp(in) ; RETURN_BAD_IF_BAD( HA5_checksum_support(in) ) ; if ( HA5_reset_wrapped( in ) == BUS_RESET_OK ) { return gbGOOD ; } LEVEL_DEBUG("Succeed despite bad reset"); return gbGOOD ; } static void HA5_slurp( struct connection_in * in ) { COM_slurp( in->master.ha5.head ) ; } static void HA5_flush( struct connection_in * in ) { COM_flush( in->master.ha5.head ) ; } // test char already set static GOOD_OR_BAD HA5_checksum_support( struct connection_in * in ) { BYTE resp[3] = { 'X', 'X', 'X', } ; // write a BYTE and see if any response (device present) // and then see if a checksum is included in the response if ( BAD(HA5_write( 'W', "01FF", 4, in)) ) { LEVEL_DEBUG("Error sending Bit"); return gbBAD; } if ( BAD(HA5_read(resp, 3, in)) ) { LEVEL_DEBUG("Error reading bit response"); return gbBAD; } if ( resp[2] == 0x0D ) { in->master.ha5.checksum = 0 ; LEVEL_DETAIL("HA5 %s in NON-CHECKSUM mode",SAFESTRING(SOC(in)->devicename)); return gbGOOD ; } else if ( resp[2] == 'X' ) { // nothing actually read return gbBAD ; } resp[0] = 'X' ; resp[1] = 'X' ; if ( BAD(HA5_read(resp, 2, in)) ) { LEVEL_DEBUG("Error reading Bit checksum"); return gbBAD; } if ( resp[1] != 0x0D ) { LEVEL_DEBUG("Bad response"); return gbBAD ; } in->master.ha5.checksum = 1 ; LEVEL_DETAIL("HA5 %s in CHECKSUM mode",SAFESTRING(SOC(in)->devicename)); return gbGOOD ; } static RESET_TYPE HA5_reset(const struct parsedname *pn) { return HA5_reset_in( pn->selected_connection ) ; } static RESET_TYPE HA5_reset_in( struct connection_in * in ) { RESET_TYPE ret ; HA5MUTEX_LOCK( in->master.ha5.head ) ; ret = HA5_reset_wrapped(in) ; HA5MUTEX_UNLOCK( in->master.ha5.head ) ; return ret ; } static RESET_TYPE HA5_reset_wrapped( struct connection_in * in ) { BYTE resp[2] = { 'X', 'X', } ; if ( BAD(HA5_write( 'R', "", 0, in)) ) { LEVEL_DEBUG("Error sending HA5 reset"); return BUS_RESET_ERROR; } // For some reason, the HA5 doesn't use a checksum for RESET response. if ( BAD(HA5_read(resp, 2, in)) ) { LEVEL_DEBUG("Error reading HA5 reset"); return BUS_RESET_ERROR; } switch( resp[0] ) { case 'P': in->AnyDevices = anydevices_yes ; return BUS_RESET_OK; case 'N': in->AnyDevices = anydevices_no ; return BUS_RESET_OK; default: LEVEL_DEBUG("Error HA5 reset bad response %c (0x%.2X)", resp[0], resp[0]); return BUS_RESET_ERROR; } } static enum search_status HA5_next_both(struct device_search *ds, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; if (ds->LastDevice) { return search_done; } HA5_flush(in); if (ds->index == -1) { enum search_status ret ; HA5MUTEX_LOCK( in->master.ha5.head ) ; ret = HA5_directory(ds, pn) ; HA5MUTEX_UNLOCK( in->master.ha5.head ) ; if ( ret != search_good ) { return search_error; } } // LOOK FOR NEXT ELEMENT ++ds->index; LEVEL_DEBUG("Index %d", ds->index); switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat, SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } /************************************************************************/ /* HA5_directory: searches the Directory stores it in a dirblob */ /* & stores in in a dirblob object depending if it */ /* Supports conditional searches of the bus for */ /* /alarm branch */ /* */ /* Only called for the first element, everything else comes from dirblob */ /* returns 0 even if no elements, errors only on communication errors */ /************************************************************************/ static enum search_status HA5_directory(struct device_search *ds, const struct parsedname *pn) { unsigned char resp[20]; struct connection_in * in = pn->selected_connection ; DirblobClear( &(ds->gulp) ); //Depending on the search type, the HA5 search function //needs to be selected //tEC -- Conditional searching //tF0 -- Normal searching // Send the configuration command and check response if ( BAD(HA5_write( (ds->search == _1W_CONDITIONAL_SEARCH_ROM) ? 'C' : 'S', ",FF", 3, in)) ) { HA5_resync(in) ; return search_error ; } if ( BAD(HA5_read(resp, 1, in)) ) { HA5_resync(in) ; return search_error ; } while ( resp[0] != CR_char ) { BYTE sn[SERIAL_NUMBER_SIZE]; char wrap_char ; //One needs to check the first character returned. //If nothing is found, the ha5 will timeout rather then have a quick //return. This happens when looking at the alarm directory and //there are no alarms pending //So we grab the first character and check it. If not an E leave it //in the resp buffer and get the rest of the response from the HA5 //device if ( in->master.ha5.checksum ) { if ( BAD(HA5_read(&resp[1], 19, in)) ) { HA5_resync(in) ; return search_error ; } if ( resp[18]!=CR_char ) { HA5_resync(in) ; return search_error ; } wrap_char = resp[19] ; if ( BAD( TestChecksum( resp, 16 )) ) { HA5_resync(in) ; return search_error ; } } else { if ( BAD(HA5_read(&resp[1], 17, in)) ) { HA5_resync(in) ; return search_error ; } if ( resp[16]!=CR_char ) { HA5_resync(in) ; return search_error ; } wrap_char = resp[17] ; } sn[7] = string2num((char *)&resp[0]); sn[6] = string2num((char *)&resp[2]); sn[5] = string2num((char *)&resp[4]); sn[4] = string2num((char *)&resp[6]); sn[3] = string2num((char *)&resp[8]); sn[2] = string2num((char *)&resp[10]); sn[1] = string2num((char *)&resp[12]); sn[0] = string2num((char *)&resp[14]); // Set as current "Address" for adapter memcpy( in->master.ha5.sn, sn, 8) ; LEVEL_DEBUG("SN found: " SNformat, SNvar(sn)); // CRC check if (CRC8(sn, 8) || (sn[0] == 0)) { /* A minor "error" and should perhaps only return -1 */ /* to avoid reconnect */ LEVEL_DEBUG("sn = %s", sn); HA5_resync(in) ; return search_error ; } DirblobAdd(sn, &(ds->gulp) ); resp[0] = wrap_char ; } return search_good ; } static GOOD_OR_BAD HA5_resync( struct connection_in * in ) { HA5_flush(in->master.ha5.head ); HA5_reset_wrapped(in); HA5_flush(in->master.ha5.head ); // Poison current "Address" for adapter in->master.ha5.sn[0] = 0 ; // so won't match return gbBAD ; } static GOOD_OR_BAD HA5_select( const struct parsedname * pn ) { GOOD_OR_BAD ret ; if ( (pn->selected_device==NO_DEVICE) || (pn->selected_device==DeviceThermostat) ) { RETURN_BAD_IF_BAD( gbRESET( HA5_reset_in(pn->selected_connection) ) ) ; } HA5MUTEX_LOCK( pn->selected_connection->master.ha5.head ) ; ret = HA5_select_wrapped(pn) ; HA5MUTEX_UNLOCK( pn->selected_connection->master.ha5.head ) ; return ret ; } static GOOD_OR_BAD HA5_select_wrapped( const struct parsedname * pn ) { struct connection_in * in = pn->selected_connection ; char send_address[16] ; unsigned char resp_address[19] ; num2string( &send_address[ 0], pn->sn[7] ) ; num2string( &send_address[ 2], pn->sn[6] ) ; num2string( &send_address[ 4], pn->sn[5] ) ; num2string( &send_address[ 6], pn->sn[4] ) ; num2string( &send_address[ 8], pn->sn[3] ) ; num2string( &send_address[10], pn->sn[2] ) ; num2string( &send_address[12], pn->sn[1] ) ; num2string( &send_address[14], pn->sn[0] ) ; if ( BAD(HA5_write( 'A', send_address, 16, in)) ) { LEVEL_DEBUG("Error sending HA5 A-ddress") ; return HA5_resync(in) ; } if ( in->master.ha5.checksum ) { if ( BAD(HA5_read(resp_address,19,in)) ) { LEVEL_DEBUG("Error with reading HA5 select") ; return HA5_resync(in) ; } if ( BAD(TestChecksum( resp_address, 16)) ) { LEVEL_DEBUG("HA5 select checksum error") ; return HA5_resync(in) ; } } else { if ( BAD(HA5_read(resp_address,17,in)) ) { LEVEL_DEBUG("Error with reading HA5 select") ; return HA5_resync(in) ; } } if ( memcmp( resp_address, send_address, 16) ) { LEVEL_DEBUG("Error with HA5 select response") ; return HA5_resync(in) ; } // Set as current "Address" for adapter memcpy( in->master.ha5.sn, pn->sn, SERIAL_NUMBER_SIZE) ; return gbGOOD ; } // Send data and return response block -- up to 32 bytes static GOOD_OR_BAD HA5_sendback_part(char cmd, const BYTE * data, BYTE * resp, const size_t size, struct connection_in * in) { char send_data[2+2*size] ; unsigned char get_data[32*2+3] ; num2string( &send_data[0], size ) ; bytes2string( &send_data[2], data, size) ; if ( BAD(HA5_write( cmd, send_data, 2+2*size, in)) ) { LEVEL_DEBUG("Error with sending HA5 block") ; HA5_resync(in) ; return gbBAD ; } if ( in->master.ha5.checksum ) { if ( BAD(HA5_read( get_data, size*2+3, in)) ) { LEVEL_DEBUG("Error with reading HA5 block") ; HA5_resync(in) ; return gbBAD ; } if ( BAD(TestChecksum( get_data, size*2)) ) { LEVEL_DEBUG("HA5 block read checksum error") ; HA5_resync(in) ; return gbBAD ; } } else { if ( BAD(HA5_read( get_data, size*2+1, in)) ) { LEVEL_DEBUG("Error with reading HA5 block") ; HA5_resync(in) ; return gbBAD ; } } string2bytes( (char *)get_data, resp, size) ; return gbGOOD ; } static GOOD_OR_BAD HA5_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { int left; struct connection_in * in = pn->selected_connection ; for ( left=size ; left>0 ; left -= 32 ) { GOOD_OR_BAD ret ; size_t pass_start = size - left ; size_t pass_size = (left>32)?32:left ; HA5MUTEX_LOCK( in->master.ha5.head ) ; ret = HA5_sendback_part( 'W', &data[pass_start], &resp[pass_start], pass_size, in ) ; HA5MUTEX_UNLOCK( in->master.ha5.head ) ; RETURN_BAD_IF_BAD( ret ) ; } return gbGOOD; } static GOOD_OR_BAD HA5_select_and_sendback(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; int left; char block_cmd ; if ( memcmp( pn->sn, in->master.ha5.sn, SERIAL_NUMBER_SIZE ) ) { // Need a formal change of device RETURN_BAD_IF_BAD( HA5_select(pn) ) ; block_cmd = 'W' ; } else { // Same device block_cmd = 'J' ; } for ( left=size ; left>0 ; left -= 32 ) { GOOD_OR_BAD ret ; size_t pass_start = size - left ; size_t pass_size = (left>32)?32:left ; HA5MUTEX_LOCK( in->master.ha5.head ) ; ret = HA5_sendback_part( block_cmd, &data[pass_start], &resp[pass_start], pass_size, in ) ; HA5MUTEX_UNLOCK( in->master.ha5.head ) ; block_cmd = 'W' ; // for next pass RETURN_BAD_IF_BAD( ret ) ; } return gbGOOD; } /********************************************************/ /* HA5_sendback_bits -- bit-mode communication */ /********************************************************/ static GOOD_OR_BAD HA5_sendback_bits(const BYTE * outbits, BYTE * inbits, const size_t length, const struct parsedname *pn) { size_t counter ; struct connection_in * in = pn->selected_connection ; HA5MUTEX_LOCK( in->master.ha5.head ) ; for ( counter = 0 ; counter < length ; ++counter ) { if ( BAD( HA5_bit( outbits[counter], &inbits[counter], in ) ) ) { HA5MUTEX_UNLOCK( in->master.ha5.head ) ; return gbBAD ; } } HA5MUTEX_UNLOCK( in->master.ha5.head ) ; return gbGOOD; } static GOOD_OR_BAD HA5_bit( BYTE outbit, BYTE * inbit, struct connection_in * in ) { BYTE resp[1] = { 'X', } ; if ( BAD(HA5_write( 'B', outbit ? "1" : "0" , 1, in)) ) { LEVEL_DEBUG("Error sending HA5 bit"); return gbBAD; } // For some reason, the HA5 doesn't use a checksum for BIT response. if ( BAD(HA5_read(resp, 2, in)) ) { LEVEL_DEBUG("Error reading HA5 bit"); return gbBAD; } switch ( resp[0] ) { case '0': inbit[0] = 0 ; return gbGOOD ; case '1': inbit[0] = 1 ; return gbGOOD ; default: LEVEL_DEBUG("Unclear HA5 bit response \'%c\'",resp[0]); return gbBAD ; } } /********************************************************/ /* HA5_close -- clean local resources before */ /* closing the serial port */ /********************************************************/ static void HA5_close(struct connection_in *in) { if ( in->master.ha5.head == in ) { HA5MUTEX_DESTROY(in); } else { SOC(in)->state = cs_virgin ; } } owfs-2.8p15/module/owlib/src/c/ow_parse_sn.c0000644000175000017500000000237311740167566015727 00000000000000/* $Id: ow_parse_sn.c,v 1.7 2012/04/08 01:52:54 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" enum parse_serialnumber Parse_SerialNumber(char *sn_char, BYTE * sn) { ASCII ID[14]; int i; for (i = 0; i < 14; ++i, ++sn_char) { /* get ID number */ if (*sn_char == '.') { // ignore dots ++sn_char; } if (isxdigit(*sn_char)) { ID[i] = *sn_char; } else { return sn_not_sn; // non-hex } } sn[0] = string2num(&ID[0]); sn[1] = string2num(&ID[2]); sn[2] = string2num(&ID[4]); sn[3] = string2num(&ID[6]); sn[4] = string2num(&ID[8]); sn[5] = string2num(&ID[10]); sn[6] = string2num(&ID[12]); sn[7] = CRC8compute(sn, SERIAL_NUMBER_SIZE-1, 0); if (*sn_char == '.') { ++sn_char; } // Check CRC8 if given if (isxdigit(sn_char[0]) && isxdigit(sn_char[1])) { char crc[2]; num2string(crc, sn[SERIAL_NUMBER_SIZE-1]); if (strncasecmp(crc, sn_char, 2)) { return sn_invalid; } sn_char += 2 ; } return ( *sn_char == '\0' ) ? sn_valid : sn_not_sn ; } owfs-2.8p15/module/owlib/src/c/ow_zero.c0000644000175000017500000001057511731463643015072 00000000000000/* $Id: ow_zero.c,v 1.35 2012/03/14 03:48:40 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" #if OW_ZERO && OW_MT #include #include #include static void RegisterBack(DNSServiceRef s, DNSServiceFlags f, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *v) ; static void Announce_Post_Register(DNSServiceRef sref, DNSServiceErrorType err) ; static void *Announce(void *v) ; /* Sent back from Bonjour -- arbitrarily use it to set the Ref for Deallocation */ static void RegisterBack(DNSServiceRef s, DNSServiceFlags f, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *v) { struct connection_out * out = v ; LEVEL_DETAIL ("RegisterBack ref=%d flags=%d error=%d name=%s type=%s domain=%s", s, f, e, SAFESTRING(name), SAFESTRING(type), SAFESTRING(domain)); if (e != kDNSServiceErr_NoError) { return ; } out->sref0 = s; SAFEFREE( out->zero.name ) ; out->zero.name = owstrdup(name) ; SAFEFREE( out->zero.type ) ; out->zero.type = owstrdup(type) ; SAFEFREE( out->zero.domain ) ; out->zero.domain = owstrdup(domain) ; } static void Announce_Post_Register(DNSServiceRef sref, DNSServiceErrorType err) { if (err == kDNSServiceErr_NoError) { DNSServiceProcessResult(sref); } else { LEVEL_CONNECT("Unsuccessful call to DNSServiceRegister err = %d", err); } } /* Register the out port with Bonjour -- might block so done in a separate thread */ static void *Announce(void *v) { struct connection_out *out = v; DNSServiceRef sref; DNSServiceErrorType err; struct sockaddr sa; //socklen_t sl = sizeof(sa); socklen_t sl = 128; uint16_t port ; char * service_name ; char name[63] ; DETACH_THREAD; if (getsockname(out->file_descriptor, &sa, &sl)) { LEVEL_CONNECT("Could not get port number of device."); pthread_exit(NULL); return VOID_RETURN; } port = ntohs(((struct sockaddr_in *) (&sa))->sin_port) ; /* Add the service */ switch (Globals.program_type) { case program_type_httpd: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) Web" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; err = DNSServiceRegister(&sref, 0, 0, name,"_http._tcp", NULL, NULL, port, 0, NULL, RegisterBack, out) ; Announce_Post_Register(sref, err) ; err = DNSServiceRegister(&sref, 0, 0, name,"_owhttpd._tcp", NULL, NULL, port, 0, NULL, RegisterBack, out) ; break ; case program_type_server: case program_type_external: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) Server" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; err = DNSServiceRegister(&sref, 0, 0, name,"_owserver._tcp", NULL, NULL, port, 0, NULL, RegisterBack, out) ; break; case program_type_ftpd: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) FTP" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; err = DNSServiceRegister(&sref, 0, 0, name,"_owftp._tcp", NULL, NULL, port, 0, NULL, RegisterBack, out) ; break; default: err = kDNSServiceErr_NoError ; break ; } Announce_Post_Register(sref, err) ; LEVEL_DEBUG("Normal exit"); pthread_exit(NULL); return VOID_RETURN; } void ZeroConf_Announce(struct connection_out *out) { if ( Globals.announce_off) { return; } else if ( Globals.zero == zero_avahi ) { #if !OW_CYGWIN // avahi only implemented with multithreading pthread_t thread; int err = pthread_create(&thread, DEFAULT_THREAD_ATTR, OW_Avahi_Announce, (void *) out); if (err) { LEVEL_CONNECT("Avahi registration thread error %d.", err); } #endif } else if ( Globals.zero == zero_bonjour ) { pthread_t thread; int err = pthread_create(&thread, DEFAULT_THREAD_ATTR, Announce, (void *) out); if (err) { LEVEL_CONNECT("Zeroconf/Bonjour registration thread error %d.", err); } } } #else /* OW_ZERO && OW_MT */ void ZeroConf_Announce(struct connection_out *out) { (void) out; LEVEL_CONNECT("Zeroconf and/or Multithreading are not enabled"); return; } #endif /* OW_ZERO */ owfs-2.8p15/module/owlib/src/c/ow_2430.c0000644000175000017500000001372011740076517014476 00000000000000/* $Id: ow_2430.c,v 1.36 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2430.h" /* ------- Prototypes ----------- */ /* DS2423 counter */ READ_FUNCTION(FS_r_memory); WRITE_FUNCTION(FS_w_memory); READ_FUNCTION(FS_r_status); READ_FUNCTION(FS_r_application); WRITE_FUNCTION(FS_w_application); #define _DS2430A_MEM_SIZE 32 /* ------- Structures ----------- */ static struct filetype DS2430A[] = { F_STANDARD, {"memory", _DS2430A_MEM_SIZE, NON_AGGREGATE, ft_binary, fc_link, FS_r_memory, FS_w_memory, VISIBLE, NO_FILETYPE_DATA, }, {"application", 8, NON_AGGREGATE, ft_binary, fc_stable, FS_r_application, FS_w_application, VISIBLE, NO_FILETYPE_DATA, }, {"status", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_status, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(14, DS2430A, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_COPY_SCRATCHPAD_VALIDATION_KEY 0xA5 #define _1W_READ_MEMORY 0xF0 #define _1W_READ_STATUS_REGISTER 0x66 #define _1W_STATUS_VALIDATION_KEY 0x00 #define _1W_WRITE_APPLICATION_REGISTER 0x99 #define _1W_READ_APPLICATION_REGISTER 0xC3 #define _1W_COPY_AND_LOCK_APPLICATION_REGISTER 0x5A /* ------- Functions ------------ */ /* DS2502 */ static GOOD_OR_BAD OW_w_mem(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_app(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_app(BYTE * data, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_status(BYTE * data, const struct parsedname *pn); /* DS2430A memory */ static ZERO_OR_ERROR FS_r_memory(struct one_wire_query *owq) { OWQ_length(owq) = OWQ_size(owq) ; return GB_to_Z_OR_E(OW_r_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } /* DS2430A memory */ static ZERO_OR_ERROR FS_r_application(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_app((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_memory(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_application(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_app((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_status(struct one_wire_query *owq) { BYTE data ; ZERO_OR_ERROR z_or_e = OW_r_status(&data, PN(owq)) ; OWQ_U(owq) = data ; return z_or_e ; } /* Byte-oriented write */ static GOOD_OR_BAD OW_w_mem(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { BYTE scratch[_DS2430A_MEM_SIZE]; BYTE vr[] = { _1W_READ_SCRATCHPAD, BYTE_MASK(offset), }; BYTE of[] = { _1W_WRITE_SCRATCHPAD, BYTE_MASK(offset), }; BYTE cp[] = { _1W_COPY_SCRATCHPAD, _1W_COPY_SCRATCHPAD_VALIDATION_KEY, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(of), TRXN_WRITE(data, size), TRXN_START, TRXN_WRITE2(vr), TRXN_READ(scratch, size), TRXN_COMPARE(data,scratch,size), TRXN_START, TRXN_WRITE2(cp), TRXN_DELAY(10), TRXN_END, }; /* load scratch pad if incomplete write */ if ( size != _DS2430A_MEM_SIZE ) { RETURN_BAD_IF_BAD( OW_r_mem( scratch, 0, 0x00, pn)) ; } /* write data to scratchpad */ /* read back the scratchpad */ /* copy scratchpad to memory */ return BUS_transaction(t, pn); } /* Byte-oriented write */ static GOOD_OR_BAD OW_r_mem( BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { BYTE fo[] = { _1W_READ_MEMORY, BYTE_MASK(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(fo), TRXN_READ( data, size ) , TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_w_app(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { BYTE nn[] = { _1W_WRITE_APPLICATION_REGISTER, BYTE_MASK(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(nn), TRXN_WRITE(data, size), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_r_app(BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { BYTE c3[] = { _1W_READ_APPLICATION_REGISTER, BYTE_MASK(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(c3), TRXN_READ(data, size), TRXN_END, }; return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_r_status(BYTE * data, const struct parsedname *pn) { BYTE ss[] = { _1W_READ_STATUS_REGISTER, _1W_STATUS_VALIDATION_KEY }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(ss), TRXN_READ1(data), TRXN_END, }; return BUS_transaction(t, pn); } owfs-2.8p15/module/owlib/src/c/ow_channel.c0000644000175000017500000000266511707143413015515 00000000000000/* $Id: ow_channel.c,v 1.3 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* Common routines for a multi-channel bus master */ /* OWSERVER_ENET HA5 DS2482-x00 are examples */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" void OW_channel_init( struct connection_in * in ) { if ( in == NO_CONNECTION ) { return ; } in->channel_info.channel = '\0' ; in->channel_info.head = in ; in->channel_info.psoc = &(in->soc) ; _MUTEX_INIT(in->channel_info.all_channel_lock); } void OW_channel_close( struct connection_in * in ) { if ( in == NO_CONNECTION ) { return ; } if ( in->channel_info.head == in ) { _MUTEX_DESTROY(in->channel_info.all_channel_lock); } in->channel_info.head = NO_CONNECTION ; } void OW_channel_lock( struct connection_in * in ) { struct connection_in * head_in = in->channel_info.head ; if ( head_in != NO_CONNECTION ) { _MUTEX_LOCK(head_in->channel_info.all_channel_lock ) ; } } void OW_channel_unlock( struct connection_in * in ) { struct connection_in * head_in = in->channel_info.head ; if ( head_in != NO_CONNECTION ) { _MUTEX_UNLOCK(head_in->channel_info.all_channel_lock ) ; } } owfs-2.8p15/module/owlib/src/c/ow_avahi_announce.c0000644000175000017500000002023211731463642017057 00000000000000/* $Id: ow_avahi_announce.c,v 1.17 2012/03/14 03:48:40 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" #if OW_ZERO && OW_MT && !OW_CYGWIN #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif /* Special functions that need to be linked in dynamically -- libavahi-client.so avahi_client_errno avahi_client_free avahi_client_new avahi_entry_group_add_service avahi_entry_group_commit avahi_entry_group_is_empty avahi_entry_group_new avahi_entry_group_reset --libavahi-common.so avahi_simple_poll_free avahi_simple_poll_get avahi_simple_poll_loop avahi_simple_poll_new avahi_simple_poll_quit avahi_strerror */ struct announce_avahi_struct { AvahiEntryGroup *group ; AvahiSimplePoll *poll ; AvahiClient *client ; struct connection_out *out ; } ; static void entry_group_callback(AvahiEntryGroup *group, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void * v) ; static void create_services(struct announce_avahi_struct * aas) ; static void client_callback(AvahiClient *client, AvahiClientState state, AVAHI_GCC_UNUSED void * v) ; static void entry_group_callback(AvahiEntryGroup *group, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void * v) { struct announce_avahi_struct * aas = v ; aas->group = group ; /* Called whenever the entry group state changes */ switch (state) { case AVAHI_ENTRY_GROUP_ESTABLISHED : /* The entry group has been established successfully */ break; case AVAHI_ENTRY_GROUP_COLLISION : // Shouldn't happen since we put the pid in the service name LEVEL_DEBUG("inexplicable service name collison"); avahi_simple_poll_quit(aas->poll); break; case AVAHI_ENTRY_GROUP_FAILURE : LEVEL_DEBUG("group failure: %s", avahi_strerror(avahi_client_errno(aas->client))); avahi_simple_poll_quit(aas->poll); break; case AVAHI_ENTRY_GROUP_UNCOMMITED: case AVAHI_ENTRY_GROUP_REGISTERING: break ; } } static void create_services(struct announce_avahi_struct * aas) { /* If this is the first time we're called, let's create a new * entry group if necessary */ if (aas->group==NULL) { aas->group = avahi_entry_group_new(aas->client, entry_group_callback, aas) ; if ( aas->group==NULL) { LEVEL_DEBUG("avahi_entry_group_new() failed: %s", avahi_strerror(avahi_client_errno(aas->client))); avahi_simple_poll_quit(aas->poll); return ; } } /* If the group is empty (either because it was just created, or * because it was reset previously, add our entries. */ if (avahi_entry_group_is_empty(aas->group)) { struct sockaddr sa; //socklen_t sl = sizeof(sa); socklen_t sl = 128; int ret1 = 0 ; int ret2 = 0 ; uint16_t port ; char * service_name ; char name[63] ; if (getsockname(aas->out->file_descriptor, &sa, &sl)) { LEVEL_CONNECT("Could not get port number of device."); avahi_simple_poll_quit(aas->poll); return; } port = ntohs(((struct sockaddr_in *) (&sa))->sin_port) ; /* Add the service */ switch (Globals.program_type) { case program_type_httpd: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) Web" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; ret1 = avahi_entry_group_add_service( aas->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name,"_http._tcp", NULL, NULL, port, NULL) ; ret2 = avahi_entry_group_add_service( aas->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name,"_owhttpd._tcp", NULL, NULL, port, NULL) ; break ; case program_type_server: case program_type_external: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) Server" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; ret1 = avahi_entry_group_add_service( aas->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name,"_owserver._tcp", NULL, NULL, port, NULL) ; break; case program_type_ftpd: service_name = (Globals.announce_name) ? Globals.announce_name : "OWFS (1-wire) FTP" ; UCLIBCLOCK; snprintf(name,62,"%s <%d>",service_name,(int)port); UCLIBCUNLOCK; ret1 = avahi_entry_group_add_service( aas->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name,"_ftp._tcp", NULL, NULL, port, NULL) ; break; default: avahi_simple_poll_quit(aas->poll); return; } //printf("AVAHI ANNOUNCE: domain=<%s>\n",avahi_client_get_domain_name(aas->client) ) ; if ( ret1 < 0 || ret2 < 0 ) { LEVEL_DEBUG("Failed to add a service: %s or %s", avahi_strerror(ret1), avahi_strerror(ret2)); avahi_simple_poll_quit(aas->poll); return; } /* Tell the server to register the service */ ret1 = avahi_entry_group_commit(aas->group) ; if ( ret1 < 0 ) { LEVEL_DEBUG("Failed to commit entry group: %s", avahi_strerror(ret1)); avahi_simple_poll_quit(aas->poll); return; } /* Record the service to prevent browsing to ourself */ SAFEFREE( aas->out->zero.name ) ; aas->out->zero.name = owstrdup(name) ; SAFEFREE( aas->out->zero.type ) ; switch (Globals.program_type) { case program_type_httpd: aas->out->zero.type = owstrdup("_owhttpd._tcp") ; break ; case program_type_server: aas->out->zero.type = owstrdup("_owserver._tcp") ; break; case program_type_external: aas->out->zero.type = owstrdup("_owexternal._tcp") ; break; case program_type_ftpd: aas->out->zero.type = owstrdup("_ftp._tcp") ; break; default: break ; } SAFEFREE( aas->out->zero.domain ) ; aas->out->zero.domain = owstrdup(avahi_client_get_domain_name(aas->client)) ; } } static void client_callback(AvahiClient *client, AvahiClientState state, AVAHI_GCC_UNUSED void * v) { struct announce_avahi_struct * aas = v ; if ( client==NULL ) { LEVEL_DEBUG("null client") ; avahi_simple_poll_quit(aas->poll); return ; } //Set this link here so called routines can use it aas->client = client ; /* Called whenever the client or server state changes */ switch (state) { case AVAHI_CLIENT_S_RUNNING: /* The server has startup successfully and registered its host * name on the network, so it's time to create our services */ create_services(aas); break; case AVAHI_CLIENT_FAILURE: LEVEL_DEBUG( "Client failure: %s", avahi_strerror(avahi_client_errno(client))); avahi_simple_poll_quit(aas->poll); break; case AVAHI_CLIENT_S_COLLISION: /* Let's drop our registered services. When the server is back * in AVAHI_SERVER_RUNNING state we will register them * again with the new host name. */ case AVAHI_CLIENT_S_REGISTERING: /* The server records are now being established. This * might be caused by a host name change. We need to wait * for our own records to register until the host name is * properly esatblished. */ if (aas->group != NULL) { avahi_entry_group_reset(aas->group); } break; case AVAHI_CLIENT_CONNECTING: break ; } } // Should be called in it's own thread void *OW_Avahi_Announce( void * v ) { struct connection_out *out = v ; struct announce_avahi_struct aas = { .group = NULL, .poll = NULL, .client = NULL, .out = out , } ; DETACH_THREAD; aas.poll = avahi_simple_poll_new() ; if ( aas.poll != NULL ) { int error ; /* Allocate a new client */ aas.client = avahi_client_new(avahi_simple_poll_get(aas.poll), 0, client_callback, (void *)(&aas), &error); if (aas.client!=NULL) { /* Run the main loop */ avahi_simple_poll_loop(aas.poll); // done avahi_client_free(aas.client); } else { LEVEL_CONNECT("Failed to create client: %s", avahi_strerror(error)) ; } avahi_simple_poll_free(aas.poll); } else { LEVEL_CONNECT("Failed to create simple poll object."); } LEVEL_DEBUG("Normal exit."); pthread_exit(NULL); return VOID_RETURN ; } #else /* OW_ZERO && OW_MT */ // Should be called in it's own thread void *OW_Avahi_Announce( void * v ) { (void) v ; LEVEL_CONNECT("Avahi support not present in this build"); return VOID_RETURN ; } #endif /* OW_ZERO && OW_MT && !OW_CYGWIN */ owfs-2.8p15/module/owlib/src/c/ow_traffic.c0000664000175000017500000000434311503546662015527 00000000000000/* $Id: ow_traffic.c,v 1.4 2010/12/20 03:29:54 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" /* Debugging interface to showing all bus traffic * You need to configure compile with * ./configure --enable-owtraffic * */ #if OW_SHOW_TRAFFIC static struct connection_in * Bus_from_file_descriptor( FILE_DESCRIPTOR_OR_ERROR file_descriptor ) { struct connection_in * in ; for( in = Inbound_Control.head ; in != NO_CONNECTION ; in = in->next ) { if ( SOC(in)->file_descriptor == file_descriptor ) { break ; } } return in ; } void TrafficOut( const char * data_type, const BYTE * data, size_t length, const struct connection_in * in ) { fprintf(stderr, "TRAFFIC OUT <%s> bus=%d (%s)\n", SAFESTRING(data_type), in->index, SOC(in)->devicename ) ; _Debug_Bytes( in->adapter_name, data, length ) ; } void TrafficIn( const char * data_type, const BYTE * data, size_t length, const struct connection_in * in ) { fprintf(stderr, "TRAFFIC IN <%s> bus=%d (%s)\n", SAFESTRING(data_type), in->index, SOC(in)->devicename ) ; _Debug_Bytes( in->adapter_name, data, length ) ; } void TrafficOutFD( const char * data_type, const BYTE * data, size_t length, FILE_DESCRIPTOR_OR_ERROR file_descriptor ) { struct connection_in * in = Bus_from_file_descriptor( file_descriptor ) ; if ( in != NO_CONNECTION ) { TrafficOut( data_type, data, length, in ) ; } else { fprintf(stderr, "TRAFFIC OUT <%s> file descriptor=%d\n", SAFESTRING(data_type), file_descriptor ) ; _Debug_Bytes( "FD", data, length ) ; } } void TrafficInFD( const char * data_type, const BYTE * data, size_t length, FILE_DESCRIPTOR_OR_ERROR file_descriptor ) { struct connection_in * in = Bus_from_file_descriptor( file_descriptor ) ; if ( in != NO_CONNECTION ) { TrafficIn( data_type, data, length, in ) ; } else { fprintf(stderr, "TRAFFIC IN <%s> file descriptor=%d\n", SAFESTRING(data_type), file_descriptor ) ; _Debug_Bytes( "FD", data, length ) ; } } #endif /* OW_SHOW_TRAFFIC */ owfs-2.8p15/module/owlib/src/c/ow_usb_cycle.c0000664000175000017500000001620411555120312016043 00000000000000/* $Id: ow_usb_cycle.c,v 1.12 2011/04/24 22:14:34 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* DS9490R-W USB 1-Wire master USB parameters: Vendor ID: 04FA ProductID: 2490 Dallas controller DS2490 */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_usb_msg.h" #include "ow_usb_cycle.h" #if OW_USB static void DS9490_dir_callback( void * v, const struct parsedname * pn_entry ); static GOOD_OR_BAD usbdevice_in_use(const struct usb_list *ul); /* ------------------------------------------------------------ */ /* --- USB bus scaning -----------------------------------------*/ void USB_first(struct usb_list *ul) { usb_init(); usb_find_busses(); usb_find_devices(); ul->bus = usb_get_busses(); ul->usb_bus_number = -1 ; ul->usb_bus_number = atoi(ul->bus->dirname) ; ul->dev = NULL; } GOOD_OR_BAD USB_next(struct usb_list *ul) { while (ul->bus) { // First pass, look for next device if (ul->dev == NULL) { ul->dev = ul->bus->devices; } else { // New bus, find first device ul->dev = ul->dev->next; ul->usb_dev_number = -1 ; } if (ul->dev) { // device found if (ul->dev->descriptor.idVendor != DS2490_USB_VENDOR || ul->dev->descriptor.idProduct != DS2490_USB_PRODUCT) { continue; // not DS9490 } if ( sscanf( ul->dev->filename, "%u", &(ul->usb_dev_number) ) <= 0 ) { ul->usb_dev_number = -1 ; } if ( BAD ( usbdevice_in_use( ul ) ) ) { continue ; } LEVEL_CONNECT("Bus master found: %.d:%.d", ul->usb_bus_number, ul->usb_dev_number); return gbGOOD; } else { ul->bus = ul->bus->next; if ( ul->bus == NULL || sscanf( ul->bus->dirname, "%u", &(ul->usb_bus_number) ) <= 0 ) { ul->usb_bus_number = -1 ; } ul->dev = NULL; } } return gbBAD; } /* Includes a count of the rejected existing USB devices * needed for compatibility with the -u2 -u3 arguments */ GOOD_OR_BAD USB_next_until_n(struct usb_list *ul, int num) { int found = 0 ; while (ul->bus) { // First pass, look for next device if (ul->dev == NULL) { ul->dev = ul->bus->devices; } else { // New bus, find first device ul->dev = ul->dev->next; ul->usb_dev_number = -1 ; } if (ul->dev) { // device found if (ul->dev->descriptor.idVendor != DS2490_USB_VENDOR || ul->dev->descriptor.idProduct != DS2490_USB_PRODUCT) { continue; // not DS9490 } if ( sscanf( ul->dev->filename, "%u", &(ul->usb_dev_number) ) <= 0 ) { ul->usb_dev_number = -1 ; } ++ found ; if ( found < num ) { continue ; } LEVEL_CONNECT("Bus master found: %.d:%.d", ul->usb_bus_number, ul->usb_dev_number); return usbdevice_in_use( ul ); } else { ul->bus = ul->bus->next; if ( ul->bus == NULL || sscanf( ul->bus->dirname, "%u", &(ul->usb_bus_number) ) <= 0 ) { ul->usb_bus_number = -1 ; } ul->dev = NULL; } } return gbBAD; } /* Used only in root_dir */ static void DS9490_dir_callback( void * v, const struct parsedname * pn_entry ) { struct dirblob * db = v ; LEVEL_DEBUG("Callback on %s",SAFESTRING(pn_entry->path)); if ( pn_entry->sn[0] != '\0' ) { DirblobAdd( pn_entry->sn, db ) ; } } /* Get the root directory listing for finding a 1-wire tag for a DS9490 */ /* Only error is if parsename fails */ GOOD_OR_BAD DS9490_root_dir( struct dirblob * db, struct connection_in * in ) { ASCII path[PATH_MAX] ; struct parsedname pn_root ; UCLIBCLOCK; /* Force this adapter with bus.n path */ snprintf(path, PATH_MAX, "/uncached/bus.%d", in->index); UCLIBCUNLOCK; if ( FS_ParsedName(path, &pn_root) != 0 ) { LEVEL_DATA("Cannot get root directory on [%s] Parsing %s error.", SAFESTRING(SOC(in)->devicename), path); return gbBAD ; } DirblobInit( db ) ; /* First time pretend there are devices */ pn_root.selected_connection->changed_bus_settings |= CHANGED_USB_SPEED ; // Trigger needing new configuration pn_root.selected_connection->overdrive = 0 ; // not overdrive at start pn_root.selected_connection->flex = Globals.usb_flextime ; SetReconnect(&pn_root) ; FS_dir( DS9490_dir_callback, db, &pn_root ) ; LEVEL_DEBUG("Finished FS_dir"); FS_ParsedName_destroy(&pn_root) ; return gbGOOD ; // Dirblob must be cleared by recipient. } /* Found a DS9490 that seems good, now check list and find a device to ID for reconnects */ /* Choose in order: * (first) 0x81 * (first) 0x01 * first other family * 0x00 * */ GOOD_OR_BAD DS9490_ID_this_master(struct connection_in *in) { struct dirblob db ; BYTE sn[SERIAL_NUMBER_SIZE] ; int device_number ; RETURN_BAD_IF_BAD( DS9490_root_dir( &db, in ) ) ; // Use 0x00 if no devices (homegrown adapters?) if ( DirblobElements( &db) == 0 ) { DirblobClear( &db ) ; memset( in->master.usb.ds1420_address, 0, SERIAL_NUMBER_SIZE ) ; LEVEL_DEFAULT("Set DS9490 %s unique id 0x00 (no devices at all)", SAFESTRING(SOC(in)->devicename)) ; return gbGOOD ; } // look for the special 0x81 device device_number = 0 ; while ( DirblobGet( device_number, sn, &db ) == 0 ) { if (sn[0] == 0x81) { // 0x81 family code memcpy(in->master.usb.ds1420_address, sn, SERIAL_NUMBER_SIZE); LEVEL_DEFAULT("Set DS9490 %s unique id to " SNformat, SAFESTRING(SOC(in)->devicename), SNvar(in->master.usb.ds1420_address)); DirblobClear( &db ) ; return gbGOOD ; } ++device_number ; } // look for the (less specific, for older DS9490s) 0x01 device device_number = 0 ; while ( DirblobGet( device_number, sn, &db ) == 0 ) { if (sn[0] == 0x01) { // 0x01 family code memcpy(in->master.usb.ds1420_address, sn, SERIAL_NUMBER_SIZE); LEVEL_DEFAULT("Set DS9490 %s unique id to " SNformat, SAFESTRING(SOC(in)->devicename), SNvar(in->master.usb.ds1420_address)); DirblobClear( &db ) ; return gbGOOD ; } ++device_number ; } // Take the first device, whatever it is DirblobGet( 0, sn, &db ) ; memcpy(in->master.usb.ds1420_address, sn, SERIAL_NUMBER_SIZE); LEVEL_DEFAULT("Set DS9490 %s unique id to " SNformat, SAFESTRING(SOC(in)->devicename), SNvar(in->master.usb.ds1420_address)); DirblobClear( &db ) ; return gbGOOD; } static GOOD_OR_BAD usbdevice_in_use(const struct usb_list *ul) { struct connection_in *in; for (in = Inbound_Control.head; in != NO_CONNECTION; in = in->next) { if ( in->busmode != bus_usb ) { continue ; } if ( in->master.usb.usb_bus_number != ul->usb_bus_number ) { continue ; } if ( in->master.usb.usb_dev_number != ul->usb_dev_number ) { continue ; } return gbBAD; // It seems to be in use already } return gbGOOD; // not found in the current inbound list } /* Construct the device name */ /* Return NULL if there is a problem */ char *DS9490_device_name(const struct usb_list *ul) { size_t len = 32 ; int sn_ret ; char * return_string = owmalloc(len+1); if ( return_string == NULL ) { return NULL ; } UCLIBCLOCK ; sn_ret = snprintf(return_string, len, "%.d:%.d", ul->usb_bus_number, ul->usb_dev_number) ; UCLIBCUNLOCK ; if (sn_ret <= 0) { SAFEFREE(return_string) ; } return return_string; } #endif /* OW_USB */ owfs-2.8p15/module/owlib/src/c/ow_bus_data.c0000664000175000017500000001040111501212424015643 00000000000000/* $Id: ow_bus_data.c,v 1.5 2010/12/12 18:31:48 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" static GOOD_OR_BAD BUS_sendback_data_bitbang(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) ; /** BUS_send_data Send a data and expect response match */ GOOD_OR_BAD BUS_send_data(const BYTE * data, const size_t len, const struct parsedname *pn) { BYTE resp[len]; if (len == 0) { return gbGOOD; } if ( BAD( BUS_sendback_data(data, resp, len, pn) ) ) { STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD ; } if ( memcmp(data, resp, len) != 0 ) { LEVEL_DEBUG("Response doesn't match data sent"); STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD ; } return gbGOOD; } /** readin_data Send 0xFFs and return response block */ GOOD_OR_BAD BUS_readin_data(BYTE * data, const size_t len, const struct parsedname *pn) { memset(data, 0xFF, (size_t) len) ; RETURN_GOOD_IF_GOOD( BUS_sendback_data( data, data, len, pn) ) ; STAT_ADD1(BUS_readin_data_errors); return gbBAD; } // ---------------------------------------------------------------- // Low level default routines, often superceded by more capable adapters /* Symmetric */ /* send bytes, and read back -- calls lower level bit routine */ GOOD_OR_BAD BUS_select_and_sendback(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { GOOD_OR_BAD (*select_and_sendback) (const BYTE * data, BYTE * resp, const size_t len, const struct parsedname * pn) = pn->selected_connection->iroutines.select_and_sendback ; if ( select_and_sendback != NO_SELECTANDSENDBACK_ROUTINE ) { return (select_and_sendback) (data, resp, len, pn); } else { RETURN_BAD_IF_BAD( BUS_select(pn) ); return BUS_sendback_data(data, resp, len, pn); } } /* Symmetric */ /* send bytes, and read back -- calls lower level bit routine */ GOOD_OR_BAD BUS_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { GOOD_OR_BAD (*sendback_data) (const BYTE * data, BYTE * resp, const size_t len, const struct parsedname * pn) = pn->selected_connection->iroutines.sendback_data ; /* Empty is ok */ if (len == 0) { return gbGOOD; } /* Native function for this bus master? */ if ( sendback_data != NO_SENDBACKDATA_ROUTINE ) { return (sendback_data) (data, resp, len, pn); } return BUS_sendback_data_bitbang(data, resp, len, pn); } /* Symmetric */ /* send bytes, and read back -- calls lower level bit routine */ static GOOD_OR_BAD BUS_sendback_data_bitbang(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { /* Empty is ok */ if (len == 0) { return gbGOOD; } else { int max_split_bytes = MAX_FIFO_SIZE / 8 ; int remain = len - max_split_bytes; /* Possibly split into smaller packets? */ if (remain > 0) { RETURN_BAD_IF_BAD( BUS_sendback_data_bitbang(data, resp, max_split_bytes, pn) ); RETURN_BAD_IF_BAD( BUS_sendback_data_bitbang(&data[max_split_bytes], resp ? (&resp[max_split_bytes]) : NULL, remain, pn) ); } } { UINT i, bits = len * 8; BYTE bit_buffer[ bits ] ; /* Encode bits */ for (i = 0; i < bits; ++i) { #if OW_DEBUG if (Globals.error_level>=e_err_debug) { if ( (i&0x7)==0 ) { int b = i >>3 ; LEVEL_DEBUG("Splitting byte %d of %d = %.2X",b,len,data[b]) ; } } #endif /* OW_DEBUG */ bit_buffer[i] = UT_getbit(data, i) ? 0xFF : 0x00; } /* Communication with bit-level (e.g. DS9097) routine */ if ( BAD( BUS_sendback_bits(bit_buffer, bit_buffer, bits, pn)) ) { STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD; } /* Decode Bits */ if (resp) { for (i = 0; i < bits; ++i) { UT_setbit(resp, i, bit_buffer[i] & 0x01); #if OW_DEBUG if (Globals.error_level>=e_err_debug) { if ( (i&0x7)==7 ) { int b = i >>3 ; LEVEL_DEBUG("Consolidating byte %d of %d = %.2X",b,len,resp[b]); } } #endif /* OW_DEBUG */ } } } return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_example_slave.c0000644000175000017500000002034511740076517016734 00000000000000/* $Id: ow_example_slave.c,v 1.9 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* Example slave -- 1-wire slave example to show developers how to write support for a new 1-wire device */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ // Example_slave /* Notes for a new slave device -- what files to change A. Property functions: 1. Create this file with READ_FUNCTION and WRITE_FUNCTION for the different properties 2. Create the filetype struct for each property 3. Create the DeviceEntry or DeviceEntryExtended struct 4. Write all the appropriate property functions 5. Add any visibility functions if needed 6. Add this file and the header file to the CVS B. Header 1. Create a similarly named header file in ../include 2. Protect inclusion with #ifdef / #define / #endif 3. Link the DeviceHeader* to the include file C. Makefile and include 1. Add this file to Makefile.am 2. Add the header to ../include/Makefile.am 3. Add the header file to ../include/devices.h D. Device tree 1. Add the appropriate entry to the device tree in * ow_tree.c * SUMMARY: * create the slave_support file (this one) and the (simple) header file * add references to the slave in ow_tree.c ow_devices.h and both Makefile.am * Add the files the the CVS repository */ #include #include "owfs_config.h" #include "ow_example_slave.h" /* ------- Prototypes ----------- */ /* Here are the functions that perform the tasks of the listed properties * Unually there is on function for each read and write task, but there is * a data field that can be used to distinguish similar tasks and pool the code * * The functions get the onw_wire_query structure that contains buffers for data or results * and the parsedname structure that contains information on the name, serial number, * extra data and extension * * sometimes it makes sense to have an internal (hidden) field that corresponds better * to the devices registers, and different "linked" properties that access the register * for presentation */ /* Example slave */ READ_FUNCTION(FS_r_read_number); READ_FUNCTION(FS_r_read_bits); READ_FUNCTION(FS_r_is_index_prime); READ_FUNCTION(FS_r_extension_characters); /* ------- Structures ----------- */ /* Here are the "aggregate" structures * For properties that have an extension * e.g. PIO.A PIO.B * one set of functions can be used to manage the data * * There are several aggregate types: * 1. aggregate -- a single internal value is access on the slave, but it's also addressable separately * And example would be an 8-bit register that corresponds to 8 pio pins. Read set and cleared * together by the chip, but owfs can use then separately or as a single entity * e.g. DS2408 PIO pins * 2. separate -- a set of values that have similar structure, but are treated separately internally * owfs can pretend they are individual or unified * e.g. DS2450 voltage readings * 3. sparse -- the "extension" the value after the dot, isn't really an index, but rather a field that can * be used in the property processing. Perhaps a memory location or a parameter setting * An example could be a baud rate or parity setting. * Clearly there is no "ALL" since the range of the extension is essentially unknown and unlimitted. */ static struct aggregate AExample_bits = { 8, ag_numbers, ag_aggregate, }; static struct aggregate AExample_prime = { 0, ag_numbers, ag_sparse, }; static struct aggregate AExample_chars = { 0, ag_letters, ag_sparse, }; static struct filetype Example_slave[] = { F_STANDARD, {"read_number", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_stable, FS_r_read_number, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"bits", PROPERTY_LENGTH_BITFIELD, &AExample_bits, ft_bitfield, fc_stable, FS_r_read_bits, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"is_index_prime", PROPERTY_LENGTH_YESNO, &AExample_prime, ft_yesno, fc_volatile, FS_r_is_index_prime, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"extension_characters", PROPERTY_LENGTH_UNSIGNED, &AExample_chars, ft_unsigned, fc_volatile, FS_r_extension_characters, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(DD, Example_slave, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _EXAMPLE_SLAVE_DEFAULT_VALUE 42 /* ------- Functions ------------ */ /* Simple number read */ static ZERO_OR_ERROR FS_r_read_number(struct one_wire_query *owq) { // Simple function that returns an integer. // More usual case would be to send instructions to the slave over the 1-wire bus // and return the (interpreted) result. OWQ_I(owq) = _EXAMPLE_SLAVE_DEFAULT_VALUE ; // OWQ structure holds the result. the format (integer in this case) comes from a // property field (ft_integer in this case) return 0; // no error } /* Simple bitfield */ static ZERO_OR_ERROR FS_r_read_bits(struct one_wire_query *owq) { // Simple function that returns a bitfield. // This means it's an array of bits and can be accessed as // bit list: bits.ALL // unsigned number: bits.BYTE // or individual bits: bits.0, ... bits.7 // Note that all this handling is done at a higher level // All we need to do here is return a single unsigned number OWQ_U(owq) = _EXAMPLE_SLAVE_DEFAULT_VALUE ; // OWQ structure holds the result. the format (integer in this case) comes from a // property field (ft_integer in this case) return 0; // no error } /* Sparse numeric indexes */ static ZERO_OR_ERROR FS_r_is_index_prime(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // Get the parsename reference int array_index ; // array index // Here we'll use the index as a number (integer) and test whether the number is prime // The index is not an array index. // There is no pre-defined number of elements // There is no ".ALL" function available // The index string was parsed and converted to a number, but // no bounds checking was done (unlike a normal array). array_index = pn->extension ; // Prime number test // pick off negatives, 0, 1, 2, evens // Then test by dividing by odds up to square root if ( array_index < 1 ) { return -EINVAL ; } else if ( array_index == 1 ) { OWQ_Y(owq) = 1 ; // 1 is prime } else if ( array_index == 2 ) { OWQ_Y(owq) = 1 ; // 2 is prime } else if ( array_index % 2 == 0 ) { OWQ_Y(owq) = 0 ; // even is not prime } else { int idiv = 1 ; // test devisor OWQ_Y(owq) = 1 ; // assume prime do { idiv += 2 ; // still odd if ( array_index % idiv == 0 ) { OWQ_Y(owq) = 0 ; // non-prime break ; } } while ( idiv < (array_index/idiv) ) ; } return 0; } // Number of characters in extension index static ZERO_OR_ERROR FS_r_extension_characters(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // Get the parsename reference // This is another sparse array -- no ALL or max element // Even more, it is really a hash array -- the index is text. // We can use the text however we want. // Unlike normal arrays, any parsing and bounds checking is up to us. if ( pn->sparse_name == NULL ) { return -EINVAL ; } // In this case, just return the string length OWQ_U(owq) = strlen( pn->sparse_name ) ; return 0; } owfs-2.8p15/module/owlib/src/c/ow_settings.c0000644000175000017500000001541411740076517015750 00000000000000/* $Id: ow_settings.c,v 1.53 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* Settings are a pseudo-device -- used to dynamicalls change timeouts and the like * these settings can also be changed at the command line * Except for performance, none of these settings has security implications * */ #include #include "owfs_config.h" #include "ow_settings.h" /* ------- Prototypes ----------- */ /* Statistics reporting */ READ_FUNCTION(FS_r_timeout); WRITE_FUNCTION(FS_w_timeout); READ_FUNCTION(FS_r_yesno); WRITE_FUNCTION(FS_w_yesno); READ_FUNCTION(FS_r_TS); WRITE_FUNCTION(FS_w_TS); READ_FUNCTION(FS_r_PS); WRITE_FUNCTION(FS_w_PS); READ_FUNCTION(FS_aliaslist); READ_FUNCTION(FS_return_code); /* -------- Structures ---------- */ static struct filetype set_timeout[] = { {"volatile", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_volatile}, }, {"stable", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_stable}, }, {"directory", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_directory}, }, {"presence", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_presence}, }, {"serial", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_serial}, }, {"usb", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_usb}, }, {"network", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_network}, }, {"server", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_server}, }, {"ftp", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_ftp}, }, {"ha7", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_ha7}, }, {"w1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_timeout, FS_w_timeout, VISIBLE, {v:&Globals.timeout_w1}, }, {"uncached", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE, {v:&Globals.uncached}, }, }; struct device d_set_timeout = { "timeout", "timeout", ePN_settings, COUNT_OF_FILETYPES(set_timeout), set_timeout, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype set_units[] = { {"temperature_scale", 1, NON_AGGREGATE, ft_ascii, fc_static, FS_r_TS, FS_w_TS, VISIBLE, NO_FILETYPE_DATA, }, {"pressure_scale", 12, NON_AGGREGATE, ft_ascii, fc_static, FS_r_PS, FS_w_PS, VISIBLE, NO_FILETYPE_DATA, }, }; struct device d_set_units = { "units", "units", ePN_settings, COUNT_OF_FILETYPES(set_units), set_units, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype set_alias[] = { {"list", MAX_OWSERVER_PROTOCOL_PAYLOAD_SIZE, NON_AGGREGATE, ft_ascii, fc_static, FS_aliaslist, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"unaliased", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE, {v:&Globals.unaliased}, }, }; struct device d_set_alias = { "alias", "alias", ePN_settings, COUNT_OF_FILETYPES(set_alias), set_alias, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct aggregate Areturn_code = { N_RETURN_CODES, ag_numbers, ag_separate, }; static struct filetype set_return_code[] = { {"text", 128, &Areturn_code, ft_ascii, fc_static, FS_return_code, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; struct device d_set_return_code = { "return_codes", "return_codes", 0, COUNT_OF_FILETYPES(set_return_code), set_return_code, NO_GENERIC_READ, NO_GENERIC_WRITE }; /* ------- Functions ------------ */ static ZERO_OR_ERROR FS_r_timeout(struct one_wire_query *owq) { CACHE_RLOCK; OWQ_U(owq) = ((UINT *) OWQ_pn(owq).selected_filetype->data.v)[0]; CACHE_RUNLOCK; return 0; } static ZERO_OR_ERROR FS_w_timeout(struct one_wire_query *owq) { UINT previous; struct parsedname *pn = PN(owq); CACHE_WLOCK; //printf("FS_w_timeout!!!\n"); previous = ((UINT *) pn->selected_filetype->data.v)[0]; ((UINT *) pn->selected_filetype->data.v)[0] = OWQ_U(owq); CACHE_WUNLOCK; if (previous > OWQ_U(owq)) { Cache_Clear(); } return 0; } static ZERO_OR_ERROR FS_r_yesno(struct one_wire_query *owq) { OWQ_Y(owq) = ((UINT *) OWQ_pn(owq).selected_filetype->data.v)[0]; return 0; } static ZERO_OR_ERROR FS_w_yesno(struct one_wire_query *owq) { ((UINT *) OWQ_pn(owq).selected_filetype->data.v)[0] = OWQ_Y(owq); SetLocalControlFlags() ; return 0; } static ZERO_OR_ERROR FS_w_TS(struct one_wire_query *owq) { ZERO_OR_ERROR ret = 0; if (OWQ_size(owq) == 0 || OWQ_offset(owq) > 0) { return 0; /* do nothing */ } switch (OWQ_buffer(owq)[0]) { case 'C': case 'c': Globals.temp_scale = temp_celsius ; break; case 'F': case 'f': Globals.temp_scale = temp_fahrenheit ; break; case 'R': case 'r': Globals.temp_scale = temp_rankine ; break; case 'K': case 'k': Globals.temp_scale = temp_kelvin ; break; default: ret = -EINVAL; } SetLocalControlFlags() ; return ret; } static ZERO_OR_ERROR FS_w_PS(struct one_wire_query *owq) { int ret = -EINVAL ; enum pressure_type pindex ; if (OWQ_size(owq) < 2 || OWQ_offset(owq) > 0) { return -EINVAL ; /* do nothing */ } for ( pindex = 0 ; pindex < pressure_end_mark ; ++pindex ) { if ( strncasecmp( OWQ_buffer(owq), PressureScaleName(pindex), 2 ) == 0 ) { Globals.pressure_scale = pindex ; SetLocalControlFlags() ; ret = 0 ; break; } } return ret; } static ZERO_OR_ERROR FS_r_TS(struct one_wire_query *owq) { return OWQ_format_output_offset_and_size_z(TemperatureScaleName(Globals.temp_scale), owq); } static ZERO_OR_ERROR FS_r_PS(struct one_wire_query *owq) { return OWQ_format_output_offset_and_size_z(PressureScaleName(Globals.pressure_scale), owq); } static ZERO_OR_ERROR FS_aliaslist( struct one_wire_query * owq ) { struct memblob mb ; ZERO_OR_ERROR zoe ; MemblobInit( &mb, PATH_MAX ) ; Aliaslist( &mb ) ; if ( MemblobPure( &mb ) ) { zoe = OWQ_format_output_offset_and_size( (char *) MemblobData( &mb ), MemblobLength( &mb ), owq ) ; } else { zoe = -EINVAL ; } MemblobClear( &mb ) ; return zoe ; } static ZERO_OR_ERROR FS_return_code(struct one_wire_query *owq) { return OWQ_format_output_offset_and_size_z(return_code_strings[PN(owq)->extension], owq); } owfs-2.8p15/module/owlib/src/c/ow_1963.c0000644000175000017500000001420111740076517014503 00000000000000/* $Id: ow_1963.c,v 1.51 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1963.h" /* ------- Prototypes ----------- */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); WRITE_FUNCTION(FS_w_password); READ_FUNCTION(FS_counter); /* ------- Structures ----------- */ static struct aggregate A1963S = { 16, ag_numbers, ag_separate, }; static struct filetype DS1963S[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1963S, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"pages/count", PROPERTY_LENGTH_UNSIGNED, &A1963S, ft_unsigned, fc_volatile, FS_counter, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/password", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, {"password", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(18, DS1963S, DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A1963L = { 16, ag_numbers, ag_separate, }; static struct filetype DS1963L[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1963L, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"pages/count", PROPERTY_LENGTH_UNSIGNED, &A1963L, ft_unsigned, fc_volatile, FS_counter, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(1A, DS1963L, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x5A #define _1W_READ_MEMORY 0xF0 #define _1W_READ_MEMORY_PLUS_COUNTER 0xA5 #define _1W_COUNTER_FILL 0x55 /* ------- Functions ------------ */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_counter(struct one_wire_query *owq, size_t page, size_t pagesize); static ZERO_OR_ERROR FS_w_password(struct one_wire_query *owq) { (void) owq; return -EINVAL; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { /* read is not page-limited */ size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, pagesize, COMMON_read_memory_toss_counter)) ; } static ZERO_OR_ERROR FS_counter(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(OW_r_counter(owq, OWQ_pn(owq).extension, pagesize)) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } /* paged, and pre-screened */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[1 + 2 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 3 + size), TRXN_END, }; struct transaction_log tcopy_crc16[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ(&p[1], 3 + size), TRXN_COMPARE(data, &p[4], size), TRXN_END, }; struct transaction_log tsram[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_END, }; /* Copy to scratchpad */ memcpy(&p[3], data, size); RETURN_BAD_IF_BAD(BUS_transaction(((offset + size) & 0x1F) != 0 ? tcopy : tcopy_crc16, pn)) ; /* Re-read scratchpad and compare */ /* Note that we tacitly shift the data one byte down for the E/S byte */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(tsram, pn) ; } /* read counter (just past memory) */ /* Nathan Holmes helped troubleshoot this one! */ static GOOD_OR_BAD OW_r_counter(struct one_wire_query *owq, size_t page, size_t pagesize) { BYTE extra[8]; if (COMMON_read_memory_plus_counter(extra, page, pagesize, PN(owq))) { return gbBAD; } if (extra[4] != _1W_COUNTER_FILL || extra[5] != _1W_COUNTER_FILL || extra[6] != _1W_COUNTER_FILL || extra[7] != _1W_COUNTER_FILL) { return gbBAD; } /* counter is held in the 4 bytes after the data */ OWQ_U(owq) = UT_uint32(extra); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_sibling_float.c0000664000175000017500000000411311446543274016722 00000000000000/* $Id: ow_sibling_float.c,v 1.2 2010/09/23 03:17:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" /* FLOAT */ ZERO_OR_ERROR FS_r_sibling_F(_FLOAT *F, const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; SIZE_OR_ERROR sib_status ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } sib_status = FS_read_local(owq_sibling) ; F[0] = OWQ_F(owq_sibling) ; OWQ_destroy(owq_sibling) ; return sib_status >= 0 ? 0 : -EINVAL ; } ZERO_OR_ERROR FS_w_sibling_F(_FLOAT F, const char * sibling, struct one_wire_query *owq) { ZERO_OR_ERROR write_error; struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } OWQ_F(owq_sibling) = F ; write_error = FS_write_local(owq_sibling) ; OWQ_destroy(owq_sibling) ; return write_error ; } owfs-2.8p15/module/owlib/src/c/ow_serial_open.c0000644000175000017500000001110411731463643016400 00000000000000/* $Id: ow_serial_open.c,v 1.7 2012/03/12 22:18:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif // Fix an OpenWRT error found by Patryk #ifndef CMSPAR #define CMSPAR 010000000000 #endif /* ---------------------------------------------- */ /* raw COM port interface routines */ /* ---------------------------------------------- */ //open serial port ( called on head of connection_in group from com_open ) GOOD_OR_BAD serial_open(struct connection_in *connection) { FILE_DESCRIPTOR_OR_ERROR fd = open( SOC(connection)->devicename, O_RDWR | O_NONBLOCK | O_NOCTTY) ; SOC(connection)->file_descriptor = fd ; if ( FILE_DESCRIPTOR_NOT_VALID( fd ) ) { // state doesn't change ERROR_DEFAULT("Cannot open port: %s Permissions problem?", SAFESTRING(SOC(connection)->devicename)); return gbBAD; } else { // in case O_CLOEXEC not supported fcntl (fd, F_SETFD, FD_CLOEXEC) ; } if ( SOC(connection)->state == cs_virgin ) { // valgrind warns about uninitialized memory in tcsetattr(), so clear all. memset( &(SOC(connection)->dev.serial.oldSerialTio), 0, sizeof(struct termios)); if ((tcgetattr( fd, &(SOC(connection)->dev.serial.oldSerialTio) ) < 0)) { ERROR_CONNECT("Cannot get old port attributes: %s", SAFESTRING(SOC(connection)->devicename)); // proceed anyway } SOC(connection)->state = cs_deflowered ; } return serial_change( connection ) ; } //change serial port settings GOOD_OR_BAD serial_change(struct connection_in *connection) { struct termios newSerialTio; /*new serial port settings */ FILE_DESCRIPTOR_OR_ERROR fd = SOC(connection)->file_descriptor ; size_t baud = SOC(connection)->baud ; // read the attribute structure // valgrind warns about uninitialized memory in tcsetattr(), so clear all. memset(&newSerialTio, 0, sizeof(struct termios)); if ((tcgetattr( fd, &newSerialTio) < 0)) { ERROR_CONNECT("Cannot get existing port attributes: %s", SAFESTRING(SOC(connection)->devicename)); } // set baud in structure if (cfsetospeed(&newSerialTio, baud) < 0 || cfsetispeed(&newSerialTio, baud) < 0) { ERROR_CONNECT("Trouble setting port speed: %s", SAFESTRING(SOC(connection)->devicename)); cfsetospeed(&newSerialTio, B9600) ; cfsetispeed(&newSerialTio, B9600) ; SOC(connection)->baud = B9600 ; } // Set to non-canonical mode, and no RTS/CTS handshaking newSerialTio.c_iflag &= ~(BRKINT | ICRNL | IGNCR | INLCR | INPCK | ISTRIP | IXON | IXOFF | PARMRK); newSerialTio.c_iflag |= IGNBRK | IGNPAR; newSerialTio.c_oflag &= ~(OPOST); newSerialTio.c_cflag &= ~ HUPCL ; newSerialTio.c_cflag |= (CLOCAL | CREAD); switch( SOC(connection)->flow ) { case flow_hard: newSerialTio.c_cflag |= CRTSCTS ; break ; case flow_none: newSerialTio.c_cflag &= ~CRTSCTS; break ; case flow_soft: default: LEVEL_DEBUG("Unsupported COM port flow control"); return -ENOTSUP ; } // set bit length newSerialTio.c_cflag &= ~ CSIZE ; switch (SOC(connection)->bits) { case 5: newSerialTio.c_cflag |= CS5 ; break ; case 6: newSerialTio.c_cflag |= CS6 ; break ; case 7: newSerialTio.c_cflag |= CS7 ; break ; case 8: default: newSerialTio.c_cflag |= CS8 ; break ; } // parity switch (SOC(connection)->parity) { case parity_none: newSerialTio.c_cflag &= ~PARENB ; break ; case parity_even: newSerialTio.c_cflag |= PARENB ; newSerialTio.c_cflag &= ~( PARODD | CMSPAR ) ; break ; case parity_odd: newSerialTio.c_cflag |= PARENB | PARODD; newSerialTio.c_cflag &= ~CMSPAR ; break ; case parity_mark: newSerialTio.c_cflag |= PARENB | PARODD | CMSPAR; break ; } // stop bits switch (SOC(connection)->stop) { case stop_15: LEVEL_DEBUG("1.5 Stop bits not supported"); SOC(connection)->stop = stop_1 ; // fall through case stop_1: newSerialTio.c_cflag &= ~CSTOPB ; break ; case stop_2: newSerialTio.c_cflag |= CSTOPB ; break ; } newSerialTio.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON | IEXTEN | ISIG); newSerialTio.c_cc[VMIN] = SOC(connection)->vmin; newSerialTio.c_cc[VTIME] = SOC(connection)->vtime; if (tcsetattr( fd, TCSAFLUSH, &newSerialTio)) { ERROR_CONNECT("Cannot set port attributes: %s", SAFESTRING(SOC(connection)->devicename)); return gbBAD; } tcflush( fd, TCIOFLUSH); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_temp.c0000664000175000017500000000343310541122052015035 00000000000000/* $Id: ow_temp.c,v 1.11 2006/12/17 01:58:02 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" const char *tempscale[4] = { "Celsius", "Fahrenheit", "Kelvin", "Rankine", }; const char *TemperatureScaleName(enum temp_type t) { return tempscale[t]; } /* Temperture Conversion routines */ /* convert internal (Centigrade) to external format */ _FLOAT Temperature(_FLOAT C, const struct parsedname * pn) { switch (TemperatureScale(pn)) { case temp_fahrenheit: return 1.8 * C + 32.; case temp_kelvin: return C + 273.15; case temp_rankine: return 1.8 * C + 32. + 459.67; default: /* Centigrade */ return C; } } /* convert internal (Centigrade) to external format */ _FLOAT TemperatureGap(_FLOAT C, const struct parsedname * pn) { switch (TemperatureScale(pn)) { case temp_fahrenheit: case temp_rankine: return 1.8 * C; default: /* Centigrade, Kelvin */ return C; } } /* convert to internal (Centigrade) from external format */ _FLOAT fromTemperature(_FLOAT T, const struct parsedname * pn) { switch (TemperatureScale(pn)) { case temp_fahrenheit: return (T - 32.) / 1.8; case temp_kelvin: return T - 273.15; case temp_rankine: return (T - 32. - 459.67) / 1.8; default: /* Centigrade */ return T; } } /* convert to internal (Centigrade) from external format */ _FLOAT fromTempGap(_FLOAT T, const struct parsedname * pn) { switch (TemperatureScale(pn)) { case temp_fahrenheit: case temp_rankine: return (T) / 1.8; default: /* Centigrade, Kelvin */ return T; } } owfs-2.8p15/module/owlib/src/c/ow_2405.c0000644000175000017500000000714311740076517014502 00000000000000/* $Id: ow_2405.c,v 1.35 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2405.h" /* ------- Prototypes ----------- */ /* DS2405 */ READ_FUNCTION(FS_r_sense); READ_FUNCTION(FS_r_PIO); WRITE_FUNCTION(FS_w_PIO); /* ------- Structures ----------- */ static struct filetype DS2405[] = { F_STANDARD, {"PIO", PROPERTY_LENGTH_YESNO, NULL, ft_yesno, fc_stable, FS_r_PIO, FS_w_PIO, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_YESNO, NULL, ft_yesno, fc_volatile, FS_r_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(05, DS2405, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ static GOOD_OR_BAD OW_r_sense(int *val, const struct parsedname *pn); static GOOD_OR_BAD OW_r_PIO(int *val, const struct parsedname *pn); static GOOD_OR_BAD OW_w_PIO(int val, const struct parsedname *pn); /* 2405 switch */ static ZERO_OR_ERROR FS_r_PIO(struct one_wire_query *owq) { int num; RETURN_ERROR_IF_BAD( OW_r_PIO(&num, PN(owq)) ) ; OWQ_Y(owq) = (num != 0); return 0; } /* 2405 switch */ static ZERO_OR_ERROR FS_r_sense(struct one_wire_query *owq) { int num; RETURN_ERROR_IF_BAD( OW_r_sense(&num, PN(owq)) ) ; OWQ_Y(owq) = (num != 0); return 0; } /* write 2405 switch */ static ZERO_OR_ERROR FS_w_PIO(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_PIO(OWQ_Y(owq), PN(owq)) ) ; } /* read the sense of the DS2405 switch */ static GOOD_OR_BAD OW_r_sense(int *val, const struct parsedname *pn) { BYTE inp; struct transaction_log r[] = { TRXN_NVERIFY, TRXN_READ1(&inp), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(r, pn)) ; val[0] = (inp != 0); return gbGOOD; } /* read the state of the DS2405 switch */ static GOOD_OR_BAD OW_r_PIO(int *val, const struct parsedname *pn) { struct transaction_log a[] = { TRXN_AVERIFY, TRXN_END, }; if ( BAD( BUS_transaction(a, pn) ) ) { struct transaction_log n[] = { TRXN_NVERIFY, TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(n, pn)) ; val[0] = 0; } else { val[0] = 1; } return gbGOOD; } /* write (set) the state of the DS2405 switch */ static GOOD_OR_BAD OW_w_PIO(const int val, const struct parsedname *pn) { int current; if (OW_r_PIO(¤t, pn)) { return 1; } if (current != val) { struct transaction_log n[] = { TRXN_START, TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(n, pn)) ; } //printf("2405write current=%d new=%d\n",current,val) ; return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_1921.c0000644000175000017500000013200311740076517014476 00000000000000/* $Id: ow_1921.c,v 1.93 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1921.h" /* ------- Prototypes ----------- */ /* DS1921 Temperature */ READ_FUNCTION(FS_r_histotemp); READ_FUNCTION(FS_r_histogap); READ_FUNCTION(FS_r_histoelem); READ_FUNCTION(FS_r_resolution); READ_FUNCTION(FS_r_version); READ_FUNCTION(FS_r_rangelow); READ_FUNCTION(FS_r_rangehigh); READ_FUNCTION(FS_r_histogram); READ_FUNCTION(FS_r_logtemp); READ_FUNCTION(FS_r_logdate); READ_FUNCTION(FS_r_logudate); READ_FUNCTION(FS_logelements); READ_FUNCTION(FS_r_temperature); READ_FUNCTION(FS_bitread); WRITE_FUNCTION(FS_bitwrite); READ_FUNCTION(FS_rbitread); WRITE_FUNCTION(FS_rbitwrite); WRITE_FUNCTION(FS_easystart); READ_FUNCTION(FS_alarmudate); READ_FUNCTION(FS_alarmstart); READ_FUNCTION(FS_alarmend); READ_FUNCTION(FS_alarmcnt); READ_FUNCTION(FS_alarmelems); READ_FUNCTION(FS_r_alarmtemp); WRITE_FUNCTION(FS_w_alarmtemp); READ_FUNCTION(FS_mdate); READ_FUNCTION(FS_umdate); READ_FUNCTION(FS_r_date); WRITE_FUNCTION(FS_w_date); READ_FUNCTION(FS_r_counter); WRITE_FUNCTION(FS_w_counter); READ_FUNCTION(FS_r_delay); WRITE_FUNCTION(FS_w_delay); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_samplerate); WRITE_FUNCTION(FS_w_samplerate); READ_FUNCTION(FS_r_run); WRITE_FUNCTION(FS_w_run); READ_FUNCTION(FS_r_3byte); READ_FUNCTION(FS_r_atime); WRITE_FUNCTION(FS_w_atime); READ_FUNCTION(FS_r_atrig); WRITE_FUNCTION(FS_w_atrig); WRITE_FUNCTION(FS_w_mip); READ_FUNCTION(FS_r_register); WRITE_FUNCTION(FS_w_register); READ_FUNCTION(FS_r_controlbit); WRITE_FUNCTION(FS_w_controlbit); READ_FUNCTION(FS_r_controlrbit); WRITE_FUNCTION(FS_w_controlrbit); READ_FUNCTION(FS_r_statusbit); WRITE_FUNCTION(FS_w_statusbit); /* ------- Structures ----------- */ #define HISTOGRAM_DATA_ELEMENTS 63 #define LOG_DATA_ELEMENTS 2048 struct BitRead { size_t location; int bit; }; static struct BitRead BitReads[] = { {0x0214, 7,}, //temperature in progress {0x0214, 5,}, // Mission in progress {0x0214, 4,}, //sample in progress {0x020E, 3,}, // rollover {0x020E, 7,}, // clock running (reversed) }; #define _ADDRESS_DS1921_STATUS_REGISTER 0x0214 #define _MASK_DS1921_CLEARED 0x40 #define _MASK_DS1921_MIP 0x20 #define _MASK_DS1921_TEMP_LOW_STATUS 0x04 #define _MASK_DS1921_TEMP_HIGH_STATUS 0x02 #define _MASK_DS1921_TIMER_STATUS 0x01 #define _ADDRESS_DS1921_CONTROL_REGISTER 0x020E #define _MASK_DS1921_CLOCK_ENABLE 0x80 #define _MASK_DS1921_CLEAR_MEMORY 0x40 #define _MASK_DS1921_MISSION_ENABLE 0x10 #define _MASK_DS1921_ROLLOVER 0x08 #define _MASK_DS1921_TEMP_LOW_ALARM 0x04 #define _MASK_DS1921_TEMP_HIGH_ALARM 0x02 #define _MASK_DS1921_TIMER_ALARM 0x01 struct Mission { _DATE start; int rollover; int interval; int samples; }; static struct aggregate A1921p = { 16, ag_numbers, ag_separate, }; static struct aggregate A1921l = { LOG_DATA_ELEMENTS, ag_numbers, ag_mixed, }; static struct aggregate A1921h = { HISTOGRAM_DATA_ELEMENTS, ag_numbers, ag_mixed, }; static struct aggregate A1921m = { 12, ag_numbers, ag_aggregate, }; static struct filetype DS1921[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1921p, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"ControlRegister", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_register, FS_w_register, INVISIBLE, {u:_ADDRESS_DS1921_CONTROL_REGISTER}, }, {"StatusRegister", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_register, FS_w_register, INVISIBLE, {u:_ADDRESS_DS1921_STATUS_REGISTER}, }, {"histogram", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"histogram/counts", PROPERTY_LENGTH_UNSIGNED, &A1921h, ft_unsigned, fc_volatile, FS_r_histogram, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"histogram/elements", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_histoelem, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"histogram/gap", PROPERTY_LENGTH_TEMPGAP, NON_AGGREGATE, ft_tempgap, fc_static, FS_r_histogap, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"histogram/temperature", PROPERTY_LENGTH_TEMP, &A1921h, ft_temperature, fc_static, FS_r_histotemp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"clock", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"clock/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_second, FS_r_date, FS_w_date, VISIBLE, NO_FILETYPE_DATA, }, {"clock/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, NO_FILETYPE_DATA, }, {"clock/running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlrbit, FS_w_controlrbit, VISIBLE, {u:_MASK_DS1921_CLOCK_ENABLE}, }, {"about", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"about/resolution", PROPERTY_LENGTH_TEMPGAP, NON_AGGREGATE, ft_tempgap, fc_static, FS_r_resolution, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"about/templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_static, FS_r_rangelow, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"about/temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_static, FS_r_rangehigh, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"about/version", 11, NON_AGGREGATE, ft_ascii, fc_stable, FS_r_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"about/samples", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_3byte, NO_WRITE_FUNCTION, VISIBLE, {s:0x021D}, }, {"about/measuring", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_rbitread, NO_WRITE_FUNCTION, VISIBLE, {v:&BitReads[0]}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temperature, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission/enable", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlrbit, FS_w_controlrbit, VISIBLE, {u:_MASK_DS1921_MISSION_ENABLE}, }, {"mission/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlbit, FS_w_controlbit, INVISIBLE, {u:_MASK_DS1921_CLEAR_MEMORY}, }, {"mission/running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_bitread, FS_w_mip, VISIBLE, {v:&BitReads[1]}, }, {"mission/frequency", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_samplerate, FS_w_samplerate, VISIBLE, NO_FILETYPE_DATA, }, {"mission/samples", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_3byte, NO_WRITE_FUNCTION, VISIBLE, {s:0x021A}, }, {"mission/delay", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_delay, FS_w_delay, VISIBLE, NO_FILETYPE_DATA, }, {"mission/rollover", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlbit, FS_w_controlbit, VISIBLE, {u:_MASK_DS1921_ROLLOVER}, }, {"mission/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_volatile, FS_mdate, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_umdate, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission/sampling", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_bitread, NO_WRITE_FUNCTION, VISIBLE, {v:&BitReads[2]}, }, {"mission/easystart", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, NO_READ_FUNCTION, FS_easystart, VISIBLE, NO_FILETYPE_DATA, }, {"mission/templow", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_statusbit, FS_w_statusbit, VISIBLE, {u:_MASK_DS1921_TEMP_LOW_STATUS}, }, {"mission/temphigh", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_statusbit, FS_w_statusbit, VISIBLE, {u:_MASK_DS1921_TEMP_HIGH_STATUS}, }, {"mission/timer", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_statusbit, FS_w_statusbit, INVISIBLE, {u:_MASK_DS1921_TIMER_STATUS}, }, {"overtemp", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"overtemp/date", PROPERTY_LENGTH_DATE, &A1921m, ft_date, fc_volatile, FS_alarmstart, NO_WRITE_FUNCTION, VISIBLE, {s:0x0250}, }, {"overtemp/udate", PROPERTY_LENGTH_UNSIGNED, &A1921m, ft_unsigned, fc_volatile, FS_alarmudate, NO_WRITE_FUNCTION, VISIBLE, {s:0x0250}, }, {"overtemp/end", PROPERTY_LENGTH_DATE, &A1921m, ft_date, fc_volatile, FS_alarmend, NO_WRITE_FUNCTION, VISIBLE, {s:0x0250}, }, {"overtemp/count", PROPERTY_LENGTH_UNSIGNED, &A1921m, ft_unsigned, fc_volatile, FS_alarmcnt, NO_WRITE_FUNCTION, VISIBLE, {s:0x0250}, }, {"overtemp/elements", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_alarmelems, NO_WRITE_FUNCTION, VISIBLE, {s:0x0250}, }, {"overtemp/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_alarmtemp, FS_w_alarmtemp, VISIBLE, {s:0x020C}, }, {"undertemp", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"undertemp/date", PROPERTY_LENGTH_DATE, &A1921m, ft_date, fc_volatile, FS_alarmstart, NO_WRITE_FUNCTION, VISIBLE, {s:0x0220}, }, {"undertemp/udate", PROPERTY_LENGTH_UNSIGNED, &A1921m, ft_unsigned, fc_volatile, FS_alarmudate, NO_WRITE_FUNCTION, VISIBLE, {s:0x0220}, }, {"undertemp/end", PROPERTY_LENGTH_DATE, &A1921m, ft_date, fc_volatile, FS_alarmend, NO_WRITE_FUNCTION, VISIBLE, {s:0x0220}, }, {"undertemp/count", PROPERTY_LENGTH_UNSIGNED, &A1921m, ft_unsigned, fc_volatile, FS_alarmcnt, NO_WRITE_FUNCTION, VISIBLE, {s:0x0220}, }, {"undertemp/elements", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_alarmelems, NO_WRITE_FUNCTION, VISIBLE, {s:0x0220}, }, {"undertemp/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_alarmtemp, FS_w_alarmtemp, VISIBLE, {s:0x020C}, }, {"log", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"log/temperature", PROPERTY_LENGTH_TEMP, &A1921l, ft_temperature, fc_volatile, FS_r_logtemp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"log/date", PROPERTY_LENGTH_DATE, &A1921l, ft_date, fc_volatile, FS_r_logdate, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"log/udate", PROPERTY_LENGTH_UNSIGNED, &A1921l, ft_unsigned, fc_volatile, FS_r_logudate, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"log/elements", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_logelements, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, // no entries in these directories yet {"set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm/trigger", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm/templow", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlbit, FS_w_controlbit, VISIBLE, {u:_MASK_DS1921_TEMP_LOW_ALARM}, }, {"set_alarm/temphigh", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlbit, FS_w_controlbit, VISIBLE, {u:_MASK_DS1921_TEMP_HIGH_ALARM}, }, {"set_alarm/date", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_controlbit, FS_w_controlbit, VISIBLE, {u:_MASK_DS1921_TIMER_ALARM}, }, {"alarm_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_samplerate, FS_w_samplerate, VISIBLE, NO_FILETYPE_DATA, }, {"alarm_second", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_atime, FS_w_atime, VISIBLE, {s:0x0207}, }, {"alarm_minute", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_atime, FS_w_atime, VISIBLE, {s:0x0208}, }, {"alarm_hour", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_atime, FS_w_atime, VISIBLE, {s:0x0209}, }, {"alarm_dow", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_atime, FS_w_atime, VISIBLE, {s:0x020A}, }, {"alarm_trigger", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_atrig, FS_w_atrig, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(21, DS1921, DEV_alarm | DEV_temp | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_READ_MEMORY 0xF0 #define _1W_READ_MEMORY_WITH_CRC 0xA5 #define _1W_CLEAR_MEMORY 0x3C #define _1W_CONVERT_TEMPERATURE 0x44 /* Different version of the Thermocron, sorted by ID[11,12] of name. Keep in sorted order */ struct Version { UINT ID; char *name; _FLOAT histolow; _FLOAT resolution; _FLOAT rangelow; _FLOAT rangehigh; UINT delay; }; static struct Version Versions[] = { {0x000, "DS1921G-F5", -40.0, 0.500, -40., +85., 90,}, {0x064, "DS1921L-F50", -40.0, 0.500, -40., +85., 300,}, {0x15C, "DS1921L-F53", -40.0, 0.500, -30., +85., 300,}, {0x254, "DS1921L-F52", -40.0, 0.500, -20., +85., 300,}, {0x34C, "DS1921L-F51", -40.0, 0.500, -10., +85., 300,}, {0x3B2, "DS1921Z-F5", -5.5, 0.125, -5., +26., 360,}, {0x4F2, "DS1921H-F5", +14.5, 0.125, +15., +46., 360,}, }; /* AM/PM for hours field */ const int ampm[8] = { 0, 10, 20, 30, 0, 10, 12, 22 }; #define VersionElements ( sizeof(Versions) / sizeof(struct Version) ) static int VersionCmp(const void *pn, const void *version) { return (((((const struct parsedname *) pn)-> sn[5]) >> 4) | (((UINT) ((const struct parsedname *) pn)->sn[6]) << 4)) - ((const struct Version *) version)->ID; } /* ------- Functions ------------ */ /* DS1921 */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t length, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_temperature(int *T, const UINT delay, struct parsedname *pn); static GOOD_OR_BAD OW_clearmemory(struct parsedname *pn); static GOOD_OR_BAD OW_2date(_DATE * d, const BYTE * data); static GOOD_OR_BAD OW_2mdate(_DATE * d, const BYTE * data); static void OW_date(const _DATE * d, BYTE * data); static GOOD_OR_BAD OW_MIP(struct parsedname *pn); static GOOD_OR_BAD OW_FillMission(struct Mission *m, struct parsedname *pn); static GOOD_OR_BAD OW_alarmlog(int *t, int *c, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_stopmission(struct parsedname *pn); static GOOD_OR_BAD OW_startmission(UINT freq, struct parsedname *pn); static GOOD_OR_BAD OW_w_date(_DATE * D, struct parsedname *pn); static GOOD_OR_BAD OW_w_run(int state, struct parsedname *pn); static GOOD_OR_BAD OW_small_read(BYTE * buffer, size_t size, off_t location, struct parsedname *pn); static GOOD_OR_BAD OW_r_histogram_single(struct one_wire_query *owq); static GOOD_OR_BAD OW_r_histogram_all(struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logtemp_single(struct Version *v, struct Mission *mission, struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logtemp_all(struct Version *v, struct Mission *mission, struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logdate_all(struct Mission *mission, struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logdate_single(struct Mission *mission, struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logudate_all(struct Mission *mission, struct one_wire_query *owq); static GOOD_OR_BAD OW_r_logudate_single(struct Mission *mission, struct one_wire_query *owq); static ZERO_OR_ERROR FS_r_register(struct one_wire_query *owq) { BYTE c ; RETURN_ERROR_IF_BAD( OW_small_read( &c, 1, PN(owq)->selected_filetype->data.u, PN(owq) ) ) ; OWQ_U(owq) = c ; return 0 ; } static ZERO_OR_ERROR FS_w_register(struct one_wire_query *owq) { BYTE c = OWQ_U(owq) & 0xFF ; return GB_to_Z_OR_E( OW_w_mem( &c, 1, PN(owq)->selected_filetype->data.u, PN(owq) ) ) ; } /* ControlRegister reversed */ static ZERO_OR_ERROR FS_r_controlrbit(struct one_wire_query *owq) { UINT U = 0 ; UINT mask = PN(owq)->selected_filetype->data.u ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_Y(owq) = ( (U & mask) == 0 ) ; return z_or_e ; } /* ControlRegister reversed */ static ZERO_OR_ERROR FS_w_controlrbit(struct one_wire_query *owq) { UINT mask = PN(owq)->selected_filetype->data.u ; UINT Y = OWQ_Y(owq) ? 0 : mask ; return FS_w_sibling_bitwork( Y, mask, "ControlRegister", owq ) ; } static ZERO_OR_ERROR FS_r_controlbit(struct one_wire_query *owq) { UINT U = 0 ; UINT mask = PN(owq)->selected_filetype->data.u ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_Y(owq) = ( (U & mask) != 0 ) ; return z_or_e ; } static ZERO_OR_ERROR FS_w_controlbit(struct one_wire_query *owq) { UINT mask = PN(owq)->selected_filetype->data.u ; UINT Y = OWQ_Y(owq) ? mask : 0 ; return FS_w_sibling_bitwork( Y, mask, "ControlRegister", owq ) ; } static ZERO_OR_ERROR FS_r_statusbit(struct one_wire_query *owq) { UINT U = 0 ; UINT mask = PN(owq)->selected_filetype->data.u ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "StatusRegister", owq ) ; OWQ_Y(owq) = ( (U & mask) != 0 ) ; return z_or_e ; } static ZERO_OR_ERROR FS_w_statusbit(struct one_wire_query *owq) { UINT mask = PN(owq)->selected_filetype->data.u ; UINT Y = OWQ_Y(owq) ? mask : 0 ; return FS_w_sibling_bitwork( Y, mask, "StatusRegister", owq ) ; } static ZERO_OR_ERROR FS_bitread(struct one_wire_query *owq) { BYTE d; struct parsedname *pn = PN(owq); struct BitRead *br; if (pn->selected_filetype->data.v == NULL) { return -EINVAL; } br = ((struct BitRead *) (pn->selected_filetype->data.v)); RETURN_ERROR_IF_BAD(OW_small_read(&d, 1, br->location, pn)) ; OWQ_Y(owq) = UT_getbit(&d, br->bit); return 0; } static ZERO_OR_ERROR FS_bitwrite(struct one_wire_query *owq) { BYTE d; struct parsedname *pn = PN(owq); struct BitRead *br; if (pn->selected_filetype->data.v == NULL) { return -EINVAL; } br = ((struct BitRead *) (pn->selected_filetype->data.v)); RETURN_ERROR_IF_BAD(OW_small_read(&d, 1, br->location, pn)) ; UT_setbit(&d, br->bit, OWQ_Y(owq)); return GB_to_Z_OR_E(OW_w_mem(&d, 1, br->location, pn)) ; } static ZERO_OR_ERROR FS_rbitread(struct one_wire_query *owq) { ZERO_OR_ERROR ret = FS_bitread(owq); OWQ_Y(owq) = !OWQ_Y(owq); return ret; } static ZERO_OR_ERROR FS_rbitwrite(struct one_wire_query *owq) { OWQ_Y(owq) = !OWQ_Y(owq); return FS_bitwrite(owq); } /* histogram counts */ static ZERO_OR_ERROR FS_r_histogram(struct one_wire_query *owq) { switch (OWQ_pn(owq).extension) { case EXTENSION_ALL: return GB_to_Z_OR_E( OW_r_histogram_all(owq) ); default: return GB_to_Z_OR_E( OW_r_histogram_single(owq) ); } } static ZERO_OR_ERROR FS_r_histotemp(struct one_wire_query *owq) { int extension = OWQ_pn(owq).extension; struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } if (extension == EXTENSION_ALL) { /* ALL */ int i; for (i = 0; i < HISTOGRAM_DATA_ELEMENTS; ++i) { OWQ_array_F(owq, i) = v->histolow + 4 * i * v->resolution; } } else { /* element */ OWQ_F(owq) = v->histolow + 4 * extension * v->resolution; } return 0; } static ZERO_OR_ERROR FS_r_histogap(struct one_wire_query *owq) { struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } OWQ_F(owq) = v->resolution * 4; return 0; } static ZERO_OR_ERROR FS_r_histoelem(struct one_wire_query *owq) { OWQ_U(owq) = HISTOGRAM_DATA_ELEMENTS; return 0; } static ZERO_OR_ERROR FS_r_version(struct one_wire_query *owq) { struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); return v ? OWQ_format_output_offset_and_size_z(v->name, owq) : -ENOENT; } static ZERO_OR_ERROR FS_r_resolution(struct one_wire_query *owq) { struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } OWQ_F(owq) = v->resolution; return 0; } static ZERO_OR_ERROR FS_r_rangelow(struct one_wire_query *owq) { struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } OWQ_F(owq) = v->rangelow; return 0; } static ZERO_OR_ERROR FS_r_rangehigh(struct one_wire_query *owq) { struct Version *v = (struct Version *) bsearch(PN(owq), Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } OWQ_F(owq) = v->rangehigh; return 0; } /* Temperature -- force if not in progress */ static ZERO_OR_ERROR FS_r_temperature(struct one_wire_query *owq) { int temp; struct parsedname *pn = PN(owq); struct Version *v = (struct Version *) bsearch(pn, Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } if ( BAD(OW_MIP(pn)) ) { return -EBUSY; /* Mission in progress */ } RETURN_ERROR_IF_BAD(OW_temperature(&temp, v->delay, pn)) ; OWQ_F(owq) = (_FLOAT) temp *v->resolution + v->histolow; return 0; } /* read counter */ /* Save a function by shoving address in data field */ static ZERO_OR_ERROR FS_r_3byte(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); size_t addr = pn->selected_filetype->data.s; BYTE data[3]; RETURN_ERROR_IF_BAD(OW_small_read(data, 3, addr, pn)) ; OWQ_U(owq) = (((((UINT) data[2]) << 8) | data[1]) << 8) | data[0]; return 0; } /* mission start date */ static ZERO_OR_ERROR FS_mdate(struct one_wire_query *owq) { struct Mission mission; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, PN(owq))) ; /* Get date from chip */ OWQ_D(owq) = mission.start; return 0; } /* mission start date */ static ZERO_OR_ERROR FS_umdate(struct one_wire_query *owq) { struct Mission mission; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, PN(owq))) ; /* Get date from chip */ OWQ_U(owq) = mission.start; return 0; } static ZERO_OR_ERROR FS_alarmelems(struct one_wire_query *owq) { struct Mission mission; struct parsedname *pn = PN(owq); int t[12]; int c[12]; int i; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, pn)) ; RETURN_ERROR_IF_BAD(OW_alarmlog(t, c, pn->selected_filetype->data.s, pn)) ; for (i = 0; i < 12; ++i) { if (c[i] == 0) { break; } } OWQ_U(owq) = i; return 0; } /* Temperature -- force if not in progress */ static ZERO_OR_ERROR FS_r_alarmtemp(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[1]; struct Version *v = (struct Version *) bsearch(pn, Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } RETURN_ERROR_IF_BAD(OW_small_read(data, 1, pn->selected_filetype->data.s, pn)) ; OWQ_F(owq) = (_FLOAT) data[0] * v->resolution + v->histolow; return 0; } /* Temperature -- force if not in progress */ static ZERO_OR_ERROR FS_w_alarmtemp(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[1]; struct Version *v = (struct Version *) bsearch(pn, Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } if ( BAD(OW_MIP(pn)) ) { return -EBUSY; } data[0] = (OWQ_F(owq) - v->histolow) / v->resolution; return GB_to_Z_OR_E(OW_w_mem(data, 1, pn->selected_filetype->data.s, pn)) ; } static ZERO_OR_ERROR FS_alarmudate(struct one_wire_query *owq) { struct Mission mission; struct parsedname *pn = PN(owq); int t[12]; int c[12]; int i; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, pn)) ; RETURN_ERROR_IF_BAD(OW_alarmlog(t, c, pn->selected_filetype->data.s, pn)) ; for (i = 0; i < 12; ++i) { OWQ_array_U(owq, i) = mission.start + t[i] * mission.interval; } return 0; } static ZERO_OR_ERROR FS_alarmstart(struct one_wire_query *owq) { struct Mission mission; struct parsedname *pn = PN(owq); int t[12]; int c[12]; int i; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, pn)) ; RETURN_ERROR_IF_BAD(OW_alarmlog(t, c, pn->selected_filetype->data.s, pn)) ; for (i = 0; i < 12; ++i) { OWQ_array_D(owq, i) = mission.start + t[i] * mission.interval; } return 0; } static ZERO_OR_ERROR FS_alarmend(struct one_wire_query *owq) { struct Mission mission; struct parsedname *pn = PN(owq); int t[12]; int c[12]; int i; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, pn)) ; RETURN_ERROR_IF_BAD(OW_alarmlog(t, c, pn->selected_filetype->data.s, pn)) ; for (i = 0; i < 12; ++i) { OWQ_array_D(owq, i) = mission.start + (t[i] + c[i]) * mission.interval; } return 0; } static ZERO_OR_ERROR FS_alarmcnt(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int t[12]; int c[12]; int i; RETURN_ERROR_IF_BAD(OW_alarmlog(t, c, pn->selected_filetype->data.s, pn)) ; for (i = 0; i < 12; ++i) { OWQ_array_U(owq, i) = c[i]; } return 0; } /* read clock */ static ZERO_OR_ERROR FS_r_date(struct one_wire_query *owq) { BYTE data[7]; /* Get date from chip */ RETURN_ERROR_IF_BAD(OW_small_read(data, 7, 0x0200, PN(owq))) ; return GB_to_Z_OR_E( OW_2date(&OWQ_D(owq), data) ); } /* read clock */ static ZERO_OR_ERROR FS_r_counter(struct one_wire_query *owq) { BYTE data[7]; _DATE d; /* Get date from chip */ RETURN_ERROR_IF_BAD( OW_small_read(data, 7, 0x0200, PN(owq)) ) ; RETURN_ERROR_IF_BAD( OW_2date(&d, data) ) ; OWQ_U(owq) = (UINT) d; return 0; } /* set clock */ static ZERO_OR_ERROR FS_w_date(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_date(&OWQ_D(owq), PN(owq)) ); } static ZERO_OR_ERROR FS_w_counter(struct one_wire_query *owq) { BYTE data[7]; struct parsedname *pn = PN(owq); _DATE d = (_DATE) OWQ_U(owq); /* Busy if in mission */ if ( BAD(OW_MIP(pn)) ) { return -EBUSY; } OW_date(&d, data); return GB_to_Z_OR_E( OW_w_mem(data, 7, 0x0200, pn) ) ; } /* stop/start clock running */ static ZERO_OR_ERROR FS_w_run(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_run(OWQ_Y(owq), PN(owq)) ); } /* clock running? */ static ZERO_OR_ERROR FS_r_run(struct one_wire_query *owq) { BYTE cr; RETURN_ERROR_IF_BAD(OW_small_read(&cr, 1, 0x020E, PN(owq))) ; OWQ_Y(owq) = ((cr & 0x80) == 0); return 0; } /* start/stop mission */ static ZERO_OR_ERROR FS_w_mip(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (OWQ_Y(owq)) { /* start a mission! */ BYTE data; RETURN_ERROR_IF_BAD(OW_small_read(&data, 1, 0x020D, pn)) ; return GB_to_Z_OR_E( OW_startmission((UINT) data, pn) ); } else { return GB_to_Z_OR_E( OW_stopmission(pn) ); } } /* read the interval between samples during a mission */ static ZERO_OR_ERROR FS_r_samplerate(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_small_read(&data, 1, 0x020D, PN(owq))) ; OWQ_U(owq) = data; return 0; } /* write the interval between samples during a mission */ static ZERO_OR_ERROR FS_w_samplerate(struct one_wire_query *owq) { if (OWQ_U(owq) > 0) { return GB_to_Z_OR_E( OW_startmission(OWQ_U(owq), PN(owq)) ); } else { return GB_to_Z_OR_E( OW_stopmission(PN(owq)) ); } } /* read the alarm time field (not bit 7, though) */ static ZERO_OR_ERROR FS_r_atime(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_small_read(&data, 1, OWQ_pn(owq).selected_filetype->data.s, PN(owq))) ; OWQ_U(owq) = data & 0x7F; return 0; } /* write one of the alarm fields */ /* NOTE: keep first bit */ static ZERO_OR_ERROR FS_w_atime(struct one_wire_query *owq) { BYTE data; struct parsedname *pn = PN(owq); RETURN_ERROR_IF_BAD(OW_small_read(&data, 1, pn->selected_filetype->data.s, pn)) ; data = ((BYTE) OWQ_U(owq)) | (data & 0x80); /* EM on */ return GB_to_Z_OR_E(OW_w_mem(&data, 1, pn->selected_filetype->data.s, pn)) ; } /* read the alarm time field (not bit 7, though) */ static ZERO_OR_ERROR FS_r_atrig(struct one_wire_query *owq) { BYTE data[4]; RETURN_ERROR_IF_BAD(OW_small_read(data, 4, 0x0207, PN(owq))) ; if (data[3] & 0x80) { OWQ_U(owq) = 4; } else if (data[2] & 0x80) { OWQ_U(owq) = 3; } else if (data[1] & 0x80) { OWQ_U(owq) = 2; } else if (data[0] & 0x80) { OWQ_U(owq) = 1; } else { OWQ_U(owq) = 0; } return 0; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, pagesize, COMMON_read_memory_crc16_A5)) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E( COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem) ) ; } static ZERO_OR_ERROR FS_w_atrig(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[4]; RETURN_ERROR_IF_BAD(OW_small_read(data, 4, 0x0207, pn)) ; data[0] &= 0x7F; data[1] &= 0x7F; data[2] &= 0x7F; data[3] &= 0x7F; switch (OWQ_U(owq)) { /* Intentional fall-throughs in cases */ case 1: data[0] |= 0x80; case 2: data[1] |= 0x80; case 3: data[2] |= 0x80; case 4: data[3] |= 0x80; } return GB_to_Z_OR_E( OW_w_mem(data, 4, 0x0207, pn)) ; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32 ; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize ) ; } /* temperature log */ static ZERO_OR_ERROR FS_logelements(struct one_wire_query *owq) { struct Mission mission; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, PN(owq))) ; OWQ_U(owq) = (mission.samples > LOG_DATA_ELEMENTS) ? LOG_DATA_ELEMENTS : mission.samples; return 0; } /* temperature log */ static ZERO_OR_ERROR FS_r_logdate(struct one_wire_query *owq) { struct Mission mission; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, PN(owq))) ; switch (OWQ_pn(owq).extension) { case EXTENSION_ALL: return GB_to_Z_OR_E( OW_r_logdate_all(&mission, owq) ); default: return GB_to_Z_OR_E( OW_r_logdate_single(&mission, owq) ); } } /* temperature log */ static ZERO_OR_ERROR FS_r_logudate(struct one_wire_query *owq) { struct Mission mission; RETURN_ERROR_IF_BAD(OW_FillMission(&mission, PN(owq))) ; switch (OWQ_pn(owq).extension) { case EXTENSION_ALL: return GB_to_Z_OR_E( OW_r_logudate_all(&mission, owq) ); default: return GB_to_Z_OR_E( OW_r_logudate_single(&mission, owq) ); } } /* mission delay */ static ZERO_OR_ERROR FS_r_delay(struct one_wire_query *owq) { BYTE data[2]; RETURN_ERROR_IF_BAD(OW_small_read(data, 2, (size_t) 0x0212, PN(owq))) ; OWQ_U(owq) = (((UINT) data[1]) << 8) | data[0]; return 0; } /* mission delay */ static ZERO_OR_ERROR FS_w_delay(struct one_wire_query *owq) { BYTE data[2] = { LOW_HIGH_ADDRESS(OWQ_U(owq)), }; if ( BAD(OW_MIP(PN(owq))) ) { return -EBUSY; } return GB_to_Z_OR_E(OW_w_mem(data, 2, (size_t) 0x0212, PN(owq))) ; } /* temperature log */ static ZERO_OR_ERROR FS_r_logtemp(struct one_wire_query *owq) { struct Mission mission; struct parsedname *pn = PN(owq); struct Version *v = (struct Version *) bsearch(pn, Versions, VersionElements, sizeof(struct Version), VersionCmp); if (v == NULL) { return -EINVAL; } RETURN_ERROR_IF_BAD(OW_FillMission(&mission, pn)) ; switch (pn->extension) { case EXTENSION_ALL: return GB_to_Z_OR_E( OW_r_logtemp_all(v, &mission, owq) ); default: return GB_to_Z_OR_E( OW_r_logtemp_single(v, &mission, owq) ); } } static ZERO_OR_ERROR FS_easystart(struct one_wire_query *owq) { /* write 0x020E -- 0x0214 */ BYTE data[] = { 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* Stop clock, no rollover, no delay, temp alarms on, alarms cleared */ if ( BAD( OW_w_mem(data, 7, 0x020E, PN(owq)) ) ) { return -EINVAL; } return GB_to_Z_OR_E( OW_startmission(OWQ_U(owq), PN(owq)) ); } static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 1 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; int rest = 32 - (offset & 0x1F); struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 3 + size), TRXN_END, }; struct transaction_log tcopy_crc[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 1 + rest), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(1), /* 1 msec >> 2 usec per byte */ TRXN_END, }; /* Copy to scratchpad -- use CRC16 if write to end of page, but don't force it */ memcpy(&p[3], data, size); if ((offset + size) & 0x1F) { /* to end of page */ RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; } else { RETURN_BAD_IF_BAD(BUS_transaction(tcopy_crc, pn)) ; } /* Re-read scratchpad and compare */ /* Note: location of data has now shifted down a byte for E/S register */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* write Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(twrite, pn) ; } static GOOD_OR_BAD OW_temperature(int *T, const UINT delay, struct parsedname *pn) { BYTE convert[] = { _1W_CONVERT_TEMPERATURE, }; BYTE data; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(convert), TRXN_END, }; /* Mission not progress, force conversion */ RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; /* Thermochron is powered (internally by battery) -- no reason to hold bus */ UT_delay(delay); RETURN_BAD_IF_BAD(OW_small_read(&data, 1, 0x0211, pn)) ; *T = (int) data; return gbGOOD; } static GOOD_OR_BAD OW_clearmemory(struct parsedname *pn) { /* Clear memory command */ BYTE cr[] = { _1W_CLEAR_MEMORY, }; BYTE flag; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(cr), TRXN_DELAY(1), TRXN_END, }; /* Clear memory flag */ RETURN_BAD_IF_BAD( OW_small_read(&flag, 1, 0x020E, pn) ); flag = (flag & 0x3F) | 0x40; RETURN_BAD_IF_BAD( OW_w_mem(&flag, 1, 0x020E, pn) ); return BUS_transaction(t, pn) ; } /* translate 7 byte field to a Unix-style date (number) */ static GOOD_OR_BAD OW_2date(_DATE * d, const BYTE * data) { struct tm t; /* Prefill entries */ d[0] = NOW_TIME; if (gmtime_r(d, &t) == NULL) { return gbBAD; } /* Get date from chip */ t.tm_sec = (data[0] & 0x0F) + 10 * (data[0] >> 4); /* BCD->dec */ t.tm_min = (data[1] & 0x0F) + 10 * (data[1] >> 4); /* BCD->dec */ t.tm_hour = (data[2] & 0x0F) + ampm[data[2] >> 4]; /* BCD->dec */ t.tm_mday = (data[4] & 0x0F) + 10 * (data[4] >> 4); /* BCD->dec */ t.tm_mon = (data[5] & 0x0F) + 10 * ((data[5] & 0x10) >> 4); /* BCD->dec */ t.tm_year = (data[6] & 0x0F) + 10 * (data[6] >> 4) + 100 * (2 - (data[5] >> 7)); /* BCD->dec */ //printf("_DATE_READ data=%2X, %2X, %2X, %2X, %2X, %2X, %2X\n",data[0],data[1],data[2],data[3],data[4],data[5],data[6]); //printf("_DATE: sec=%d, min=%d, hour=%d, mday=%d, mon=%d, year=%d, wday=%d, isdst=%d\n",tm.tm_sec,tm.tm_min,tm.tm_hour,tm.tm_mday,tm.tm_mon,tm.tm_year,tm.tm_wday,tm.tm_isdst) ; /* Pass through time_t again to validate */ if ((d[0] = mktime(&t)) == (time_t) - 1) { return gbBAD; } return gbGOOD; } /* translate m byte field to a Unix-style date (number) */ static GOOD_OR_BAD OW_2mdate(_DATE * d, const BYTE * data) { struct tm t; int year; /* Prefill entries */ d[0] = NOW_TIME; if (gmtime_r(d, &t) == NULL) { return gbBAD; } year = t.tm_year; /* Get date from chip */ t.tm_sec = 0; /* BCD->dec */ t.tm_min = (data[0] & 0x0F) + 10 * (data[0] >> 4); /* BCD->dec */ t.tm_hour = (data[1] & 0x0F) + ampm[data[1] >> 4]; /* BCD->dec */ t.tm_mday = (data[2] & 0x0F) + 10 * (data[2] >> 4); /* BCD->dec */ t.tm_mon = (data[3] & 0x0F) + 10 * ((data[3] & 0x10) >> 4); /* BCD->dec */ t.tm_year = (data[4] & 0x0F) + 10 * (data[4] >> 4); /* BCD->dec */ /* Adjust the century -- should be within 50 years of current */ while (t.tm_year + 50 < year) t.tm_year += 100; /* Pass through time_t again to validate */ if ((d[0] = mktime(&t)) == (time_t) - 1) { return gbBAD; } return gbGOOD; } /* set clock */ static void OW_date(const _DATE * d, BYTE * data) { struct tm tm; int year; /* Convert time format */ gmtime_r(d, &tm); data[0] = tm.tm_sec + 6 * (tm.tm_sec / 10); /* dec->bcd */ data[1] = tm.tm_min + 6 * (tm.tm_min / 10); /* dec->bcd */ data[2] = tm.tm_hour + 6 * (tm.tm_hour / 10); /* dec->bcd */ data[3] = tm.tm_wday; /* dec->bcd */ data[4] = tm.tm_mday + 6 * (tm.tm_mday / 10); /* dec->bcd */ data[5] = tm.tm_mon + 6 * (tm.tm_mon / 10); /* dec->bcd */ year = tm.tm_year % 100; data[6] = year + 6 * (year / 10); /* dec->bcd */ if (tm.tm_year > 99 && tm.tm_year < 200) { data[5] |= 0x80; } //printf("_DATE_WRITE data=%2X, %2X, %2X, %2X, %2X, %2X, %2X\n",data[0],data[1],data[2],data[3],data[4],data[5],data[6]); //printf("_DATE: sec=%d, min=%d, hour=%d, mday=%d, mon=%d, year=%d, wday=%d, isdst=%d\n",tm.tm_sec,tm.tm_min,tm.tm_hour,tm.tm_mday,tm.tm_mon,tm.tm_year,tm.tm_wday,tm.tm_isdst) ; } /* many things are disallowed if mission in progress */ /* returns 1 if MIP, 0 if not, <0 if error */ static GOOD_OR_BAD OW_MIP(struct parsedname *pn) { BYTE data; RETURN_BAD_IF_BAD( OW_small_read(&data, 1, 0x0214, pn) ); /* read status register */ return UT_getbit(&data, 5)==0 ? gbGOOD : gbBAD ; } static GOOD_OR_BAD OW_FillMission(struct Mission *mission, struct parsedname *pn) { BYTE data[16]; /* Get date from chip */ RETURN_BAD_IF_BAD(OW_small_read(data, 16, 0x020D, pn)) ; mission->interval = 60 * (int) data[0]; mission->rollover = UT_getbit(&data[1], 3); mission->samples = (((((UINT) data[15]) << 8) | data[14]) << 8) | data[13]; return OW_2mdate(&(mission->start), &data[8]); } static GOOD_OR_BAD OW_alarmlog(int *t, int *c, off_t offset, struct parsedname *pn) { BYTE data[48]; int i, j = 0; OWQ_allocate_struct_and_pointer(owq_alog); OWQ_create_temporary(owq_alog, (char *) data, sizeof(data), offset, pn); if ( BAD( COMMON_OWQ_readwrite_paged(owq_alog, 0, 32, COMMON_read_memory_crc16_A5) ) ) { return gbBAD; } for (i = 0; i < 12; ++i) { t[i] = (((((UINT) data[j + 2]) << 8) | data[j + 1]) << 8) | data[j]; c[i] = data[j + 3]; j += 4; } return gbGOOD; } static GOOD_OR_BAD OW_stopmission(struct parsedname *pn) { BYTE data = 0x00; /* dummy */ return OW_small_read(&data, 1, 0x0210, pn); } static GOOD_OR_BAD OW_startmission(UINT freq, struct parsedname *pn) { BYTE data; /* stop the mission */ RETURN_BAD_IF_BAD(OW_stopmission(pn)) ; if (freq == 0) { return gbGOOD; /* stay stopped */ } if (freq > 255) { return gbBAD; /* Bad interval */ } RETURN_BAD_IF_BAD(OW_small_read(&data, 1, 0x020E, pn)) ; if ((data & 0x80)) { /* clock stopped */ _DATE d = NOW_TIME; /* start clock */ RETURN_BAD_IF_BAD(OW_w_date(&d, pn)) ; UT_delay(1000); /* wait for the clock to count a second */ } /* clear memory */ RETURN_BAD_IF_BAD( OW_clearmemory(pn)) ; /* finally, set the sample interval (to start the mission) */ data = BYTE_MASK(freq); return OW_w_mem(&data, 1, 0x020D, pn); } /* set clock */ static GOOD_OR_BAD OW_w_date(_DATE * D, struct parsedname *pn) { BYTE data[7]; RETURN_BAD_IF_BAD(OW_MIP(pn)) ; OW_date(D, data); RETURN_BAD_IF_BAD( OW_w_mem(data, 7, 0x0200, pn) ); return GB_to_Z_OR_E( OW_w_run(1, pn) ); } /* stop/start clock running */ static GOOD_OR_BAD OW_w_run(int state, struct parsedname *pn) { BYTE cr; RETURN_BAD_IF_BAD(OW_small_read(&cr, 1, 0x020E, pn)) ; cr = state ? cr & 0x7F : cr | 0x80; return OW_w_mem(&cr, 1, 0x020E, pn) ; } static GOOD_OR_BAD OW_small_read(BYTE * buffer, size_t size, off_t location, struct parsedname *pn) { OWQ_allocate_struct_and_pointer(owq_small); OWQ_create_temporary(owq_small, (char *) buffer, size, location, pn); return COMMON_read_memory_crc16_A5(owq_small, 0, 32)==0 ? gbGOOD : gbBAD ; } #define HISTOGRAM_DATA_SIZE 2 static GOOD_OR_BAD OW_r_histogram_all(struct one_wire_query *owq) { size_t pagesize = 32; int i; BYTE data[HISTOGRAM_DATA_ELEMENTS * HISTOGRAM_DATA_SIZE]; OWQ_allocate_struct_and_pointer(owq_histo); OWQ_create_temporary(owq_histo, (char *) data, sizeof(data), 0x0800, PN(owq)); if ( BAD( COMMON_OWQ_readwrite_paged(owq_histo, 0, pagesize, COMMON_read_memory_crc16_A5) ) ) { return gbBAD; } for (i = 0; i < HISTOGRAM_DATA_ELEMENTS; ++i) { OWQ_array_U(owq, i) = (((UINT) data[i * HISTOGRAM_DATA_SIZE + 1]) << 8) | data[i * HISTOGRAM_DATA_SIZE]; } return gbGOOD; } static GOOD_OR_BAD OW_r_histogram_single(struct one_wire_query *owq) { BYTE data[HISTOGRAM_DATA_SIZE]; RETURN_BAD_IF_BAD(OW_small_read(data, 2, (size_t) 0x800 + OWQ_pn(owq).extension * HISTOGRAM_DATA_SIZE, PN(owq))) ; OWQ_U(owq) = (((UINT) data[1]) << 8) | data[0]; return gbGOOD; } /* temperature log */ static GOOD_OR_BAD OW_r_logtemp_single(struct Version *v, struct Mission *mission, struct one_wire_query *owq) { int pass = 0; int off = 0; BYTE data[1]; struct parsedname *pn = PN(owq); if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 off = mission->samples % LOG_DATA_ELEMENTS; // samples%2048 } if (pass) { RETURN_BAD_IF_BAD(OW_small_read(data, 1, (size_t) 0x1000 + ((pn->extension + off) % LOG_DATA_ELEMENTS), pn)) ; } else { RETURN_BAD_IF_BAD(OW_small_read(data, 1, (size_t) 0x1000 + pn->extension, pn)) ; } OWQ_F(owq) = (_FLOAT) data[0] * v->resolution + v->histolow; return gbGOOD; } /* temperature log */ static GOOD_OR_BAD OW_r_logtemp_all(struct Version *v, struct Mission *mission, struct one_wire_query *owq) { int pass = 0; int off = 0; size_t pagesize = 32; int i; BYTE data[LOG_DATA_ELEMENTS]; OWQ_allocate_struct_and_pointer(owq_log); if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 off = mission->samples % LOG_DATA_ELEMENTS; // samples%2048 } OWQ_create_temporary(owq_log, (char *) data, sizeof(data), 0x1000, PN(owq)); RETURN_BAD_IF_BAD(COMMON_OWQ_readwrite_paged(owq_log, 0, pagesize, COMMON_read_memory_crc16_A5) ); if (pass) { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) { OWQ_array_F(owq, i) = (_FLOAT) data[(i + off) % LOG_DATA_ELEMENTS] * v->resolution + v->histolow; } } else { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) { OWQ_array_F(owq, i) = (_FLOAT) data[i] * v->resolution + v->histolow; } } return gbGOOD; } static GOOD_OR_BAD OW_r_logdate_single(struct Mission *mission, struct one_wire_query *owq) { int extension = OWQ_pn(owq).extension; int pass = 0; if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 } if (pass) { OWQ_D(owq) = mission->start + (mission->samples - LOG_DATA_ELEMENTS - extension) * mission->interval; } else { OWQ_D(owq) = mission->start + extension * mission->interval; } return gbGOOD; } static GOOD_OR_BAD OW_r_logdate_all(struct Mission *mission, struct one_wire_query *owq) { int pass = 0; int i; if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 } if (pass) { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) OWQ_array_D(owq, i) = mission->start + (mission->samples - LOG_DATA_ELEMENTS - i) * mission->interval; } else { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) OWQ_array_D(owq, i) = mission->start + i * mission->interval; } return gbGOOD; } static GOOD_OR_BAD OW_r_logudate_single(struct Mission *mission, struct one_wire_query *owq) { int extension = OWQ_pn(owq).extension; int pass = 0; if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 } if (pass) { OWQ_U(owq) = mission->start + (mission->samples - LOG_DATA_ELEMENTS - extension) * mission->interval; } else { OWQ_U(owq) = mission->start + extension * mission->interval; } return gbGOOD; } static GOOD_OR_BAD OW_r_logudate_all(struct Mission *mission, struct one_wire_query *owq) { int pass = 0; int i; if (mission->rollover) { pass = mission->samples / LOG_DATA_ELEMENTS; // samples/2048 } if (pass) { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) { OWQ_array_U(owq, i) = mission->start + (mission->samples - LOG_DATA_ELEMENTS - i) * mission->interval; } } else { for (i = 0; i < LOG_DATA_ELEMENTS; ++i) { OWQ_array_U(owq, i) = mission->start + i * mission->interval; } } return gbGOOD; } #undef HISTOGRAM_DATA_SIZE #undef LOG_DATA_ELEMENTS #undef HISTOGRAM_DATA_ELEMENTS owfs-2.8p15/module/owlib/src/c/ow_opt.c0000644000175000017500000007442411751565563014726 00000000000000/* $Id: ow_opt.c,v 1.166 2012/05/06 21:21:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #define _GNU_SOURCE #include // for getline #undef _GNU_SOURCE #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_pid.h" #include "ow_external.h" struct lineparse { char * line; size_t line_length ; const ASCII *file; ASCII *prog; ASCII *opt; ASCII *val; int reverse_prog; int c; int line_number; }; static void ParseTheLine(struct lineparse *lp); static GOOD_OR_BAD ConfigurationFile(const ASCII * file); static int ParseInterp(struct lineparse *lp); static GOOD_OR_BAD OW_parsevalue_I(long long int *var, const ASCII * str); static GOOD_OR_BAD OW_parsevalue_F(_FLOAT *var, const ASCII * str); #define NO_LINKED_VAR NULL const struct option owopts_long[] = { {"alias", required_argument, NO_LINKED_VAR, 'a'}, {"aliases", required_argument, NO_LINKED_VAR, 'a'}, {"aliasfile", required_argument, NO_LINKED_VAR, 'a'}, {"configuration", required_argument, NO_LINKED_VAR, 'c'}, {"device", required_argument, NO_LINKED_VAR, 'd'}, {"usb", optional_argument, NO_LINKED_VAR, 'u'}, {"USB", optional_argument, NO_LINKED_VAR, 'u'}, {"help", optional_argument, NO_LINKED_VAR, 'h'}, {"port", required_argument, NO_LINKED_VAR, 'p'}, {"mountpoint", required_argument, NO_LINKED_VAR, 'm'}, {"server", required_argument, NO_LINKED_VAR, 's'}, {"readonly", no_argument, NO_LINKED_VAR, 'r'}, {"safemode", no_argument, NO_LINKED_VAR, e_safemode}, {"safe_mode", no_argument, NO_LINKED_VAR, e_safemode}, {"safe", no_argument, NO_LINKED_VAR, e_safemode}, {"write", no_argument, NO_LINKED_VAR, 'w'}, {"Celsius", no_argument, NO_LINKED_VAR, 'C'}, {"celsius", no_argument, NO_LINKED_VAR, 'C'}, {"Fahrenheit", no_argument, NO_LINKED_VAR, 'F'}, {"fahrenheit", no_argument, NO_LINKED_VAR, 'F'}, {"Kelvin", no_argument, NO_LINKED_VAR, 'K'}, {"kelvin", no_argument, NO_LINKED_VAR, 'K'}, {"Rankine", no_argument, NO_LINKED_VAR, 'R'}, {"rankine", no_argument, NO_LINKED_VAR, 'R'}, {"mbar", no_argument, NO_LINKED_VAR, e_pressure_mbar}, {"millibar", no_argument, NO_LINKED_VAR, e_pressure_mbar}, {"mBar", no_argument, NO_LINKED_VAR, e_pressure_mbar}, {"atm", no_argument, NO_LINKED_VAR, e_pressure_atm}, {"mmhg", no_argument, NO_LINKED_VAR, e_pressure_mmhg}, {"mmHg", no_argument, NO_LINKED_VAR, e_pressure_mmhg}, {"torr", no_argument, NO_LINKED_VAR, e_pressure_mmhg}, {"inhg", no_argument, NO_LINKED_VAR, e_pressure_inhg}, {"inHg", no_argument, NO_LINKED_VAR, e_pressure_inhg}, {"psi", no_argument, NO_LINKED_VAR, e_pressure_psi}, {"psia", no_argument, NO_LINKED_VAR, e_pressure_psi}, {"psig", no_argument, NO_LINKED_VAR, e_pressure_psi}, {"Pa", no_argument, NO_LINKED_VAR, e_pressure_Pa}, {"pa", no_argument, NO_LINKED_VAR, e_pressure_Pa}, {"pascal", no_argument, NO_LINKED_VAR, e_pressure_Pa}, {"version", no_argument, NO_LINKED_VAR, 'V'}, {"format", required_argument, NO_LINKED_VAR, 'f'}, {"pid_file", required_argument, NO_LINKED_VAR, 'P'}, {"pid-file", required_argument, NO_LINKED_VAR, 'P'}, {"unaliased", no_argument, &Globals.unaliased, 1 }, {"aliased", no_argument, &Globals.unaliased, 0 }, {"uncached", no_argument, &Globals.uncached, 1 }, {"cached", no_argument, &Globals.uncached, 0 }, {"external", no_argument, &Globals.allow_external, 1}, {"no_external", no_argument, &Globals.allow_external, 0}, {"background", no_argument, &Globals.want_background, 1}, {"foreground", no_argument, &Globals.want_background, 0}, {"fatal_debug", no_argument, &Globals.fatal_debug, 1}, {"fatal-debug", no_argument, &Globals.fatal_debug, 1}, {"fatal_debug_file", required_argument, NO_LINKED_VAR, e_fatal_debug_file}, {"fatal-debug-file", required_argument, NO_LINKED_VAR, e_fatal_debug_file}, {"error_print", required_argument, NO_LINKED_VAR, e_error_print}, {"error-print", required_argument, NO_LINKED_VAR, e_error_print}, {"errorprint", required_argument, NO_LINKED_VAR, e_error_print}, {"error_level", required_argument, NO_LINKED_VAR, e_error_level}, {"error-level", required_argument, NO_LINKED_VAR, e_error_level}, {"errorlevel", required_argument, NO_LINKED_VAR, e_error_level}, {"debug", no_argument, NO_LINKED_VAR, e_debug}, {"concurrent_connections", required_argument, NO_LINKED_VAR, e_concurrent_connections}, {"concurrent-connections", required_argument, NO_LINKED_VAR, e_concurrent_connections}, {"max-connections", required_argument, NO_LINKED_VAR, e_concurrent_connections}, {"max_connections", required_argument, NO_LINKED_VAR, e_concurrent_connections}, {"cache_size", required_argument, NO_LINKED_VAR, e_cache_size}, /* max cache size */ {"cache-size", required_argument, NO_LINKED_VAR, e_cache_size}, /* max cache size */ {"cachesize", required_argument, NO_LINKED_VAR, e_cache_size}, /* max cache size */ {"fuse_opt", required_argument, NO_LINKED_VAR, e_fuse_opt}, /* owfs, fuse mount option */ {"fuse-opt", required_argument, NO_LINKED_VAR, e_fuse_opt}, /* owfs, fuse mount option */ {"fuseopt", required_argument, NO_LINKED_VAR, e_fuse_opt}, /* owfs, fuse mount option */ {"fuse_open_opt", required_argument, NO_LINKED_VAR, e_fuse_open_opt}, /* owfs, fuse open option */ {"fuse-open-opt", required_argument, NO_LINKED_VAR, e_fuse_open_opt}, /* owfs, fuse open option */ {"fuseopenopt", required_argument, NO_LINKED_VAR, e_fuse_open_opt}, /* owfs, fuse open option */ {"max_clients", required_argument, NO_LINKED_VAR, e_max_clients}, /* ftp max connections */ {"max-clients", required_argument, NO_LINKED_VAR, e_max_clients}, /* ftp max connections */ {"maxclients", required_argument, NO_LINKED_VAR, e_max_clients}, /* ftp max connections */ {"passive", required_argument, NO_LINKED_VAR, e_passive}, /* DS9097 passive */ {"PASSIVE", required_argument, NO_LINKED_VAR, e_passive}, /* DS9097 passive */ {"i2c", optional_argument, NO_LINKED_VAR, e_i2c}, /* i2c adapters */ {"I2C", optional_argument, NO_LINKED_VAR, e_i2c}, /* i2c adapters */ {"HA7", optional_argument, NO_LINKED_VAR, e_ha7}, /* HA7Net */ {"ha7", optional_argument, NO_LINKED_VAR, e_ha7}, /* HA7Net */ {"HA7NET", optional_argument, NO_LINKED_VAR, e_ha7}, {"HA7Net", optional_argument, NO_LINKED_VAR, e_ha7}, {"ha7net", optional_argument, NO_LINKED_VAR, e_ha7}, {"enet", optional_argument, NO_LINKED_VAR, e_enet}, {"Enet", optional_argument, NO_LINKED_VAR, e_enet}, {"ENET", optional_argument, NO_LINKED_VAR, e_enet}, {"OW-Server-Enet", optional_argument, NO_LINKED_VAR, e_enet}, {"FAKE", required_argument, NO_LINKED_VAR, e_fake}, /* Fake */ {"Fake", required_argument, NO_LINKED_VAR, e_fake}, /* Fake */ {"fake", required_argument, NO_LINKED_VAR, e_fake}, /* Fake */ {"link", required_argument, NO_LINKED_VAR, e_link}, /* link in ascii mode */ {"LINK", required_argument, NO_LINKED_VAR, e_link}, /* link in ascii mode */ {"HA3", required_argument, NO_LINKED_VAR, e_ha3}, {"ha3", required_argument, NO_LINKED_VAR, e_ha3}, {"HA4B", required_argument, NO_LINKED_VAR, e_ha4b}, {"HA4b", required_argument, NO_LINKED_VAR, e_ha4b}, {"ha4b", required_argument, NO_LINKED_VAR, e_ha4b}, {"HA5", required_argument, NO_LINKED_VAR, e_ha5}, {"ha5", required_argument, NO_LINKED_VAR, e_ha5}, {"ha7e", required_argument, NO_LINKED_VAR, e_ha7e}, {"HA7e", required_argument, NO_LINKED_VAR, e_ha7e}, {"HA7E", required_argument, NO_LINKED_VAR, e_ha7e}, {"ha7s", required_argument, NO_LINKED_VAR, e_ha7e}, {"HA7s", required_argument, NO_LINKED_VAR, e_ha7e}, {"HA7S", required_argument, NO_LINKED_VAR, e_ha7e}, {"xport", required_argument, NO_LINKED_VAR, e_xport, }, {"telnet", required_argument, NO_LINKED_VAR, e_xport, }, {"TELNET", required_argument, NO_LINKED_VAR, e_xport, }, {"Xport", required_argument, NO_LINKED_VAR, e_xport, }, {"XPort", required_argument, NO_LINKED_VAR, e_xport, }, {"XPORT", required_argument, NO_LINKED_VAR, e_xport, }, {"telnet", required_argument, NO_LINKED_VAR, e_xport, }, {"TESTER", required_argument, NO_LINKED_VAR, e_tester}, /* Tester */ {"Tester", required_argument, NO_LINKED_VAR, e_tester}, /* Tester */ {"tester", required_argument, NO_LINKED_VAR, e_tester}, /* Tester */ {"mock", required_argument, NO_LINKED_VAR, e_mock}, /* Mock */ {"Mock", required_argument, NO_LINKED_VAR, e_mock}, /* Mock */ {"MOCK", required_argument, NO_LINKED_VAR, e_mock}, /* Mock */ {"etherweather", required_argument, NO_LINKED_VAR, e_etherweather}, /* EtherWeather */ {"EtherWeather", required_argument, NO_LINKED_VAR, e_etherweather}, /* EtherWeather */ {"zero", no_argument, &Globals.announce_off, 0}, {"nozero", no_argument, &Globals.announce_off, 1}, {"autoserver", no_argument, NO_LINKED_VAR, e_browse}, {"auto", no_argument, NO_LINKED_VAR, e_browse}, {"AUTO", no_argument, NO_LINKED_VAR, e_browse}, {"browse", no_argument, NO_LINKED_VAR, e_browse}, {"w1", no_argument, NO_LINKED_VAR, e_w1_monitor}, {"W1", no_argument, NO_LINKED_VAR, e_w1_monitor}, {"announce", required_argument, NO_LINKED_VAR, e_announce}, {"allow_other", no_argument, &Globals.allow_other, 1}, {"altUSB", no_argument, &Globals.altUSB, 1}, /* Willy Robison's tweaks */ {"altusb", no_argument, &Globals.altUSB, 1}, /* Willy Robison's tweaks */ {"usb_flextime", no_argument, &Globals.usb_flextime, 1}, {"USB_flextime", no_argument, &Globals.usb_flextime, 1}, {"usb_regulartime", no_argument, &Globals.usb_flextime, 0}, {"USB_regulartime", no_argument, &Globals.usb_flextime, 0}, {"usb_scan", optional_argument, NO_LINKED_VAR, e_usb_monitor,}, {"USB_scan", optional_argument, NO_LINKED_VAR, e_usb_monitor,}, {"serial_flex", no_argument, &Globals.serial_flextime, 1}, {"serial_flextime", no_argument, &Globals.serial_flextime, 1}, {"serial_regulartime", no_argument, &Globals.serial_flextime, 0}, {"serial_regular", no_argument, &Globals.serial_flextime, 0}, { "no_hard", no_argument, &Globals.serial_hardflow, 0 }, // hardware flow control { "flow_none", no_argument, &Globals.serial_hardflow, 0 }, // hardware flow control { "no_hardflow", no_argument, &Globals.serial_hardflow, 0 }, // hardware flow control { "hard", no_argument, &Globals.serial_hardflow, 1 }, // hardware flow control { "hardware", no_argument, &Globals.serial_hardflow, 1 }, // hardware flow control { "hardflow", no_argument, &Globals.serial_hardflow, 1 }, // hardware flow control {"serial_standardtime", no_argument, &Globals.serial_flextime, 0}, {"serial_standard", no_argument, &Globals.serial_flextime, 0}, {"serial_stdtime", no_argument, &Globals.serial_flextime, 0}, {"serial_std", no_argument, &Globals.serial_flextime, 0}, {"reverse", no_argument, &Globals.serial_reverse, 1}, {"reverse_polarity", no_argument, &Globals.serial_reverse, 1}, {"straight_polarity", no_argument, &Globals.serial_reverse, 0}, {"baud_rate", required_argument, NO_LINKED_VAR, e_baud}, {"baud", required_argument, NO_LINKED_VAR, e_baud}, {"Baud", required_argument, NO_LINKED_VAR, e_baud}, {"BAUD", required_argument, NO_LINKED_VAR, e_baud}, {"timeout_volatile", required_argument, NO_LINKED_VAR, e_timeout_volatile,}, // timeout -- changing cached values {"timeout_stable", required_argument, NO_LINKED_VAR, e_timeout_stable,}, // timeout -- unchanging cached values {"timeout_directory", required_argument, NO_LINKED_VAR, e_timeout_directory,}, // timeout -- direcory cached values {"timeout_presence", required_argument, NO_LINKED_VAR, e_timeout_presence,}, // timeout -- device location {"timeout_serial", required_argument, NO_LINKED_VAR, e_timeout_serial,}, // timeout -- serial wait (read and write) {"timeout_usb", required_argument, NO_LINKED_VAR, e_timeout_usb,}, // timeout -- usb wait {"timeout_network", required_argument, NO_LINKED_VAR, e_timeout_network,}, // timeout -- tcp wait {"timeout_server", required_argument, NO_LINKED_VAR, e_timeout_server,}, // timeout -- server wait {"timeout_ftp", required_argument, NO_LINKED_VAR, e_timeout_ftp,}, // timeout -- ftp wait {"timeout_HA7", required_argument, NO_LINKED_VAR, e_timeout_ha7,}, // timeout -- HA7Net wait {"timeout_ha7", required_argument, NO_LINKED_VAR, e_timeout_ha7,}, // timeout -- HA7Net wait {"timeout_HA7Net", required_argument, NO_LINKED_VAR, e_timeout_ha7,}, // timeout -- HA7Net wait {"timeout_ha7net", required_argument, NO_LINKED_VAR, e_timeout_ha7,}, // timeout -- HA7Net wait {"timeout_w1", required_argument, NO_LINKED_VAR, e_timeout_w1,}, // timeout -- w1 netlink {"timeout_W1", required_argument, NO_LINKED_VAR, e_timeout_w1,}, // timeout -- w1 netlink {"timeout_persistent_low", required_argument, NO_LINKED_VAR, e_timeout_persistent_low,}, {"timeout_persistent_high", required_argument, NO_LINKED_VAR, e_timeout_persistent_high,}, {"clients_persistent_low", required_argument, NO_LINKED_VAR, e_clients_persistent_low,}, {"clients_persistent_high", required_argument, NO_LINKED_VAR, e_clients_persistent_high,}, {"temperature_low", required_argument, NO_LINKED_VAR, e_templow,}, {"low_temperature", required_argument, NO_LINKED_VAR, e_templow,}, {"templow", required_argument, NO_LINKED_VAR, e_templow,}, {"temperature_high", required_argument, NO_LINKED_VAR, e_temphigh,}, {"high_temperature", required_argument, NO_LINKED_VAR, e_temphigh,}, {"temphigh", required_argument, NO_LINKED_VAR, e_temphigh,}, {"temperature_hi", required_argument, NO_LINKED_VAR, e_temphigh,}, {"hi_temperature", required_argument, NO_LINKED_VAR, e_temphigh,}, {"temphi", required_argument, NO_LINKED_VAR, e_temphigh,}, {"one_device", no_argument, &Globals.one_device, 1}, {"1_device", no_argument, &Globals.one_device, 1}, {"pingcrazy", no_argument, &Globals.pingcrazy, 1}, {"no_dirall", no_argument, &Globals.no_dirall, 1}, {"no_get", no_argument, &Globals.no_get, 1}, {"no_persistence", no_argument, &Globals.no_persistence, 1}, {"8bit", no_argument, &Globals.eightbit_serial, 1}, {"6bit", no_argument, &Globals.eightbit_serial, 0}, {"ActivePullUp", no_argument, &Globals.i2c_APU, 1}, {"activepullup", no_argument, &Globals.i2c_APU, 1}, {"APU", no_argument, &Globals.i2c_APU, 1}, {"apu", no_argument, &Globals.i2c_APU, 1}, {"no_ActivePullUp", no_argument, &Globals.i2c_APU, 0}, {"no_activepullup", no_argument, &Globals.i2c_APU, 0}, {"no_APU", no_argument, &Globals.i2c_APU, 0}, {"no_apu", no_argument, &Globals.i2c_APU, 0}, {"PresencePulseMasking", no_argument, &Globals.i2c_PPM, 1}, {"presencepulsemasking", no_argument, &Globals.i2c_PPM, 1}, {"PPM", no_argument, &Globals.i2c_PPM, 1}, {"ppm", no_argument, &Globals.i2c_PPM, 1}, {"no_PresencePulseMasking", no_argument, &Globals.i2c_PPM, 0}, {"no_presencepulsemasking", no_argument, &Globals.i2c_PPM, 0}, {"no_PPM", no_argument, &Globals.i2c_PPM, 0}, {"no_ppm", no_argument, &Globals.i2c_PPM, 0}, {0, 0, 0, 0}, }; // Called after "ParseTheLine" has filled the lineparse structure static int ParseInterp(struct lineparse *lp) { size_t option_name_length; const struct option *long_option_pointer; LEVEL_DEBUG("Configuration file (%s:%d) Program=%s%s, Option=%s, Value=%s", SAFESTRING(lp->file), lp->line_number, lp->reverse_prog ? "Not " : "", SAFESTRING(lp->prog), SAFESTRING(lp->opt), SAFESTRING(lp->val)); // Check for program specification if (lp->prog != NULL) { // lp-> prog already in lower case if (strstr(lp->prog, "server") != NULL) { if ((Globals.program_type == program_type_server) == lp->reverse_prog) { return 0; // ignore this line -- doesn't apply } } else if (strstr(lp->prog, "external") != NULL) { if ((Globals.program_type == program_type_external) == lp->reverse_prog) { return 0; // ignore this line -- doesn't apply } } else if (strstr(lp->prog, "http") != NULL) { if ((Globals.program_type == program_type_httpd) == lp->reverse_prog) { return 0; // ignore this line -- doesn't apply } } else if (strstr(lp->prog, "ftp") != NULL) { if ((Globals.program_type == program_type_ftpd) == lp->reverse_prog) { return 0; // ignore this line -- doesn't apply } } else if (strstr(lp->prog, "fs") != NULL) { if ((Globals.program_type == program_type_filesystem) == lp->reverse_prog) { return 0; // ignore this line -- doesn't apply } } else { LEVEL_DEFAULT("Configuration file (%s:%d) Unrecognized program %s. Option=%s, Value=%s", SAFESTRING(lp->file), lp->line_number, SAFESTRING(lp->prog), SAFESTRING(lp->opt), SAFESTRING(lp->val)); return 0; } } // empty option field -- probably comment or blank line if (lp->opt == NULL) { return 0; } option_name_length = strlen(lp->opt); // single character option if (option_name_length == 1) { return lp->opt[0]; } // long option -- search in owopts_long array for (long_option_pointer = owopts_long; long_option_pointer->name != NULL; ++long_option_pointer) { if (strncasecmp(lp->opt, long_option_pointer->name, option_name_length) == 0) { LEVEL_DEBUG("Configuration file (%s:%d) Option %s recognized as %s. Value=%s", SAFESTRING(lp->file), lp->line_number, lp->opt, long_option_pointer->name, SAFESTRING(lp->val)); if (long_option_pointer->flag != NULL) { // immediate value mode //printf("flag c=%d flag=%p long_option_pointer->flag=%p\n",c,flag,long_option_pointer->flag); (long_option_pointer->flag)[0] = long_option_pointer->val; return 0; } else { return long_option_pointer->val; } } } LEVEL_DEFAULT("Configuration file (%s:%d) Unrecognized option %s. Value=%s", SAFESTRING(lp->file), lp->line_number, SAFESTRING(lp->opt), SAFESTRING(lp->val)); return 0; } // Parse the configuration file line // Basically look for lines of form opt=val // optional white space // optional '=' // optional val // Comment with # // set opt and val as pointers into line (or NULL if not there) // set NULL char at end of opt and val static void ParseTheLine(struct lineparse *lp) { ASCII *current_char; // state machine -- pretty self-explanatory. // note that there is no program state, it is only deduced post-facto when a colon is seen. enum e_parse_state { ps_pre_opt, ps_in_opt, ps_pre_equals, ps_pre_value, ps_in_value } parse_state = ps_pre_opt; lp->prog = NULL; lp->opt = NULL; lp->val = NULL; lp->reverse_prog = 0; // plod through the line, char by char for (current_char = lp->line; *current_char; ++current_char) { // change states on special chars switch (*current_char) { // end of line characters case '#': case '\n': case '\r': *current_char = '\0'; return; // whitespace characters case ' ': case '\t': switch (parse_state) { case ps_in_opt: *current_char = '\0'; parse_state = ps_pre_equals; break; case ps_in_value: *current_char = '\0'; return; default: break; } break; // dashes before options ignored (only needed in real command line) case '-': switch (parse_state) { case ps_pre_value: // not ignored before values, of course lp->val = current_char; parse_state = ps_in_value; break; default: break; } break; // negate program state (even though program not yet assigned) case '!': switch (parse_state) { case ps_pre_opt: lp->reverse_prog = !lp->reverse_prog; break; case ps_pre_value: // not ignored before values, of course lp->val = current_char; parse_state = ps_in_value; break; default: break; } break; // colon special case -- assigns to a program // Since we had assumed this was an opt, we have to adjust case ':': switch (parse_state) { case ps_in_opt: case ps_pre_equals: *current_char = '\0'; lp->prog = lp->opt; lp->opt = NULL; { // put in lower case ASCII *prog_char; for (prog_char = lp->prog; *prog_char; ++prog_char) { *prog_char = tolower(*prog_char); } } // special cases for sensor and property lines // they use a different syntax if (strstr(lp->prog, "sensor") != NULL) { // sensor line for external device LEVEL_DEBUG("SENSOR entry found <%s>", current_char+1); lp->prog = NULL ; AddSensor(current_char+1) ; return ; } else if (strstr(lp->prog, "script") != NULL) { // property line for external device LEVEL_DEBUG("SCRIPT entry found <%s>", current_char+1); lp->prog = NULL ; AddProperty(current_char+1,et_script) ; return ; } else if (strstr(lp->prog, "property") != NULL) { // property line for external device LEVEL_DEBUG("PROPERTY (SCRIPT) entry found <%s>", current_char+1); lp->prog = NULL ; AddProperty(current_char+1,et_script) ; return ; } parse_state = ps_pre_opt; break; case ps_pre_value: // not ignored before values, of course lp->val = current_char; parse_state = ps_in_value; break; default: break; } break; // equals special case: jump state case '=': switch (parse_state) { case ps_in_opt: parse_state = ps_pre_equals; // fall through intentionally case ps_pre_equals: *current_char = '\0'; parse_state = ps_pre_value; break; case ps_in_value: break; default: // rogue '=' *current_char = '\0'; return; } break; // real character, start or continue parameter, jump past "=" default: switch (parse_state) { case ps_pre_opt: lp->opt = current_char; parse_state = ps_in_opt; break; case ps_pre_equals: parse_state = ps_pre_value; // fall through intentionally case ps_pre_value: lp->val = current_char; parse_state = ps_in_value; break; default: break; } break; } } } static GOOD_OR_BAD ConfigurationFile(const ASCII * file) { FILE *configuration_file_pointer = fopen(file, "r"); if (configuration_file_pointer) { int ret = gbGOOD; struct lineparse lp; lp.line_number = 0; lp.file = file; lp.line = NULL ; // setup for getline while (getline(&(lp.line), &(lp.line_length), configuration_file_pointer)>=0) { ++lp.line_number; ParseTheLine(&lp); if ( BAD( owopt(ParseInterp(&lp), lp.val) ) ) { ret = gbBAD ; break ; } } fclose(configuration_file_pointer); if ( lp.line != NULL) { free(lp.line) ; // not owfree } return ret; } else { ERROR_DEFAULT("Cannot process configuration file %s", file); return gbBAD; } } GOOD_OR_BAD owopt_packed(const char *params) { char *params_copy; // copy of the input line char *current_location_in_params_copy; // pointers into the input line copy char *next_location_in_params_copy; // pointers into the input line copy char **argv = NULL; int argc = 0; GOOD_OR_BAD ret = 0; int allocated = 0; int option_char; if (params == NULL) { return gbGOOD; } current_location_in_params_copy = params_copy = owstrdup(params); if (params_copy == NULL) { return gbBAD; } // Stuffs arbitrary first value since argv[0] ignored by getopt // create a synthetic argv/argc for get_opt for (next_location_in_params_copy = "X"; next_location_in_params_copy != NULL; next_location_in_params_copy = strsep(¤t_location_in_params_copy, " ")) { // make room if (argc >= allocated - 1) { char **larger_argv = owrealloc(argv, (allocated + 10) * sizeof(char *)); if (larger_argv != NULL) { allocated += 10; argv = larger_argv; } else { ret = gbBAD; break; } } argv[argc] = next_location_in_params_copy; ++argc; argv[argc] = NULL; } // analyze argv/argc as if real command line arguments while (ret == 0) { if ((option_char = getopt_long(argc, argv, OWLIB_OPT, owopts_long, NULL)) == -1) { break; } ret = owopt(option_char, optarg); } /* non-option arguments */ while ((ret == 0) && (optind < argc)) { //printf("optind = %d arg=%s\n",optind,SAFESTRING(argv[optind])); ARG_Generic(argv[optind]); ++optind; } SAFEFREE(argv) ; owfree(params_copy); return ret; } /* Parses one argument */ /* return 0 if ok */ GOOD_OR_BAD owopt(const int option_char, const char *arg) { // depth of nesting for config files static int config_depth = 0; // utility variables for parsing options long long int arg_to_integer ; _FLOAT arg_to_float ; //printf("Option %c (%d) Argument=%s\n",c,c,SAFESTRING(arg)) ; switch (option_char) { case 'a' : return ReadAliasFile(arg) ; case 'c': if (config_depth > 4) { LEVEL_DEFAULT("Configuration file layered too deeply (>%d)", config_depth); return gbBAD; } else { GOOD_OR_BAD ret; ++config_depth; ret = ConfigurationFile(arg); --config_depth; return ret; } case 'h': FS_help(arg); return gbBAD; case 'u': return ARG_USB(arg); case 'd': return ARG_Device(arg); case 't': RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.timeout_volatile = (int) arg_to_integer; break; case 'r': Globals.readonly = 1; break; case 'w': Globals.readonly = 0; break; case 'C': Globals.temp_scale = temp_celsius ; SetLocalControlFlags() ; break; case 'F': Globals.temp_scale = temp_fahrenheit ; SetLocalControlFlags() ; break; case 'R': Globals.temp_scale = temp_rankine ; SetLocalControlFlags() ; break; case 'K': Globals.temp_scale = temp_kelvin ; SetLocalControlFlags() ; break; case 'V': printf("libow version:\n\t" VERSION "\n"); return gbBAD; case 's': return ARG_Net(arg); case 'p': switch (Globals.program_type) { case program_type_httpd: case program_type_server: case program_type_external: case program_type_ftpd: return ARG_Server(arg); default: return gbGOOD; } case 'm': switch (Globals.program_type) { case program_type_filesystem: return ARG_Server(arg); default: return gbGOOD; } case 'f': if (!strcasecmp(arg, "f.i")) { Globals.format = fdi ; } else if (!strcasecmp(arg, "fi")) { Globals.format = fi ; } else if (!strcasecmp(arg, "f.i.c")) { Globals.format = fdidc ; } else if (!strcasecmp(arg, "f.ic")) { Globals.format = fdic ; } else if (!strcasecmp(arg, "fi.c")) { Globals.format = fidc ; } else if (!strcasecmp(arg, "fic")) { Globals.format = fic ; } else { LEVEL_DEFAULT("Unrecognized format type %s", arg); return gbBAD; } SetLocalControlFlags() ; break; case 'P': if (arg == NULL || strlen(arg) == 0) { LEVEL_DEFAULT("No PID file specified"); return gbBAD; } else if ((pid_file = owstrdup(arg)) == NULL) { fprintf(stderr, "Insufficient memory to store the PID filename: %s", arg); return gbBAD; } break; case e_fatal_debug_file: if (arg == NULL || strlen(arg) == 0) { LEVEL_DEFAULT("No fatal_debug_file specified"); return gbBAD; } else if ((Globals.fatal_debug_file = owstrdup(arg)) == NULL) { LEVEL_DEBUG("Out of memory."); return gbBAD; } break; case e_error_print: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.error_print = (int) arg_to_integer; break; case e_error_level: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.error_level = (int) arg_to_integer; break; case e_debug: // shortcut for --foreground --error_level=9 printf("DEBUG MODE\n"); printf("libow version:\n\t" VERSION "\n"); Globals.want_background = 0 ; //foreground Globals.error_level = 9 ; break ; case e_concurrent_connections: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.concurrent_connections = (int) arg_to_integer; break; case e_cache_size: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.cache_size = (size_t) arg_to_integer; break; case e_fuse_opt: /* fuse_opt, handled in owfs.c */ break; case e_fuse_open_opt: /* fuse_open_opt, handled in owfs.c */ break; case e_max_clients: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.max_clients = (int) arg_to_integer; break; case e_i2c: return ARG_I2C(arg); case e_ha5: return ARG_HA5(arg); case e_ha7: return ARG_HA7(arg); case e_ha7e: return ARG_HA7E(arg); case e_enet: return ARG_ENET(arg); case e_fake: return ARG_Fake(arg); case e_link: return ARG_Link(arg); case e_passive: return ARG_Passive("Passive", arg); case e_ha3: return ARG_Passive("HA3", arg); case e_ha4b: return ARG_Passive("HA4B", arg); case e_xport: return ARG_Xport(arg); case e_tester: return ARG_Tester(arg); case e_mock: return ARG_Mock(arg); case e_etherweather: return ARG_EtherWeather(arg); case e_w1_monitor: return ARG_W1_monitor(); case e_usb_monitor: return ARG_USB_monitor(arg); case e_browse: return ARG_Browse(); case e_announce: Globals.announce_name = owstrdup(arg); break; // Pressure scale case e_pressure_mbar: Globals.pressure_scale = pressure_mbar ; SetLocalControlFlags() ; break ; case e_pressure_atm: Globals.pressure_scale = pressure_atm ; SetLocalControlFlags() ; break ; case e_pressure_mmhg: Globals.pressure_scale = pressure_mmhg ; SetLocalControlFlags() ; break ; case e_pressure_inhg: Globals.pressure_scale = pressure_inhg ; SetLocalControlFlags() ; break ; case e_pressure_psi: Globals.pressure_scale = pressure_psi ; SetLocalControlFlags() ; break ; case e_pressure_Pa: Globals.pressure_scale = pressure_Pa ; SetLocalControlFlags() ; break ; // TIMEOUTS case e_timeout_volatile: case e_timeout_stable: case e_timeout_directory: case e_timeout_presence: case e_timeout_serial: case e_timeout_usb: case e_timeout_network: case e_timeout_server: case e_timeout_ftp: case e_timeout_ha7: case e_timeout_w1: case e_timeout_persistent_low: case e_timeout_persistent_high: case e_clients_persistent_low: case e_clients_persistent_high: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; // Using the character as a numeric value -- convenient but risky (&Globals.timeout_volatile)[option_char - e_timeout_volatile] = (int) arg_to_integer; break; case e_baud: RETURN_BAD_IF_BAD(OW_parsevalue_I(&arg_to_integer, arg)) ; Globals.baud = COM_MakeBaud( arg_to_integer ) ; break ; case e_templow: RETURN_BAD_IF_BAD(OW_parsevalue_F(&arg_to_float, arg)) ; Globals.templow = arg_to_float; break; case e_temphigh: RETURN_BAD_IF_BAD(OW_parsevalue_F(&arg_to_float, arg)) ; Globals.temphigh = arg_to_float; break; case e_safemode: LocalControlFlags |= SAFEMODE ; break; case 0: break; default: return gbBAD; } return gbGOOD; } static GOOD_OR_BAD OW_parsevalue_I(long long int *var, const ASCII * str) { errno = 0; var[0] = strtol(str, NULL, 10); if (errno) { ERROR_DETAIL("Bad integer configuration value %s", str); return gbBAD; } return gbGOOD; } static GOOD_OR_BAD OW_parsevalue_F(_FLOAT *var, const ASCII * str) { errno = 0; var[0] = (_FLOAT) strtod(str, NULL); if (errno) { ERROR_DETAIL("Bad floating point configuration value %s", str); return gbBAD; } return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_1993.c0000644000175000017500000001265011740076517014514 00000000000000/* $Id: ow_1993.c,v 1.51 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1993.h" /* ------- Prototypes ----------- */ /* DS1902 ibutton memory */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); /* ------- Structures ----------- */ static struct aggregate A1992 = { 4, ag_numbers, ag_separate, }; static struct filetype DS1992[] = { F_STANDARD, {"memory", 128, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1992, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(08, DS1992, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A1993 = { 16, ag_numbers, ag_separate, }; static struct filetype DS1993[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1993, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(06, DS1993, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A1995 = { 64, ag_numbers, ag_separate, }; static struct filetype DS1995[] = { F_STANDARD, {"memory", 2048, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1995, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(0A, DS1995, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A1996 = { 256, ag_numbers, ag_separate, }; static struct filetype DS1996[] = { F_STANDARD, {"memory", 8192, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1996, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(0C, DS1996, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_READ_MEMORY 0xF0 /* ------- Functions ------------ */ /* DS1902 */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); /* 1902 */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { /* read is not page-limited */ if (COMMON_read_memory_F0(owq, 0, 0)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { /* paged access */ size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } /* paged, and pre-screened */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[4 + 32] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(p), TRXN_WRITE(data, size), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ(&p[1], 3 + size), TRXN_COMPARE(data, &p[4], size), TRXN_END, }; struct transaction_log tsram[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(32), TRXN_END, }; /* Copy to scratchpad */ RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; /* Re-read scratchpad and compare */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(tsram, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_w1.c0000644000175000017500000002125411731463643014436 00000000000000/* $Id: ow_w1.c,v 1.51 2012/03/13 14:13:19 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_codes.h" #include "ow_counters.h" struct toW1 { ASCII *command; ASCII lock[10]; ASCII conditional[1]; ASCII address[16]; const BYTE *data; size_t length; }; //static void byteprint( const BYTE * b, int size ) ; static RESET_TYPE W1_reset(const struct parsedname *pn); static enum search_status W1_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD W1_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD W1_select_and_sendback(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void W1_setroutines(struct connection_in *in); static void W1_close(struct connection_in *in); static SEQ_OR_ERROR w1_send_touch( const BYTE * data, size_t size, const struct parsedname *pn ); static SEQ_OR_ERROR w1_send_selecttouch( const BYTE * data, size_t size, const struct parsedname *pn ); static SEQ_OR_ERROR w1_send_search( struct device_search *ds, const struct parsedname *pn ); static SEQ_OR_ERROR w1_send_reset( const struct parsedname *pn ); static void W1_setroutines(struct connection_in *in) { in->iroutines.detect = W1_detect; in->iroutines.reset = W1_reset; in->iroutines.next_both = W1_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.select_and_sendback = W1_select_and_sendback; in->iroutines.sendback_data = W1_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = W1_close; // Directory obtained in a single gulp (W1_LIST_SLAVES) // Bundle transactions // in->iroutines.flags = ADAP_FLAG_dirgulp | ADAP_FLAG_bundle | ADAP_FLAG_dir_auto_reset | ADAP_FLAG_no2404delay ; in->bundling_length = W1_FIFO_SIZE; // arbitrary number } GOOD_OR_BAD W1_detect(struct connection_in *in) { struct parsedname pn; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed pn.selected_connection = in; /* Set up low-level routines */ SOC(in)->type = ct_none ; W1_setroutines(in); Init_Pipe( in->master.w1.netlink_pipe ) ; if ( pipe( in->master.w1.netlink_pipe ) != 0 ) { ERROR_CONNECT("W1 pipe creation error"); Init_Pipe( in->master.w1.netlink_pipe ) ; return gbBAD ; } fcntl (in->master.w1.netlink_pipe[fd_pipe_read], F_SETFD, FD_CLOEXEC); // for safe forking fcntl (in->master.w1.netlink_pipe[fd_pipe_write], F_SETFD, FD_CLOEXEC); // for safe forking if ( SOC(in)->devicename == NULL) { return gbBAD; } in->Adapter = adapter_w1; in->adapter_name = "w1"; in->busmode = bus_w1; in->master.w1.seq = SEQ_INIT; return gbGOOD; } /* Send blindly, no response expected */ static SEQ_OR_ERROR w1_send_reset( const struct parsedname *pn ) { struct w1_netlink_msg w1m; struct w1_netlink_cmd w1c; memset(&w1m, 0, W1_W1M_LENGTH); w1m.type = W1_MASTER_CMD; w1m.id.mst.id = pn->selected_connection->master.w1.id ; memset(&w1c, 0, W1_W1C_LENGTH); w1c.cmd = W1_CMD_RESET ; w1c.len = 0 ; LEVEL_DEBUG("Sending w1 reset message"); return W1_send_msg( pn->selected_connection, &w1m, &w1c, NULL ); } static RESET_TYPE W1_reset(const struct parsedname *pn) { return W1_Process_Response( NULL, w1_send_reset(pn), NULL, pn ) == nrs_complete ? BUS_RESET_OK : BUS_RESET_ERROR ; } static SEQ_OR_ERROR w1_send_search( struct device_search *ds, const struct parsedname *pn ) { struct w1_netlink_msg w1m; struct w1_netlink_cmd w1c; memset(&w1m, 0, W1_W1M_LENGTH); w1m.type = W1_MASTER_CMD; w1m.id.mst.id = pn->selected_connection->master.w1.id ; memset(&w1c, 0, W1_W1C_LENGTH); w1c.cmd = (ds->search==_1W_CONDITIONAL_SEARCH_ROM) ? W1_CMD_ALARM_SEARCH : W1_CMD_SEARCH ; w1c.len = 0 ; LEVEL_DEBUG("Sending w1 search (list devices) message"); return W1_send_msg( pn->selected_connection, &w1m, &w1c, NULL ); } // Work around for omap hdq driver bug which reverses the slave address // We check the CRC8 and use reversed if forward is incorrect. static void search_callback( struct netlink_parse * nlp, void * v, const struct parsedname * pn ) { int i ; struct connection_in * in = pn->selected_connection ; struct device_search *ds = v ; BYTE sn[SERIAL_NUMBER_SIZE] ; BYTE * sn_pointer ; for ( i = 0 ; i < nlp->w1c->len ; i += SERIAL_NUMBER_SIZE ) { switch( in->master.w1.w1_slave_order ) { case w1_slave_order_forward: sn_pointer = &nlp->data[i] ; break ; case w1_slave_order_reversed: // reverse bytes sn[0] = nlp->data[i+7] ; sn[1] = nlp->data[i+6] ; sn[2] = nlp->data[i+5] ; sn[3] = nlp->data[i+4] ; sn[4] = nlp->data[i+3] ; sn[5] = nlp->data[i+2] ; sn[6] = nlp->data[i+1] ; sn[7] = nlp->data[i+0] ; sn_pointer = sn ; break ; case w1_slave_order_unknown: default: sn_pointer = &nlp->data[i] ; if ( CRC8(sn_pointer, SERIAL_NUMBER_SIZE) == 0 ) { in->master.w1.w1_slave_order = w1_slave_order_forward ; break ; } // reverse bytes sn[0] = nlp->data[i+7] ; sn[1] = nlp->data[i+6] ; sn[2] = nlp->data[i+5] ; sn[3] = nlp->data[i+4] ; sn[4] = nlp->data[i+3] ; sn[5] = nlp->data[i+2] ; sn[6] = nlp->data[i+1] ; sn[7] = nlp->data[i+0] ; sn_pointer = sn ; in->master.w1.w1_slave_order = w1_slave_order_reversed ; LEVEL_DEBUG( "w1 bus master%d uses reversed slave order", in->master.w1.id ) ; break ; } DirblobAdd(sn_pointer, &(ds->gulp) ); } } static enum search_status W1_next_both(struct device_search *ds, const struct parsedname *pn) { if (ds->LastDevice) { return search_done; } if (++(ds->index) == 0) { // first pass, load the directory DirblobClear( &(ds->gulp) ); if ( W1_Process_Response( search_callback, w1_send_search(ds,pn), ds, pn ) != nrs_complete) { return search_error; } } switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } static SEQ_OR_ERROR w1_send_selecttouch( const BYTE * data, size_t size, const struct parsedname *pn ) { struct w1_netlink_msg w1m; struct w1_netlink_cmd w1c; memset(&w1m, 0, W1_W1M_LENGTH); w1m.type = W1_SLAVE_CMD; memcpy( w1m.id.id, pn->sn, 8) ; memset(&w1c, 0, W1_W1C_LENGTH); w1c.cmd = W1_CMD_TOUCH ; w1c.len = size ; LEVEL_DEBUG("Sending w1 select message for "SNformat,SNvar(pn->sn)); return W1_send_msg( pn->selected_connection, &w1m, &w1c, data ); } struct touch_struct { BYTE * resp ; size_t size ; } ; static void touch( struct netlink_parse * nlp, void * v, const struct parsedname * pn ) { struct touch_struct * ts = v ; (void) pn ; if ( nlp->data == NULL ) { return ; } if ( ts->size == (size_t)nlp->data_size ) { memcpy( ts->resp, nlp->data, nlp->data_size ) ; } } // Reset, select, and read/write data static GOOD_OR_BAD W1_select_and_sendback(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { struct touch_struct ts = { resp, size, } ; return W1_Process_Response( touch, w1_send_selecttouch(data,size,pn), &ts, pn)==nrs_complete ? gbGOOD : gbBAD ; } static SEQ_OR_ERROR w1_send_touch( const BYTE * data, size_t size, const struct parsedname *pn ) { struct w1_netlink_msg w1m; struct w1_netlink_cmd w1c; memset(&w1m, 0, W1_W1M_LENGTH); w1m.type = W1_MASTER_CMD; w1m.id.mst.id = pn->selected_connection->master.w1.id ; memset(&w1c, 0, W1_W1C_LENGTH); w1c.cmd = W1_CMD_TOUCH ; w1c.len = size ; LEVEL_DEBUG("Sending w1 send/receive data message for "SNformat,SNvar(pn->sn)); return W1_send_msg( pn->selected_connection, &w1m, &w1c, data ); } // Send data and return response block static GOOD_OR_BAD W1_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { struct touch_struct ts = { resp, size, } ; return W1_Process_Response( touch, w1_send_touch(data,size,pn), &ts, pn)==nrs_complete ? gbGOOD : gbBAD ; } static void W1_close(struct connection_in *in) { Test_and_Close_Pipe( in->master.w1.netlink_pipe ); } #else /* OW_W1 && OW_MT */ GOOD_OR_BAD W1_detect(struct connection_in *in) { (void) in ; LEVEL_CONNECT("Kernel 1-wire support was not configured in") ; return gbBAD ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_api.c0000664000175000017500000000655211620362276014663 00000000000000/* $Id: ow_api.c,v 1.22 2011/08/10 01:54:06 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* code for SWIG and owcapi safe access */ /* Uses two mutexes, one for inbound_connections, showing of there are valid 1-wire adapters */ /* Second is paired with a condition variable to prevent "finish" when a "get" or "put" is in progress */ /* Thanks to Geo Carncross for the implementation */ #include #include "owfs_config.h" #include "ow.h" /* ------- Globals ----------- */ #if OW_MT pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t access_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t access_cond = PTHREAD_COND_INITIALIZER; #else /* not OW_MT */ pthread_mutex_t init_mutex ; pthread_mutex_t access_mutex ; pthread_cond_t access_cond ; #endif /* OW_MT */ #define INITINIT _MUTEX_INIT( init_mutex ) #define ACCESSINIT _MUTEX_INIT( access_mutex ) #define INITLOCK _MUTEX_LOCK( init_mutex ) #define INITUNLOCK _MUTEX_UNLOCK( init_mutex ) #define ACCESSLOCK _MUTEX_LOCK( access_mutex ) #define ACCESSUNLOCK _MUTEX_UNLOCK(access_mutex ) #define ACCESSWAIT my_pthread_cond_wait( &access_cond, &access_mutex ) #define ACCESSSIGNAL my_pthread_cond_signal( &access_cond ) int access_num = 0; void API_setup(enum enum_program_type program_type) { static int deja_vue = 0; // poor mans lock for the Lib Setup and Lock Setup if (++deja_vue == 1) { // first time through LibSetup(program_type); INITINIT ; ACCESSINIT ; StateInfo.owlib_state = lib_state_setup; } } void API_set_error_level(const char *params) { if (params != NULL) { Globals.error_level = atoi(params); } return; } void API_set_error_print(const char *params) { if (params != NULL) { Globals.error_print = atoi(params); } return; } /* Swig ensures that API_LibSetup is called first, but still we check */ GOOD_OR_BAD API_init(const char *command_line) { GOOD_OR_BAD return_code = gbGOOD; if (StateInfo.owlib_state == lib_state_pre) { LibSetup(Globals.program_type); // use previous or default value StateInfo.owlib_state = lib_state_setup; } LIB_WLOCK; // stop if started if (StateInfo.owlib_state == lib_state_started) { LibStop(); StateInfo.owlib_state = lib_state_setup; } // now restart if (StateInfo.owlib_state == lib_state_setup) { return_code = owopt_packed(command_line); if ( BAD(return_code) ) { LIB_WUNLOCK; return return_code; } return_code = LibStart(); if ( BAD(return_code) ) { LIB_WUNLOCK; return return_code; } StateInfo.owlib_state = lib_state_started; } LIB_WUNLOCK; return return_code; } void API_finish(void) { if (StateInfo.owlib_state == lib_state_pre) { return; } LIB_WLOCK; LibStop(); StateInfo.owlib_state = lib_state_pre; LIB_WUNLOCK; } // called before read/write/dir operation -- tests setup state // pair with API_access_stop int API_access_start(void) { if (StateInfo.owlib_state == lib_state_pre) { return -EACCES; } LIB_RLOCK; if (StateInfo.owlib_state != lib_state_started) { LIB_RUNLOCK; return -EACCES; } return 0; } // called after read/write/dir operation // pair with API_access_start void API_access_end(void) { LIB_RUNLOCK; } owfs-2.8p15/module/owlib/src/c/ow_2406.c0000644000175000017500000006665511740076517014520 00000000000000/* $Id: ow_2406.c,v 1.113 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Changes 7/2004 Extensive improvements based on input from Serg Oskin */ #include #include "owfs_config.h" #include "ow_2406.h" #define TAI8570 /* AAG barometer */ /* ------- Prototypes ----------- */ /* DS2406 switch */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_infobyte); READ_FUNCTION(FS_r_flipflop); READ_FUNCTION(FS_r_pio); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_sense); READ_FUNCTION(FS_r_latch); WRITE_FUNCTION(FS_w_latch); READ_FUNCTION(FS_r_s_alarm); WRITE_FUNCTION(FS_w_s_alarm); READ_FUNCTION(FS_power); READ_FUNCTION(FS_channel); #if OW_TAI8570 READ_FUNCTION(FS_sibling); READ_FUNCTION(FS_temp); READ_FUNCTION(FS_pressure); #endif /* OW_TAI8570 */ READ_FUNCTION(FS_voltage); static enum e_visibility VISIBLE_T8A( const struct parsedname * pn ) ; /* ------- Structures ----------- */ static struct aggregate A2406 = { 2, ag_letters, ag_aggregate, }; static struct aggregate A2406p = { 4, ag_numbers, ag_separate, }; static struct aggregate AT8Ac = { 8, ag_numbers, ag_separate, }; // 8 channel T8A volt meter static struct filetype DS2406[] = { F_STANDARD, {"memory", 128, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2406p, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"channels", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_channel, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_BITFIELD, &A2406, ft_bitfield, fc_stable, FS_r_pio, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A2406, ft_bitfield, fc_link, FS_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"latch", PROPERTY_LENGTH_BITFIELD, &A2406, ft_bitfield, fc_volatile, FS_r_latch, FS_w_latch, VISIBLE, NO_FILETYPE_DATA, }, {"flipflop", PROPERTY_LENGTH_BITFIELD, &A2406, ft_bitfield, fc_volatile, FS_r_flipflop, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_s_alarm, FS_w_s_alarm, VISIBLE, NO_FILETYPE_DATA, }, {"infobyte", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_infobyte, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, #if OW_TAI8570 {"TAI8570", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"TAI8570/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"TAI8570/pressure", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_volatile, FS_pressure, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"TAI8570/sibling", 16, NON_AGGREGATE, ft_ascii, fc_stable, FS_sibling, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, #endif /* OW_TAI8570 */ {"T8A", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_T8A, NO_FILETYPE_DATA, }, {"T8A/volt", PROPERTY_LENGTH_FLOAT, &AT8Ac, ft_float, fc_volatile, FS_voltage, NO_WRITE_FUNCTION, VISIBLE_T8A, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(12, DS2406, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_READ_MEMORY 0xF0 #define _1W_EXTENDED_READ_MEMORY 0xA5 #define _1W_WRITE_MEMORY 0x0F #define _1W_WRITE_STATUS 0x55 #define _1W_READ_STATUS 0xAA #define _1W_CHANNEL_ACCESS 0xF5 #define _DS2406_ALR 0x80 #define _DS2406_IM 0x40 #define _DS2406_TOG 0x20 #define _DS2406_IC 0x10 #define _DS2406_CHS1 0x08 #define _DS2406_CHS0 0x04 #define _DS2406_CRC1 0x02 #define _DS2406_CRC0 0x01 #define _DS2406_POWER_BIT 0x80 #define _DS2406_FLIPFLOP_BITS 0x60 #define _DS2406_ALARM_BITS 0x1F #define _ADDRESS_STATUS_MEMORY_SRAM 0x0007 /* ------- Functions ------------ */ /* DS2406 */ static GOOD_OR_BAD OW_r_mem(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_s_alarm(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_control(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_control(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_pio(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_access(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_syncaccess(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_clear(const struct parsedname *pn); static GOOD_OR_BAD OW_full_access(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_voltage(_FLOAT * V, struct parsedname *pn ); static int VISIBLE_2406( const struct parsedname * pn ); /* finds the visibility of the DS2406-based T8A */ static int VISIBLE_2406( const struct parsedname * pn ) { int device_id = -1 ; // Unknown LEVEL_DEBUG("Checking visibility of %s",SAFESTRING(pn->path)) ; if ( BAD( GetVisibilityCache( &device_id, pn ) ) ) { struct one_wire_query * owq = OWQ_create_from_path(pn->path) ; // for read size_t memsize = 15 ; BYTE mem[memsize] ; if ( owq != NULL) { if ( FS_r_sibling_binary( (char *) mem, &memsize, "memory", owq ) == 0 ) { if ( memcmp( "A189" , &mem[1], 4 ) == 0 ) { device_id = 1 ; // T8A } else { device_id = 0 ; // non T8A } SetVisibilityCache( device_id, pn ) ; } OWQ_destroy(owq) ; } } return device_id ; } static enum e_visibility VISIBLE_T8A( const struct parsedname * pn ) { switch ( VISIBLE_2406(pn) ) { case 1: return visible_now ; default: return visible_not_now ; } } /* 2406 memory read */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { /* read is not a "paged" endeavor, no CRC */ OWQ_length(owq) = OWQ_size(owq) ; return GB_to_Z_OR_E(OW_r_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } /* 2406 memory write */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32 ; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } /* Note, it's EPROM -- write once */ static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { /* write is "byte at a time" -- not paged */ return COMMON_write_eprom_mem_owq(owq) ; } /* 2406 switch */ static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_U(owq) = BYTE_INVERSE(infobyte>>0) & 0x03; /* reverse bits */ return z_or_e; } /* 2406 switch */ static ZERO_OR_ERROR FS_r_flipflop(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_U(owq) = (infobyte>>0) & 0x03; /* reverse bits */ return z_or_e; } /* 2406 switch */ static ZERO_OR_ERROR FS_r_infobyte(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD( OW_syncaccess(&data, PN(owq)) ); OWQ_U(owq) = data; /* reverse bits */ return 0; } /* 2406 switch -- is Vcc powered?*/ static ZERO_OR_ERROR FS_power(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_Y(owq) = (infobyte & _DS2406_POWER_BIT) ? 1 : 0; return z_or_e; } /* 2406 switch -- number of channels (actually, if Vcc powered)*/ static ZERO_OR_ERROR FS_channel(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_U(owq) = (infobyte & 0x40) ? 2 : 1; return z_or_e; } /* 2406 switch PIO sensed*/ /* bits 2 and 3 */ static ZERO_OR_ERROR FS_sense(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_U(owq) = (infobyte>>2) & 0x03; return z_or_e ; } /* 2406 switch activity latch*/ /* bites 4 and 5 */ static ZERO_OR_ERROR FS_r_latch(struct one_wire_query *owq) { UINT infobyte = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &infobyte, "infobyte", owq ) ; OWQ_U(owq) = (infobyte >> 4) & 0x03; return z_or_e; } /* 2406 switch activity latch*/ static ZERO_OR_ERROR FS_w_latch(struct one_wire_query *owq) { FS_del_sibling( "infobyte", owq ) ; return GB_to_Z_OR_E(OW_clear(PN(owq))) ; } /* 2406 alarm settings*/ static ZERO_OR_ERROR FS_r_s_alarm(struct one_wire_query *owq) { BYTE data ; RETURN_ERROR_IF_BAD( OW_r_control(&data, PN(owq)) ); OWQ_U(owq) = (data & 0x01) + ((data >> 1) & 0x03) * 10 + ((data >>3) & 0x03) * 100; return 0 ; } /* 2406 alarm settings*/ static ZERO_OR_ERROR FS_w_s_alarm(struct one_wire_query *owq) { BYTE data; UINT U = OWQ_U(owq); data = ((U % 10) & 0x01) | (((U / 10 % 10) & 0x03) << 1) | (((U / 100 % 10) & 0x03) << 3); return GB_to_Z_OR_E(OW_w_s_alarm(data, PN(owq))) ; } /* write 2406 switch -- 2 values*/ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { BYTE data = BYTE_INVERSE(OWQ_U(owq)) & 0x03 ; /* reverse bits */ FS_del_sibling( "infobyte", owq ) ; return GB_to_Z_OR_E(OW_w_pio(data, PN(owq))) ; } /* Support for EmbeddedDataSystems's T8A 8 channel A/D Written by Chase Shimmin cshimmin@berkeley.edu */ static ZERO_OR_ERROR FS_voltage(struct one_wire_query *owq) { _FLOAT V ; FS_del_sibling( "infobyte", owq ) ; RETURN_ERROR_IF_BAD( OW_voltage( &V, PN(owq) ) ) ; OWQ_F(owq) = V; return 0; } /* reads memory directly into the buffer, no CRC */ static GOOD_OR_BAD OW_r_mem(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE p[] = { _1W_READ_MEMORY, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ(data, size), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; return gbGOOD; } /* read status byte */ static GOOD_OR_BAD OW_r_control(BYTE * data, const struct parsedname *pn) { BYTE p[3 + 1 + 2] = { _1W_READ_STATUS, LOW_HIGH_ADDRESS(_ADDRESS_STATUS_MEMORY_SRAM), }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 1), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; *data = p[3]; return gbGOOD; } /* write status byte */ static GOOD_OR_BAD OW_w_control(const BYTE data, const struct parsedname *pn) { BYTE p[3 + 1 + 2] = { _1W_WRITE_STATUS, LOW_HIGH_ADDRESS(_ADDRESS_STATUS_MEMORY_SRAM), data, }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 4, 0), TRXN_END, }; return BUS_transaction(t, pn) ; } /* write alarm settings */ static GOOD_OR_BAD OW_w_s_alarm(const BYTE data, const struct parsedname *pn) { BYTE b[1]; RETURN_BAD_IF_BAD( OW_r_control(b, pn) ); b[0] = ( b[0] & ~_DS2406_ALARM_BITS) | (data & _DS2406_ALARM_BITS) ; return OW_w_control(b[0], pn); } /* set PIO state bits: bit0=A bit1=B, value: open=1 closed=0 */ static GOOD_OR_BAD OW_w_pio(const BYTE data, const struct parsedname *pn) { BYTE b[1]; RETURN_BAD_IF_BAD( OW_r_control(b, pn) ); b[0] = ( b[0] & ~_DS2406_FLIPFLOP_BITS) | ((data<<5) & _DS2406_FLIPFLOP_BITS) ; return OW_w_control(b[0], pn); } static GOOD_OR_BAD OW_syncaccess(BYTE * data, const struct parsedname *pn) { BYTE d[2] = { _DS2406_IM|_DS2406_CHS1|_DS2406_CHS0|_DS2406_CRC0, 0xFF, }; RETURN_BAD_IF_BAD( OW_full_access(d, pn) ); data[0] = d[0]; return gbGOOD; } static GOOD_OR_BAD OW_access(BYTE * data, const struct parsedname *pn) { BYTE d[2] = { _DS2406_IM|_DS2406_IC|_DS2406_CHS1|_DS2406_CHS0|_DS2406_CRC0, 0xFF, }; RETURN_BAD_IF_BAD( OW_full_access(d, pn) ); data[0] = d[0]; return gbGOOD; } /* Clear latches */ static GOOD_OR_BAD OW_clear(const struct parsedname *pn) { BYTE data[2] = { _DS2406_ALR|_DS2406_IM|_DS2406_IC|_DS2406_CHS0|_DS2406_CRC0, 0xFF, }; return OW_full_access(data, pn);; } // write both control bytes, and read both back static GOOD_OR_BAD OW_full_access(BYTE * data, const struct parsedname *pn) { BYTE p[3 + 2 + 2] = { _1W_CHANNEL_ACCESS, data[0], data[1], }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 2), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; //printf("DS2406 access %.2X %.2X -> %.2X %.2X \n",data[0],data[1],p[3],p[4]); //printf("DS2406 CRC ok\n"); data[0] = p[3]; data[1] = p[4]; return gbGOOD; } /* Support for EmbeddedDataSystems's T8A 8 channel A/D Written by Chase Shimmin cshimmin@berkeley.edu */ static GOOD_OR_BAD OW_voltage(_FLOAT * V, struct parsedname * pn ) { // channel select byte, based on zero-indexed channel number BYTE ch_select = (pn->extension << 2) + 0x02; BYTE data[8+2] = { ch_select,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF, } ; // this is the complete byte sequence we want to write to the ds2406 so it will // select the appropriate channel and initiate adc, and also so it can write // back the results to the trailing 0xFF bytes. BYTE p[] = { _1W_CHANNEL_ACCESS, _DS2406_ALR|_DS2406_TOG|_DS2406_CHS0|_DS2406_CRC1, 0xFF, // Channel control } ; // 'modify' transaction -- so we can read back the trailing bytes. struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_MODIFY( data, data, 8+2 ), TRXN_CRC16( data, 8+2 ), TRXN_END, }; // most & least significant bytes. for the latter, we're actually only interested // in the least significant nibble. BYTE msb, lsb; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; // grab the msb from the adc (in this case, it will be written in the 6th byte sent out) // then take the ones complement and reverse bits. msb = data[5]; msb = ~msb; msb = ((msb * 0x0802LU & 0x22110LU) | (msb * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; // grab the lsb (8th byte), 1s complement, reverse it, and take the 4 original L.S. bits. lsb = data[7]; lsb = ~lsb; lsb = ((lsb * 0x0802LU & 0x22110LU) | (lsb * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; lsb >>= 4; lsb &= 0xF; // convert the traslated and combined msb and lsb into voltages (this is a 0-5v 12-bit adc // so multiply by 5 and divide by 2^12. Then write it into the float field in the OWQ union & return V[0] = ((msb << 4) + lsb) * 5.0 / 4096; return 0; } #if OW_TAI8570 struct s_TAI8570 { BYTE master[8]; BYTE sibling[8]; BYTE reader[8]; BYTE writer[8]; UINT C[6]; }; /* Internal files */ Make_SlaveSpecificTag(BAR, fc_persistent); // Read from the TAI8570 microcontroller vias the paired DS2406s // Updated by Simon Melhuish, with ref. to AAG C++ code static BYTE SEC_READW4[] = { 0x0E, 0x0E, 0x0E, 0x04, 0x0E, 0x0E, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_READW2[] = { 0x0E, 0x0E, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_READW1[] = { 0x0E, 0x0E, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_READW3[] = { 0x0E, 0x0E, 0x0E, 0x04, 0x0E, 0x0E, 0x04, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_READD1[] = { 0x0E, 0x0E, 0x0E, 0x0E, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_READD2[] = { 0x0E, 0x0E, 0x0E, 0x0E, 0x04, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x00 }; static BYTE SEC_RESET[] = { 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 }; static BYTE CFG_READ = _DS2406_ALR|_DS2406_IM|_DS2406_TOG|_DS2406_CHS1|_DS2406_CHS0; // '11101100' Configuraci� de lectura para DS2407 static BYTE CFG_WRITE = _DS2406_ALR|_DS2406_CHS1|_DS2406_CHS0; // '10001100' Configuraci� de Escritura para DS2407 static BYTE CFG_READPULSE = _DS2406_ALR|_DS2406_IM|_DS2406_CHS1; // '11001000' Configuraci� de lectura de Pulso de conversion para DS2407 static GOOD_OR_BAD ReadTmexPage(BYTE * data, size_t size, int page, const struct parsedname *pn); static GOOD_OR_BAD TAI8570_Calibration(UINT * cal, const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD testTAI8570(struct s_TAI8570 *tai, struct one_wire_query *owq); static GOOD_OR_BAD TAI8570_Write(BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_Read(UINT * u, const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_Reset(const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_Check(const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_ClockPulse(const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_DataPulse(const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_CalValue(UINT * cal, BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_SenseValue(UINT * val, BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn); static GOOD_OR_BAD TAI8570_A(struct parsedname *pn); static GOOD_OR_BAD TAI8570_B(struct parsedname *pn); static ZERO_OR_ERROR FS_sibling(struct one_wire_query *owq) { ASCII sib[16]; struct s_TAI8570 tai; FS_del_sibling( "infobyte", owq ) ; if ( BAD( testTAI8570(&tai, owq) ) ) { return -ENOENT; } bytes2string(sib, tai.sibling, 8); return OWQ_format_output_offset_and_size(sib, 16, owq); } static ZERO_OR_ERROR FS_temp(struct one_wire_query *owq) { UINT D2; int UT1, dT; struct s_TAI8570 tai; struct parsedname pn_copy; FS_del_sibling( "infobyte", owq ) ; memcpy(&pn_copy, PN(owq), sizeof(struct parsedname)); //shallow copy if ( BAD( testTAI8570(&tai, owq) ) ) { return -ENOENT; } UT1 = 8 * tai.C[4] + 20224; RETURN_BAD_IF_BAD( TAI8570_SenseValue(&D2, SEC_READD2, &tai, &pn_copy) ); LEVEL_DEBUG("TAI8570 Raw Temperature (D2) = %lu", D2); dT = D2 - UT1; OWQ_F(owq) = (200. + dT * (tai.C[5] + 50.) / 1024.) / 10.; return 0; } static ZERO_OR_ERROR FS_pressure(struct one_wire_query *owq) { _FLOAT TEMP ; FS_del_sibling( "infobyte", owq ) ; if ( FS_r_sibling_F( &TEMP, "TAI8570/temperature", owq )==0 ) { struct parsedname pn_copy; struct s_TAI8570 tai; UINT D1; memcpy(&pn_copy, PN(owq), sizeof(struct parsedname)); //shallow copy if ( BAD( testTAI8570(&tai, owq) ) ) { return -ENOENT; } else if ( BAD( TAI8570_SenseValue(&D1, SEC_READD1, &tai, &pn_copy) ) ) { return -EINVAL; } else { _FLOAT dT = (TEMP * 10. - 200.) * 1024. / (tai.C[5] + 50.); _FLOAT OFF = 4. * tai.C[1] + ((tai.C[3] - 512.) * dT) / 4096.; _FLOAT SENS = 24576. + tai.C[0] + (tai.C[2] * dT) / 1024.; _FLOAT X = (SENS * (D1 - 7168.)) / 16384. - OFF; LEVEL_DEBUG("TAI8570 Raw Pressure (D1) = %lu", D1); OWQ_F(owq) = 250. + X / 32.; return 0; } } return -EINVAL ; } // Read a page and confirm its a valid tmax page // pn should be pointing to putative master device static GOOD_OR_BAD ReadTmexPage(BYTE * data, size_t size, int page, const struct parsedname *pn) { RETURN_BAD_IF_BAD( OW_r_mem(data, size, size * page, pn) ); if (data[0] > size) { LEVEL_DETAIL("Tmex page %d bad length %d", page, data[0]); return gbBAD; // check length } if (CRC16seeded(data, data[0] + 3, page)) { LEVEL_DETAIL("Tmex page %d CRC16 error", page); return gbBAD; // check length } return gbGOOD; } /* called with a copy of pn already set to the right device */ static int TAI8570_config(BYTE cfg, struct parsedname *pn) { BYTE data[] = { _1W_CHANNEL_ACCESS, cfg, }; BYTE dummy[] = { 0xFF, 0xFF, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(data), TRXN_READ2(dummy), TRXN_END, }; //printf("TAI8570_config\n"); return BUS_transaction(t, pn); } static GOOD_OR_BAD TAI8570_A(struct parsedname *pn) { BYTE b = 0xFF; int i; for (i = 0; i < 5; ++i) { RETURN_BAD_IF_BAD( OW_access(&b, pn) ); RETURN_BAD_IF_BAD( OW_w_control(b | 0x20, pn) ); RETURN_BAD_IF_BAD( OW_access(&b, pn) ); if (b & 0xDF) { return gbGOOD; } } return gbBAD; } static GOOD_OR_BAD TAI8570_B(struct parsedname *pn) { BYTE b = 0xFF; int i; for (i = 0; i < 5; ++i) { RETURN_BAD_IF_BAD( OW_access(&b, pn) ); RETURN_BAD_IF_BAD( OW_w_control(b | 0x40, pn) ) ; RETURN_BAD_IF_BAD( OW_access(&b, pn) ) ; if (b & 0xBF) { return gbGOOD; } } return gbBAD; } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_ClockPulse(const struct s_TAI8570 *tai, struct parsedname *pn) { memcpy(pn->sn, tai->reader, 8); RETURN_BAD_IF_BAD( TAI8570_A(pn) ); memcpy(pn->sn, tai->writer, 8); return TAI8570_A(pn); } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_DataPulse(const struct s_TAI8570 *tai, struct parsedname *pn) { memcpy(pn->sn, tai->reader, 8); RETURN_BAD_IF_BAD( TAI8570_B(pn) ); memcpy(pn->sn, tai->writer, 8); return TAI8570_B(pn); } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_Reset(const struct s_TAI8570 *tai, struct parsedname *pn) { RETURN_BAD_IF_BAD( TAI8570_ClockPulse(tai, pn) ); //printf("TAI8570 Clock ok\n") ; memcpy(pn->sn, tai->writer, 8); RETURN_BAD_IF_BAD( TAI8570_config(CFG_WRITE, pn) ); // config write //printf("TAI8570 config (reset) ok\n") ; return TAI8570_Write(SEC_RESET, tai, pn); } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_Write(BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn) { size_t len = strlen((ASCII *) cmd); BYTE zero = 0x04; struct transaction_log t[] = { TRXN_BLIND(cmd, len), TRXN_BLIND(&zero, 1), TRXN_END, }; memcpy(pn->sn, tai->writer, 8); RETURN_BAD_IF_BAD( TAI8570_config(CFG_WRITE, pn) ); // config write //printf("TAI8570 config (write) ok\n") ; return BUS_transaction(t, pn); } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_Read(UINT * u, const struct s_TAI8570 *tai, struct parsedname *pn) { size_t i, j; BYTE data[32]; UINT U = 0; struct transaction_log t[] = { TRXN_MODIFY(data, data, 32), TRXN_END, }; //printf("TAI8570_Read\n"); memcpy(pn->sn, tai->reader, 8); RETURN_BAD_IF_BAD( TAI8570_config(CFG_READ, pn) ); // config write //printf("TAI8570 read ") ; for (i = j = 0; i < 16; ++i) { data[j++] = 0xFF; data[j++] = 0xFA; } RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; for (j = 0; j < 32; j += 2) { U = U << 1; if (data[j] & 0x80) { ++U; } //printf("%.2X%.2X ",data[j],data[j+1]) ; } //printf("\n") ; u[0] = U; return gbGOOD; } /* called with a copy of pn */ static GOOD_OR_BAD TAI8570_Check(const struct s_TAI8570 *tai, struct parsedname *pn) { size_t i; BYTE data[1]; struct transaction_log t[] = { TRXN_DELAY(1), TRXN_READ1(data), TRXN_END, }; UT_delay(29); // conversion time in msec memcpy(pn->sn, tai->writer, 8); RETURN_BAD_IF_BAD( TAI8570_config(CFG_READPULSE, pn) ); // config write for (i = 0; i < 100; ++i) { RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; //printf("%.2X ",data[0]) ; if (data[0] != 0xFF) { break; } } //printf("TAI8570 conversion poll = %d\n",i) ; return gbGOOD; } /* Called with a copy of pn */ static GOOD_OR_BAD TAI8570_SenseValue(UINT * val, BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn) { RETURN_BAD_IF_BAD( TAI8570_Reset(tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_Write(cmd, tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_Check(tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_ClockPulse(tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_Read(val, tai, pn) ); return TAI8570_DataPulse(tai, pn); } /* Called with a copy of pn */ static GOOD_OR_BAD TAI8570_CalValue(UINT * cal, BYTE * cmd, const struct s_TAI8570 *tai, struct parsedname *pn) { RETURN_BAD_IF_BAD( TAI8570_ClockPulse(tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_Write(cmd, tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_ClockPulse(tai, pn) ); RETURN_BAD_IF_BAD( TAI8570_Read(cal, tai, pn) ); TAI8570_DataPulse(tai, pn); return gbGOOD; } /* read calibration constants and put in Cache, too return 0 on successful aquisition */ /* Called with a copy of pn */ static GOOD_OR_BAD TAI8570_Calibration(UINT * cal, const struct s_TAI8570 *tai, struct parsedname *pn) { UINT oldcal[4] = { 0, 0, 0, 0, }; int rep; for (rep = 0; rep < 5; ++rep) { //printf("TAI8570_Calibration #%d\n",rep); RETURN_BAD_IF_BAD( TAI8570_Reset(tai, pn) ) ; //printf("TAI8570 Pre_Cal_Value\n"); TAI8570_CalValue(&cal[0], SEC_READW1, tai, pn); //printf("TAI8570 SIBLING cal[0]=%u ok\n",cal[0]); TAI8570_CalValue(&cal[1], SEC_READW2, tai, pn); //printf("TAI8570 SIBLING cal[1]=%u ok\n",cal[1]); TAI8570_CalValue(&cal[2], SEC_READW3, tai, pn); //printf("TAI8570 SIBLING cal[2]=%u ok\n",cal[2]); TAI8570_CalValue(&cal[3], SEC_READW4, tai, pn); //printf("TAI8570 SIBLING cal[3]=%u ok\n",cal[3]); if (memcmp(cal, oldcal, sizeof(oldcal)) == 0) { return gbGOOD; } memcpy(oldcal, cal, sizeof(oldcal)); } return gbBAD; // couldn't get the same answer twice in a row } /* Called with a copy of pn */ static GOOD_OR_BAD testTAI8570(struct s_TAI8570 *tai, struct one_wire_query *owq) { int pow; BYTE data[32]; UINT cal[4]; struct parsedname *pn = PN(owq); // see which DS2406 is powered if ( FS_r_sibling_Y( &pow, "power", owq ) != 0 ) { return gbBAD ; } // See if already cached if ( GOOD( Cache_Get_SlaveSpecific((void *) tai, sizeof(struct s_TAI8570), SlaveSpecificTag(BAR), pn)) ) { LEVEL_DEBUG("TAI8570 cache read: reader=" SNformat " writer=" SNformat, SNvar(tai->reader), SNvar(tai->writer)); LEVEL_DEBUG("TAI8570 cache read: C1=%u C2=%u C3=%u C4=%u C5=%u C6=%u", tai->C[0], tai->C[1], tai->C[2], tai->C[3], tai->C[4], tai->C[5]); return gbGOOD; } // Set master SN memcpy(tai->master, pn->sn, 8); // read page 0 RETURN_BAD_IF_BAD( ReadTmexPage(data, 32, 0, pn) ) ; if (memcmp("8570", &data[8], 4)) { // check dir entry LEVEL_DETAIL("No 8570 Tmex file"); return gbBAD; } // See if page 1 is readable RETURN_BAD_IF_BAD( ReadTmexPage(data, 32, 1, pn) ) ; memcpy(tai->sibling, &data[1], 8); if (pow) { memcpy(tai->writer, tai->master, 8); memcpy(tai->reader, tai->sibling, 8); } else { memcpy(tai->reader, tai->master, 8); memcpy(tai->writer, tai->sibling, 8); } LEVEL_DETAIL("TAI8570 reader=" SNformat " writer=" SNformat, SNvar(tai->reader), SNvar(tai->writer)); if ( BAD( TAI8570_Calibration(cal, tai, pn) ) ) { LEVEL_DETAIL("Trouble reading TAI8570 calibration constants"); return gbBAD; } tai->C[0] = ((cal[0]) >> 1); tai->C[1] = ((cal[3]) & 0x3F) | (((cal[2]) & 0x3F) << 6); tai->C[2] = ((cal[3]) >> 6); tai->C[3] = ((cal[2]) >> 6); tai->C[4] = ((cal[1]) >> 6) | (((cal[0]) & 0x01) << 10); tai->C[5] = ((cal[1]) & 0x3F); LEVEL_DETAIL("TAI8570 C1=%u C2=%u C3=%u C4=%u C5=%u C6=%u", tai->C[0], tai->C[1], tai->C[2], tai->C[3], tai->C[4], tai->C[5]); memcpy(pn->sn, tai->master, 8); // restore original for cache return Cache_Add_SlaveSpecific((const void *) tai, sizeof(struct s_TAI8570), SlaveSpecificTag(BAR), pn); } #endif /* OW_TAI8570 */ owfs-2.8p15/module/owlib/src/c/ow_ds1410.c0000664000175000017500000000103711371315635015017 00000000000000/* $Id: ow_ds1410.c,v 1.72 2010/05/08 17:13:01 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" /* The parallel adapter has never worked for us, let's not pretend */ GOOD_OR_BAD DS1410_detect(struct connection_in *in) { (void) in; return gbBAD; } owfs-2.8p15/module/owlib/src/c/ow_none.c0000664000175000017500000000625411654105251015043 00000000000000/* $Id: ow_none.c,v 1.13 2011/03/24 01:17:33 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server version 0.9 8/21/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Poliqcy. --------------------------------------------------------------------------- Implementation: 25-05-2003 iButtonLink device */ #include #include "owfs_config.h" #include "ow_none.h" /* ------- Structures ----------- */ struct filetype NoDev[] = { F_address, F_code, F_crc8, F_id, F_present, F_r_address, F_r_id, }; struct device UnknownDevice = { "XX", "generic", ePN_real, COUNT_OF_FILETYPES(NoDev), NoDev, NO_GENERIC_READ, NO_GENERIC_WRITE }; struct device RemoteDevice = { "YY", "remote_alias", ePN_real, COUNT_OF_FILETYPES(NoDev), NoDev, NO_GENERIC_READ, NO_GENERIC_WRITE }; /* ------- Functions ------------ */ owfs-2.8p15/module/owlib/src/c/ow_locator.c0000664000175000017500000000501411360752555015551 00000000000000/* $Id: ow_locator.c,v 1.21 2010/04/13 02:22:37 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_standard.h" /* ------- Prototypes ----------- */ static GOOD_OR_BAD OW_locator(BYTE * loc, const struct parsedname *pn); static GOOD_OR_BAD OW_fake_locator(BYTE * loc, const struct parsedname *pn); static GOOD_OR_BAD OW_any_locator(BYTE * loc, const struct parsedname *pn); /* ------- Functions ------------ */ ZERO_OR_ERROR FS_locator(struct one_wire_query *owq) { BYTE loc[SERIAL_NUMBER_SIZE]; ASCII ad[SERIAL_NUMBER_SIZE*2]; OW_any_locator(loc, PN(owq) ) ; bytes2string(ad, loc, SERIAL_NUMBER_SIZE); return OWQ_format_output_offset_and_size(ad, sizeof(ad), owq); } // reversed address ZERO_OR_ERROR FS_r_locator(struct one_wire_query *owq) { BYTE loc[SERIAL_NUMBER_SIZE]; ASCII ad[SERIAL_NUMBER_SIZE*2]; size_t i; RETURN_ERROR_IF_BAD( OW_any_locator(loc, PN(owq) ) ) ; for (i = 0; i < SERIAL_NUMBER_SIZE; ++i) { num2string(ad + (i << 1), loc[7 - i]); } return OWQ_format_output_offset_and_size(ad, sizeof(ad), owq); } static GOOD_OR_BAD OW_any_locator(BYTE * loc, const struct parsedname *pn) { memset( loc, 0xFF, SERIAL_NUMBER_SIZE ) ; // default if no locator switch (get_busmode(pn->selected_connection)) { case bus_fake: case bus_tester: case bus_mock: return OW_fake_locator(loc, pn); default: return OW_locator(loc, pn); } } static GOOD_OR_BAD OW_locator(BYTE * loc, const struct parsedname *pn) { BYTE addr[2+SERIAL_NUMBER_SIZE] = { _1W_LOCATOR, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; // key and 8 byte default struct transaction_log t[] = { TRXN_NVERIFY, TRXN_MODIFY(addr, addr, sizeof(addr)), TRXN_END, }; if (BUS_transaction(t, pn)) { return gbBAD; } memcpy(loc, &addr[2], SERIAL_NUMBER_SIZE); return gbGOOD; } static GOOD_OR_BAD OW_fake_locator(BYTE * loc, const struct parsedname *pn) { if (pn->sn[SERIAL_NUMBER_SIZE-1] & 0x01) { // 50% chance of locator // start with 0xFE and use rest of sn (with valid CRC8) loc[0] = 0xFE; loc[1] = pn->sn[1] ; loc[2] = pn->sn[2] ; loc[3] = pn->sn[3] ; loc[4] = pn->sn[4] ; loc[5] = pn->sn[5] ; loc[6] = pn->sn[6] ; loc[SERIAL_NUMBER_SIZE-1] = CRC8compute(loc, SERIAL_NUMBER_SIZE-1, 0); } return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_fs_alias.c0000664000175000017500000000262111547216310015657 00000000000000/* $Id: ow_fs_alias.c,v 1.8 2011/04/07 02:09:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_r_alias(struct one_wire_query *owq) { BYTE * sn = OWQ_pn(owq).sn ; ASCII * alias_name = Cache_Get_Alias( sn ) ; if ( alias_name != NULL ) { ZERO_OR_ERROR zoe = OWQ_format_output_offset_and_size_z(alias_name, owq); LEVEL_DEBUG("Found alias %s for "SNformat"\n",alias_name,SNvar(sn)); owfree( alias_name ) ; return zoe; } LEVEL_DEBUG("Didn't find alias %s for "SNformat"\n",alias_name,SNvar(sn)); return OWQ_format_output_offset_and_size_z("", owq); } ZERO_OR_ERROR FS_w_alias(struct one_wire_query *owq) { size_t size = OWQ_size(owq) ; ASCII * alias_name = owmalloc( size+1 ) ; GOOD_OR_BAD gob ; if ( alias_name == NULL ) { return -ENOMEM ; } // make a slightly larger buffer and add a null terminator memset( alias_name, 0, size+1 ) ; memcpy( alias_name, OWQ_buffer(owq), size ) ; gob = Test_and_Add_Alias( alias_name, OWQ_pn(owq).sn ) ; owfree( alias_name ) ; return GOOD(gob) ? 0 : -EINVAL ; } owfs-2.8p15/module/owlib/src/c/ow_sig_handlers.c0000664000175000017500000000372111611711275016544 00000000000000/* $Id: ow_sig_handlers.c,v 1.6 2011/07/21 02:45:17 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" static void DefaultSignalHandler(int signo, siginfo_t * info, void *context) { (void) context; #if OW_MT if (info) { LEVEL_DEBUG ("Signal handler for %d, errno %d, code %d, pid=%ld, self=%lu", signo, info->si_errno, info->si_code, (long int) info->si_pid, pthread_self()); } else { LEVEL_DEBUG("Signal handler for %d, self=%lu", signo, pthread_self()); } #else /* OW_MT */ if (info) { LEVEL_DEBUG("Signal handler for %d, errno %d, code %d, pid=%ld", signo, info->si_errno, info->si_code, (long int) info->si_pid); } else { LEVEL_DEBUG("Signal handler for %d", signo); } #endif /* OW_MT */ return; } void set_signal_handlers(void (*handler) (int signo, siginfo_t * info, void *context)) { struct sigaction sa; int sigs[] = { SIGHUP, 0 }; int i = 0; memset(&sa, 0, sizeof(struct sigaction)); sigemptyset(&(sa.sa_mask)); while(sigs[i] > 0) { sa.sa_flags = SA_SIGINFO; if(handler != NULL) { sa.sa_sigaction = handler; } else { sa.sa_sigaction = DefaultSignalHandler; } if (sigaction(sigs[i], &sa, NULL) == -1) { LEVEL_DEFAULT("Cannot handle signal %d", sigs[i]); exit(1); } i++; } } void set_exit_signal_handlers(void (*ex_handler) (int signo, siginfo_t * info, void *context)) { struct sigaction sa; int sigs[] = { SIGINT, SIGTERM, 0 }; int i = 0; memset(&sa, 0, sizeof(struct sigaction)); sigemptyset(&(sa.sa_mask)); while(sigs[i] > 0) { sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = ex_handler; if (sigaction(sigs[i], &sa, NULL) == -1) { LEVEL_DEFAULT("Cannot handle signal %d", sigs[i]); exit(1); } i++; } } owfs-2.8p15/module/owlib/src/c/ow_reset.c0000664000175000017500000000305011506767407015232 00000000000000/* $Id: ow_reset.c,v 1.7 2010/12/30 02:31:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" // RESET called with bus locked RESET_TYPE BUS_reset(const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; STAT_ADD1_BUS(e_bus_resets, in); switch ( (in->iroutines.reset) (pn) ) { case BUS_RESET_OK: in->reconnect_state = reconnect_ok; // Flag as good! if (in->ds2404_found && ((in->iroutines.flags&ADAP_FLAG_no2404delay)==0) ) { // extra delay for alarming DS1994/DS2404 complience UT_delay(5); } return BUS_RESET_OK ; case BUS_RESET_SHORT: /* Shorted 1-wire bus or minor error shouldn't cause a reconnect */ in->AnyDevices = anydevices_unknown; LEVEL_CONNECT("1-wire bus short circuit."); STAT_ADD1_BUS(e_bus_short_errors, in); return BUS_RESET_SHORT; case BUS_RESET_ERROR: if ( in->ds2404_found ) { // extra reset for DS1994/DS2404 might be needed if ( (in->iroutines.reset) (pn) == BUS_RESET_OK ) { return BUS_RESET_OK ; } } default: in->reconnect_state++; // Flag for eventual reconnection LEVEL_DEBUG("Reset error. Reconnection %d/%d",in->reconnect_state,reconnect_error); STAT_ADD1_BUS(e_bus_reset_errors, in); return BUS_RESET_ERROR ; } } owfs-2.8p15/module/owlib/src/c/ow_com_close.c0000644000175000017500000000221511707143413016037 00000000000000/* $Id: ow_com_close.c,v 1.3 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif void COM_close(struct connection_in *connection) { struct connection_in * head_in ; if (connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to close a NULL device"); return ; } head_in = connection->channel_info.head ; switch ( SOC(head_in)->type ) { case ct_unknown: case ct_none: case ct_usb: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return ; case ct_telnet: case ct_tcp: break ; case ct_i2c: case ct_netlink: LEVEL_DEBUG("Unimplemented!!!"); return ; case ct_serial: break ; } switch ( SOC(head_in)->state ) { case cs_virgin: break ; default: case cs_deflowered: Test_and_Close( &( SOC(head_in)->file_descriptor) ) ; break ; } } owfs-2.8p15/module/owlib/src/c/ow_filelength.c0000664000175000017500000000376211535564273016241 00000000000000/* $Id: ow_filelength.c,v 1.34 2011/03/09 02:40:59 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" /* Length of a property element */ /* based on property type in most cases, except ascii and binary, which are explicitly sized */ size_t FileLength(const struct parsedname *pn) { if (pn->type == ePN_structure) { return PROPERTY_LENGTH_STRUCTURE; /* longest seem to be /1wire/structure/0F/memory.ALL (28 bytes) so far... */ } /* directory ? */ if (IsDir(pn)) { return PROPERTY_LENGTH_DIRECTORY; } switch (pn->selected_filetype->format) { case ft_yesno: return PROPERTY_LENGTH_YESNO; case ft_integer: return PROPERTY_LENGTH_INTEGER; case ft_unsigned: return PROPERTY_LENGTH_UNSIGNED; case ft_float: return PROPERTY_LENGTH_FLOAT; case ft_pressure: return PROPERTY_LENGTH_PRESSURE; case ft_temperature: return PROPERTY_LENGTH_TEMP; case ft_tempgap: return PROPERTY_LENGTH_TEMPGAP; case ft_date: return PROPERTY_LENGTH_DATE; case ft_bitfield: return (pn->extension == EXTENSION_BYTE) ? PROPERTY_LENGTH_UNSIGNED : PROPERTY_LENGTH_YESNO; case ft_vascii: // not used anymore here... case ft_alias: case ft_ascii: case ft_binary: default: return pn->selected_filetype->suglen; } } /* Length of file based on filetype and extension */ size_t FullFileLength(const struct parsedname * pn) { size_t entry_length = FileLength(pn); if (pn->type == ePN_structure) { return entry_length; } else if (pn->extension != EXTENSION_ALL) { return entry_length; } else { size_t elements = pn->selected_filetype->ag->elements; if (pn->selected_filetype->format == ft_binary) { return entry_length * elements; } else { // add room for commas return (entry_length + 1) * elements - 1; } } } owfs-2.8p15/module/owlib/src/c/ow_lib_close.c0000664000175000017500000000166711470535502016044 00000000000000/* $Id: ow_lib_close.c,v 1.20 2010/11/16 17:11:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_devices.h" #include "ow_pid.h" /* All ow library closeup */ void LibClose(void) { LEVEL_CALL("Starting Library cleanup"); LibStop(); PIDstop(); DeviceDestroy(); _MUTEX_ATTR_DESTROY(Mutex.mattr); #if OW_ZERO // Used by browse and announce OW_Free_dnssd_library(); OW_Free_avahi_library(); #endif LEVEL_CALL("Finished Library cleanup"); if (log_available) { closelog(); log_available = 0; } SAFEFREE(Globals.announce_name) ; SAFEFREE(Globals.progname) ; SAFEFREE(Globals.fatal_debug_file) ; LEVEL_DEBUG("Libraries closed"); } owfs-2.8p15/module/owlib/src/c/ow_tcp_open.c0000644000175000017500000000311511707143413015703 00000000000000/* $Id: ow_tcp_open.c,v 1.7 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif //open tcp port /* Called on head of multibus group */ GOOD_OR_BAD tcp_open(struct connection_in *connection) { if ( SOC(connection)->state == cs_virgin ) { char * def_port = NULL ; switch( connection->busmode ) { case bus_link: def_port = DEFAULT_LINK_PORT ; break ; case bus_server: case bus_zero: def_port = DEFAULT_SERVER_PORT ; break ; case bus_ha7net: def_port = DEFAULT_HA7_PORT ; break ; case bus_xport: case bus_serial: def_port = DEFAULT_XPORT_PORT ; break ; case bus_etherweather: def_port = DEFAULT_ETHERWEATHER_PORT ; break ; case bus_enet: def_port = DEFAULT_ENET_PORT ; break ; case bus_xport_control: def_port = DEFAULT_XPORT_CONTROL_PORT ; break ; default: break ; } RETURN_BAD_IF_BAD( ClientAddr( SOC(connection)->devicename, def_port, connection ) ) ; SOC(connection)->file_descriptor = FILE_DESCRIPTOR_BAD ; } SOC(connection)->state = cs_deflowered ; SOC(connection)->file_descriptor = ClientConnect(connection) ; if ( FILE_DESCRIPTOR_NOT_VALID(SOC(connection)->file_descriptor) ) { return gbBAD; } return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_memblob.c0000664000175000017500000001150011535564167015524 00000000000000/* $Id: ow_memblob.c,v 1.9 2011/03/09 02:39:51 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Dallas Semiconductor shall not be used except as stated in the Dallas Semiconductor Branding Policy. --------------------------------------------------------------------------- Implementation: 2006 memblob */ #include #include "owfs_config.h" #include "ow.h" static int MemblobIncrease(size_t length, struct memblob *mb); /* A "memblob" is a structure holding a list of 1-wire serial numbers (8 bytes each) with some housekeeping information It is used for directory caches, and some "all at once" adapters types Most interesting, it allocates memory dynamically. */ void MemblobClear(struct memblob *mb) { SAFEFREE(mb->memory_storage) ; mb->memory_storage = NULL; mb->troubled = 0 ; mb->used = 0; mb->allocated = 0; } void MemblobInit(struct memblob *mb, size_t increment) { mb->used = 0; mb->allocated = 0; mb->troubled = 0 ; mb->increment = increment; mb->memory_storage = NULL; } BYTE * MemblobData(struct memblob * mb) { return mb->memory_storage ; } size_t MemblobLength(struct memblob * mb) { return mb->used ; } int MemblobPure(struct memblob *mb) { return !mb->troubled; } void MemblobTrim(size_t nchars, struct memblob * mb) { if (mb->used < nchars) { MemblobClear(mb) ; } else { mb->used -= nchars ; } } static int MemblobIncrease(size_t length, struct memblob *mb) { // make more room? -- blocks of 10 devices (80byte) if ((mb->used + length > mb->allocated) || (mb->memory_storage == NULL)) { size_t increment = ((length / mb->increment) + 1) * mb->increment; size_t newalloc = mb->allocated + increment; BYTE *try_bigger_block = owrealloc(mb->memory_storage, newalloc); if (try_bigger_block != NULL) { mb->allocated = newalloc; mb->memory_storage = try_bigger_block; } else { // allocation failed -- keep old mb->troubled = 1 ; return -ENOMEM; } } mb->used += length; return 0; } int MemblobAdd(const BYTE * data, size_t length, struct memblob *mb) { size_t used = mb->used; int ret = MemblobIncrease(length, mb); if (ret == 0) { // add the device and increment the counter memcpy(&(mb->memory_storage[used]), data, length); } return ret; } int MemblobAddChar(BYTE character, size_t length, struct memblob *mb) { size_t used = mb->used; int ret = MemblobIncrease(length, mb); if (ret == 0) { // add the device and increment the counter memset(&(mb->memory_storage[used]), character, length); } return ret; } owfs-2.8p15/module/owlib/src/c/ow_generic_read.c0000664000175000017500000000267311447211130016506 00000000000000/* $Id: ow_generic_read.c,v 1.4 2010/09/24 21:04:24 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_generic_read.h" /* ------- Prototypes ----------- */ static ZERO_OR_ERROR UnpagedRead( struct generic_read * gread, struct one_wire_query *owq ) { size_t size = OWQ_size(owq) ; BYTE * p = owmalloc( 3+size ); struct transaction_log t[] = { TRXN_START, TRXN_READ( p, 3+size ) , TRXN_END, } ; if ( p==NULL ) { return -ENOMEM ; } p[0] = gread->command ; p[1] = BYTE_MASK(OWQ_offset(owq)) ; p[2] = BYTE_MASK(OWQ_offset(owq)>>8) ; if ( BAD( BUS_transaction(t,PN(owq)) ) ) { owfree(p) ; return -EINVAL ; } memcpy( OWQ_buffer(owq), &p[3], size ) ; owfree(p) ; return 0 ; } ZERO_OR_ERROR Generic_Read( struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; struct generic_read * gread ; if ( pn==NO_PARSEDNAME && pn->selected_device==NO_DEVICE) { return -ENOTSUP ; } gread = pn->selected_device->g_read ; if ( gread==NO_GENERIC_READ ) { return -ENOTSUP ; } switch ( gread->addressing_type) { case rat_not_supported: return -ENOTSUP ; case rat_2byte: case rat_1byte: case rat_page: case rat_complement: default: return 0 ; } } owfs-2.8p15/module/owlib/src/c/ow_devicelock.c0000644000175000017500000001132711740167516016217 00000000000000/* $Id: ow_devicelock.c,v 1.9 2012/04/08 01:52:14 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" # if OW_MT // dynamically created access control for a 1-wire device // used to negotiate between different threads (queries) struct devlock { pthread_mutex_t lock; BYTE sn[SERIAL_NUMBER_SIZE]; UINT users; }; /* We keep all the devlocks, organized in a tree for faster searching. */ #define DEVTREE_LOCK(pn) _MUTEX_LOCK( ((pn)->selected_connection)->dev_mutex ) #define DEVTREE_UNLOCK(pn) _MUTEX_UNLOCK( ((pn)->selected_connection)->dev_mutex ) /* Bad bad C library */ /* implementation of tfind, tsearch returns an opaque structure */ /* you have to know that the first element is a pointer to your data */ /* This is a tree element for the devlocks */ struct dev_opaque { struct devlock *key; void *other; }; /* compilation error in gcc version 4.0.0 20050519 if dev_compare * is defined as an embedded function */ /* Use the serial numbers to find the right devlock */ static int dev_compare(const void *a, const void *b) { return memcmp(&((const struct devlock *) a)->sn, &((const struct devlock *) b)->sn, SERIAL_NUMBER_SIZE); } /* Grabs a device lock, either one already matching, or creates one */ /* called per-adapter */ /* The device locks (devlock) are kept in a tree */ ZERO_OR_ERROR DeviceLockGet(struct parsedname *pn) { struct devlock *local_devicelock; struct devlock *tree_devicelock; struct dev_opaque *opaque; if (pn->selected_device == DeviceSimultaneous) { /* Shouldn't call DeviceLockGet() on DeviceSimultaneous. No sn exists */ return 0; } /* Cannot lock without knowing which bus since the device trees are bus-specific */ if (pn->selected_connection == NO_CONNECTION) { return -EINVAL ; } /* Need locking? */ /* Exclude external */ if ( pn->selected_filetype->read == FS_r_external || pn->selected_filetype->write == FS_w_external ) { return 0 ; } // Test type switch (pn->selected_filetype->format) { case ft_directory: case ft_subdir: return 0; default: break; } // Ignore static and atomic switch (pn->selected_filetype->change) { case fc_static: case fc_statistic: return 0; default: break; } // Create a devlock block to add to the tree local_devicelock = owmalloc(sizeof(struct devlock)) ; if ( local_devicelock == NULL ) { return -ENOMEM; } memcpy(local_devicelock->sn, pn->sn, SERIAL_NUMBER_SIZE); DEVTREE_LOCK(pn); /* in->dev_db points to the root of a tree of queries that are using this device */ opaque = (struct dev_opaque *)tsearch(local_devicelock, &(pn->selected_connection->dev_db), dev_compare) ; if ( opaque == NULL ) { // unfound and uncreatable DEVTREE_UNLOCK(pn); owfree(local_devicelock); // kill the allocated devlock return -ENOMEM; } tree_devicelock = opaque->key ; if ( local_devicelock == tree_devicelock) { // new device slot // No longer "local" -- the local_device lock now belongs to the device_tree // It will need to be freed later, when the user count returns to zero. _MUTEX_INIT(tree_devicelock->lock); // create a mutex tree_devicelock->users = 0 ; } else { // existing device slot owfree(local_devicelock); // kill the locally allocated devlock (since there already is a matching devlock) } ++(tree_devicelock->users); // add our claim to the device DEVTREE_UNLOCK(pn); _MUTEX_LOCK(tree_devicelock->lock); // now grab the device pn->lock = tree_devicelock; // use this new devlock return 0; } // Unlock the device void DeviceLockRelease(struct parsedname *pn) { if (pn->lock) { // this is the stored pointer to the device in the appropriate device tree // Free the device _MUTEX_UNLOCK(pn->lock->lock); /* Serg: This coredump on his 64-bit server */ // Now mark our disinterest in the device tree (and possibly reap the node)) DEVTREE_LOCK(pn); --pn->lock->users; // remove our interest if (pn->lock->users == 0) { // Nobody's interested! tdelete(pn->lock, &(pn->selected_connection->dev_db), dev_compare); /* Serg: Address 0x5A0D750 is 0 bytes inside a block of size 32 free'd */ _MUTEX_DESTROY(pn->lock->lock); owfree(pn->lock); } DEVTREE_UNLOCK(pn); pn->lock = NULL; } } #else /* not OW_MT */ ZERO_OR_ERROR DeviceLockGet(struct parsedname *pn) { (void) pn; // suppress compiler warning in the trivial case. return 0 ; } void DeviceLockRelease(struct parsedname *pn) { (void) pn; // suppress compiler warning in the trivial case. } #endif /* OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_pressure.c0000664000175000017500000000214211333703241015741 00000000000000/* $Id: ow_pressure.c,v 1.2 2010/02/08 03:36:01 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" struct pressure_data { char * name ; _FLOAT in_mbars ; } PressureData[] = { { "mbar", 1.0, }, { "atm", 0.00098692316931, }, { "mmHg", 0.7500615613, }, { "inHg", 0.029529983071, }, { "psi", 0.014503773801, }, { "Pa", 100.0, }, { "", 1.0, }, { "", 1.0, }, } ; const char *PressureScaleName(enum pressure_type p) { return PressureData[p].name; } /* Pressure Conversion routines */ /* convert internal (mbar) to external format */ _FLOAT Pressure(_FLOAT P, const struct parsedname * pn) { return P * PressureData[PressureScale(pn)].in_mbars ; } /* convert to internal (mbar) from external format */ _FLOAT fromPressure(_FLOAT P, const struct parsedname * pn) { return P / PressureData[PressureScale(pn)].in_mbars ; } owfs-2.8p15/module/owlib/src/c/ow_verify.c0000664000175000017500000000304211371417510015400 00000000000000/* $Id: ow_verify.c,v 1.21 2010/05/09 02:34:48 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_standard.h" /* ------- Prototypes ----------- */ /* ------- Functions ------------ */ // BUS_verify tests if device is present in requested mode // serialnumber is 1-wire device address (64 bits) // return 0 good, 1 bad GOOD_OR_BAD BUS_verify(BYTE search, const struct parsedname *pn) { BYTE buffer[25]; int i, goodbits = 0; // set all bits at first memset(buffer, 0xFF, 25); buffer[0] = search; // now set or clear apropriate bits for search for (i = 0; i < 64; i++) { UT_setbit(buffer, 3 * i + 10, UT_getbit(pn->sn, i)); } // send/recieve the transfer buffer RETURN_BAD_IF_BAD(BUS_sendback_data(buffer, buffer, 25, pn) ) ; if (buffer[0] != search) { return gbBAD; } for (i = 0; (i < 64) && (goodbits < 64); i++) { switch (UT_getbit(buffer, 3 * i + 8) << 1 | UT_getbit(buffer, 3 * i + 9)) { case 0: break; case 1: if (!UT_getbit(pn->sn, i)) { goodbits++; } break; case 2: if (UT_getbit(pn->sn, i)){ goodbits++; } break; case 3: // No device on line return gbBAD; } } // check to see if there were enough good bits to be successful return ( goodbits < 8 ) ? gbBAD : gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_2433.c0000644000175000017500000001565411740076517014511 00000000000000/* $Id: ow_2433.c,v 1.53 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2433.h" /* ------- Prototypes ----------- */ /* DS2433 EEPROM */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); /* ------- Structures ----------- */ static struct aggregate A2431 = { 4, ag_numbers, ag_separate, }; static struct filetype DS2431[] = { F_STANDARD, {"memory", 128, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2431, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(2D, DS2431, DEV_ovdr | DEV_resume, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A2433 = { 16, ag_numbers, ag_separate, }; static struct filetype DS2433[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2433, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(23, DS2433, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A28EC20 = { 80, ag_numbers, ag_separate, }; static struct filetype DS28EC20[] = { F_STANDARD, {"memory", 2560, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A28EC20, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(43, DS28EC20, DEV_ovdr | DEV_resume, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_READ_MEMORY 0xF0 #define _1W_EXTENDED_READ_MEMORY 0xA5 /* ------- Functions ------------ */ /* DS2433 */ static GOOD_OR_BAD OW_w_23page(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_2Dpage(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; /* read is not page-limited */ if (COMMON_read_memory_F0(owq, 0, pagesize)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { /* paged access */ size_t pagesize; switch (PN(owq)->sn[0]) { case 0x2D: pagesize = 8 ; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_2Dpage)) ; default: pagesize = 8 ; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_23page)) ; } } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; if (COMMON_read_memory_F0(owq, OWQ_pn(owq).extension, pagesize)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { /* paged access */ size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } /* paged, and pre-screened */ static GOOD_OR_BAD OW_w_23page(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[1 + 2 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; struct transaction_log treread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ(&p[1], 3 + size), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log twrite33[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(5), TRXN_END, }; struct transaction_log twriteEC20[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(10), TRXN_END, }; /* Copy to scratchpad */ memcpy(&p[3], data, size); if (((offset + size) & 0x1F)) { // doesn't end on page boundary, no crc16 tcopy[2].type = tcopy[3].type = trxn_nop; } RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; /* Re-read scratchpad and compare */ /* Note that we tacitly shift the data one byte down for the E/S byte */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(treread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; switch (pn->sn[0]) { case 0x23: // DS2433 return BUS_transaction(twrite33,pn); case 0x43: default: // DS28EC20 return BUS_transaction(twriteEC20,pn); } } /* paged, and pre-screened */ /* read REAL DS2431 pages -- 8 bytes. */ static GOOD_OR_BAD OW_w_2Dpage(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { off_t pageoff = offset & 0x07; BYTE p[4 + 8 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset - pageoff), }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 3 + 8), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WR_CRC16(p, 1, 3 + 8), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log tsram[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(13), TRXN_END, }; if (size != 8) { // incomplete page OWQ_allocate_struct_and_pointer(owq_old); OWQ_create_temporary(owq_old, (char *) &p[3], 8, offset - pageoff, pn); if (COMMON_read_memory_F0(owq_old, 0, 0)) { return gbBAD; } } memcpy(&p[3 + pageoff], data, size); /* Copy to scratchpad */ RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; /* Re-read scratchpad and compare */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(tsram, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_2409.c0000644000175000017500000001500111740076517014476 00000000000000/* $Id: ow_2409.c,v 1.48 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2409.h" /* ------- Prototypes ----------- */ /* DS2409 switch */ WRITE_FUNCTION(FS_discharge); WRITE_FUNCTION(FS_clearevent); READ_FUNCTION(FS_r_control); WRITE_FUNCTION(FS_w_control); READ_FUNCTION(FS_r_sensed); READ_FUNCTION(FS_r_branch); READ_FUNCTION(FS_r_event); /* ------- Structures ----------- */ static struct aggregate A2409 = { 2, ag_numbers, ag_aggregate, }; static struct filetype DS2409[] = { F_STANDARD, {"discharge", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_discharge, VISIBLE, NO_FILETYPE_DATA, }, {"clearevent", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clearevent, VISIBLE, NO_FILETYPE_DATA, }, {"control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_control, FS_w_control, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A2409, ft_bitfield, fc_volatile, FS_r_sensed, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"branch", PROPERTY_LENGTH_BITFIELD, &A2409, ft_bitfield, fc_volatile, FS_r_branch, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"event", PROPERTY_LENGTH_BITFIELD, &A2409, ft_bitfield, fc_volatile, FS_r_event, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"aux", 0, NON_AGGREGATE, ft_directory, fc_volatile, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, {i:eBranch_aux}, }, {"main", 0, NON_AGGREGATE, ft_directory, fc_volatile, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, {i:eBranch_main}, }, }; DeviceEntry(1F, DS2409, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ /* DS2409 */ static GOOD_OR_BAD OW_r_control(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_discharge(const struct parsedname *pn); static GOOD_OR_BAD OW_clearevent(const struct parsedname *pn); static GOOD_OR_BAD OW_w_control(const UINT data, const struct parsedname *pn); #define _1W_STATUS_READ_WRITE 0x5A #define _1W_ALL_LINES_OFF 0x66 #define _1W_DISCHARGE_LINES 0x99 #define _1W_DIRECT_ON_MAIN 0xA5 #define _1W_SMART_ON_MAIN 0xCC #define _1W_SMART_ON_AUX 0x33 /* discharge 2409 lines */ static ZERO_OR_ERROR FS_discharge(struct one_wire_query *owq) { if ((OWQ_Y(owq) != 0) && BAD( OW_discharge(PN(owq)) ) ) { return -EINVAL; } return 0; } /* Clear 2409 event flags */ /* Added by Jan Kandziora */ static ZERO_OR_ERROR FS_clearevent(struct one_wire_query *owq) { if ((OWQ_Y(owq)!=0) && BAD( OW_clearevent(PN(owq)) ) ) { return -EINVAL; } return 0; } /* 2409 switch -- branch pin voltage */ static ZERO_OR_ERROR FS_r_sensed(struct one_wire_query *owq) { BYTE data = 0 ; // y[0] = data&0x02 ? 1 : 0 ; // y[1] = data&0x08 ? 1 : 0 ; OWQ_U(owq) = ((data >> 1) & 0x01) | ((data >> 2) & 0x02); return GB_to_Z_OR_E( OW_r_control(&data, PN(owq))) ; } /* 2409 switch -- branch status -- note that bit value is reversed */ static ZERO_OR_ERROR FS_r_branch(struct one_wire_query *owq) { BYTE data = 0 ; // y[0] = data&0x01 ? 0 : 1 ; // y[1] = data&0x04 ? 0 : 1 ; OWQ_U(owq) = (((data) & 0x01) | ((data >> 1) & 0x02)) ^ 0x03; return GB_to_Z_OR_E(OW_r_control(&data, PN(owq))) ; } /* 2409 switch -- event status */ static ZERO_OR_ERROR FS_r_event(struct one_wire_query *owq) { BYTE data = 0 ; // y[0] = data&0x10 ? 1 : 0 ; // y[1] = data&0x20 ? 1 : 0 ; OWQ_U(owq) = (data >> 4) & 0x03; return GB_to_Z_OR_E(OW_r_control(&data, PN(owq))) ; } /* 2409 switch -- control pin state */ static ZERO_OR_ERROR FS_r_control(struct one_wire_query *owq) { BYTE data = 0 ; UINT control[] = { 2, 3, 0, 1, }; OWQ_U(owq) = control[data >> 6]; return GB_to_Z_OR_E(OW_r_control(&data, PN(owq))) ; } /* 2409 switch -- control pin state */ static ZERO_OR_ERROR FS_w_control(struct one_wire_query *owq) { if (OWQ_U(owq) > 3) { return -EINVAL; } return GB_to_Z_OR_E(OW_w_control(OWQ_U(owq), PN(owq))) ; } /* Fix from Jan Kandziora for proper command code */ static GOOD_OR_BAD OW_discharge(const struct parsedname *pn) { BYTE dis[] = { _1W_DISCHARGE_LINES, }; BYTE alo[] = { _1W_ALL_LINES_OFF, }; GOOD_OR_BAD gbRet ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(dis), TRXN_DELAY(100), TRXN_START, TRXN_WRITE1(alo), TRXN_END, }; BUSLOCK(pn); pn->selected_connection->branch.branch = eBranch_bad ; gbRet = BUS_transaction_nolock(t, pn) ; BUSUNLOCK(pn); return gbRet ; } /* Added by Jan Kandziora */ static GOOD_OR_BAD OW_clearevent(const struct parsedname *pn) { BYTE clr[] = { _1W_ALL_LINES_OFF, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(clr), TRXN_END, }; // Could certainly couple this with next transaction return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_w_control(const UINT data, const struct parsedname *pn) { const BYTE d[] = { 0x20, 0xA0, 0x00, 0x40, }; BYTE p[] = { _1W_STATUS_READ_WRITE, d[data], }; const BYTE r[] = { 0x80, 0xC0, 0x00, 0x40, }; BYTE info; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_READ1(&info), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; /* Check that Info corresponds */ return (info & 0xC0) == r[data] ? gbGOOD : gbBAD; } static GOOD_OR_BAD OW_r_control(BYTE * data, const struct parsedname *pn) { BYTE p[] = { _1W_STATUS_READ_WRITE, 0xFF, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_READ1(data), TRXN_END, }; return BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_programpulse.c0000664000175000017500000000145111446543274016630 00000000000000/* $Id: ow_programpulse.c,v 1.4 2010/09/23 03:17:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" GOOD_OR_BAD BUS_ProgramPulse(const struct parsedname *pn) { GOOD_OR_BAD ret = gbBAD ; if ( pn->selected_connection->iroutines.ProgramPulse != NO_PROGRAMPULSE_ROUTINE ) { ret = (pn->selected_connection->iroutines.ProgramPulse) (pn); } if ( BAD(ret) ) { STAT_ADD1_BUS(e_bus_program_errors, pn->selected_connection); } return ret; } owfs-2.8p15/module/owlib/src/c/ow_parseshallow.c0000664000175000017500000000135011436512603016601 00000000000000/* $Id: ow_parseshallow.c,v 1.7 2010/08/29 17:14:43 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" void OWQ_create_temporary(struct one_wire_query *owq_temporary, char *buffer, size_t size, off_t offset, struct parsedname *pn) { OWQ_buffer(owq_temporary) = buffer; OWQ_size(owq_temporary) = size; OWQ_offset(owq_temporary) = offset; memcpy(PN(owq_temporary), pn, sizeof(struct parsedname)); } owfs-2.8p15/module/owlib/src/c/ow_slurp.c0000664000175000017500000000414411611711275015247 00000000000000/* $Id: ow_slurp.c,v 1.13 2011/07/21 02:45:17 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif static void Slurp( FILE_DESCRIPTOR_OR_ERROR file_descriptor, unsigned long usec ) ; void COM_slurp( struct connection_in * connection ) { unsigned long usec = 0 ; // just to suppress compiler warning if ( connection == NO_CONNECTION ) { return ; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("Unknown type"); return ; case ct_telnet: // see if we can tell the port to dump all pending data if ( SOC(connection)->dev.telnet.telnet_negotiated == completed_negotiation ) { if ( BAD( COM_test(connection) ) ) { return ; } telnet_purge( connection ) ; } // now do it the old fashioned way of swallowing the pending data // fall through case ct_tcp: case ct_netlink: usec = 100000 ; break ; case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented"); return ; case ct_serial: usec = 1000 ; break ; } if ( BAD( COM_test(connection) ) ) { return ; } Slurp( SOC(connection)->file_descriptor, usec ) ; } /* slurp up any pending chars -- used at the start to clear the com buffer */ static void Slurp( FILE_DESCRIPTOR_OR_ERROR file_descriptor, unsigned long usec ) { BYTE data[1] ; while (1) { fd_set readset; // very short timeout struct timeval tv = { 0, usec } ; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); /* Read if it doesn't timeout first */ if ( select(file_descriptor + 1, &readset, NULL, NULL, &tv) < 1 ) { return ; } if (FD_ISSET(file_descriptor, &readset) == 0) { return ; } if ( read(file_descriptor, data, 1) < 1 ) { return ; } TrafficInFD("slurp",data,1,file_descriptor); } } owfs-2.8p15/module/owlib/src/c/ow_bus_bitdata.c0000664000175000017500000000376311501267164016372 00000000000000/* $Id: ow_bus_bitdata.c,v 1.2 2010/12/13 00:53:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" /** BUS_send_data Send a data and expect response match */ GOOD_OR_BAD BUS_send_bits(const BYTE * data, const size_t len, const struct parsedname *pn) { BYTE resp[len]; if (len == 0) { return gbGOOD; } if ( BAD( BUS_sendback_bits(data, resp, len, pn) ) ) { STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD ; } RETURN_GOOD_IF_GOOD( BUS_compare_bits( data, resp, len ) ) ; LEVEL_DEBUG("Response doesn't match bits sent"); STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD ; } // compare bits (just non-zero or zero) GOOD_OR_BAD BUS_compare_bits(const BYTE * data1, const BYTE * data2, const size_t len) { size_t i ; if (len == 0) { return gbGOOD; } for ( i=0 ; i< len ; ++i ) { if ( (data1[i]==0) != (data2[i]==0) ) { return gbBAD ; } } return gbGOOD; } /** readin_data Send 0xFFs and return response block */ GOOD_OR_BAD BUS_readin_bits(BYTE * data, const size_t len, const struct parsedname *pn) { memset(data, 0xFF, (size_t) len) ; RETURN_GOOD_IF_GOOD( BUS_sendback_bits( data, data, len, pn) ) ; STAT_ADD1(BUS_readin_data_errors); return gbBAD; } GOOD_OR_BAD BUS_sendback_bits( const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn ) { GOOD_OR_BAD (*sendback_bits) (const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn) = ((pn)->selected_connection->iroutines.sendback_bits) ; if ( sendback_bits != NO_SENDBACKBITS_ROUTINE ) { return (sendback_bits)((databits),(respbits),(len),(pn)) ; } return gbBAD ; } owfs-2.8p15/module/owlib/src/c/ow_browse.c0000664000175000017500000001330311447211130015370 00000000000000/* $Id: ow_browse.c,v 1.46 2010/09/24 21:04:24 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #if OW_ZERO && OW_MT #include "ow_connection.h" struct BrowseStruct { char *name; char *type; char *domain; }; static struct BrowseStruct *Browse_Struct_Create(const char *name, const char *type, const char *domain); static void Browse_Struct_Destroy(struct BrowseStruct *browse_struct); static void * OW_Browse_Bonjour(void * v) ; static void ResolveWait( DNSServiceRef sref ) ; static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const unsigned char *t, void *c); static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context); static void ResolveBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *n, const char *host, uint16_t port, uint16_t tl, const unsigned char *t, void *c) { struct BrowseStruct *browse_struct = c; char service[11] ; int sn_ret ; (void) tl; (void) t; UCLIBCLOCK ; sn_ret = snprintf(service, 10, "%d", ntohs(port) ) ; UCLIBCUNLOCK ; LEVEL_DETAIL("ref=%d flags=%d index=%d, error=%d name=%s host=%s port=%d", (long int) s, f, i, e, n, host, ntohs(port)); /* remove trailing .local. */ if ( sn_ret >-1 ) { LEVEL_DETAIL("ref=%d flags=%d index=%d, error=%d name=%s host=%s port=%s", (long int) s, f, i, e, n, host, service); ZeroAdd( browse_struct->name, browse_struct->type, browse_struct->domain, host, service ) ; } else { LEVEL_DEBUG("Couldn't translate port %d",ntohs(port) ) ; } Browse_Struct_Destroy(browse_struct); } static struct BrowseStruct *Browse_Struct_Create(const char *name, const char *type, const char *domain) { struct BrowseStruct *browse_struct = owmalloc(sizeof(struct BrowseStruct)); if ( browse_struct == NULL ) { return NULL ; } browse_struct->name = ( name != NULL ) ? owstrdup(name) : NULL; browse_struct->type = ( type != NULL ) ? owstrdup(type) : NULL; browse_struct->domain = ( domain != NULL ) ? owstrdup(domain) : NULL; return browse_struct; } static void Browse_Struct_Destroy(struct BrowseStruct *browse_struct) { if ( browse_struct == NULL ) { return; } SAFEFREE(browse_struct->name ) ; SAFEFREE(browse_struct->type ) ; SAFEFREE(browse_struct->domain) ; owfree(browse_struct); } // Wait for a resolve, then return. Timeout after 2 minutes static void ResolveWait( DNSServiceRef sref ) { FILE_DESCRIPTOR_OR_ERROR file_descriptor = DNSServiceRefSockFD(sref); if ( FILE_DESCRIPTOR_VALID(file_descriptor) ) { while (1) { fd_set readfd; struct timeval tv = { 120, 0 }; FD_ZERO(&readfd); FD_SET(file_descriptor, &readfd); if (select(file_descriptor + 1, &readfd, NULL, NULL, &tv) > 0) { if (FD_ISSET(file_descriptor, &readfd)) { DNSServiceProcessResult(sref); } } else if (errno == EINTR) { continue; } else { ERROR_CONNECT("Resolve timeout error"); } break; } } } /* Sent back from Bounjour -- arbitrarily use it to set the Ref for Deallocation */ static void BrowseBack(DNSServiceRef s, DNSServiceFlags f, uint32_t i, DNSServiceErrorType e, const char *name, const char *type, const char *domain, void *context) { struct BrowseStruct *browse_struct; (void) context; LEVEL_DETAIL("ref=%ld flags=%d index=%d, error=%d name=%s type=%s domain=%s", (long int) s, f, i, e, name, type, domain); if (e != kDNSServiceErr_NoError) { return ; } browse_struct = Browse_Struct_Create( name, type, domain ) ; if (f & kDNSServiceFlagsAdd) { // Add DNSServiceRef sr; if (DNSServiceResolve(&sr, 0, 0, name, type, domain, ResolveBack, (void *)browse_struct) == kDNSServiceErr_NoError) { ResolveWait(sr) ; DNSServiceRefDeallocate(sr); } else { Browse_Struct_Destroy(browse_struct) ; } } else { // Remove Browse_Struct_Destroy(browse_struct) ; ZeroDel( name, type, domain ) ; } } // Called in a thread static void * OW_Browse_Bonjour(void * v) { struct connection_in * in = v ; DNSServiceErrorType dnserr; DETACH_THREAD; MONITOR_RLOCK ; dnserr = DNSServiceBrowse(&in->master.browse.bonjour_browse, 0, 0, "_owserver._tcp", NULL, BrowseBack, NULL); if (dnserr != kDNSServiceErr_NoError) { LEVEL_CONNECT("DNSServiceBrowse error = %d", dnserr); MONITOR_RUNLOCK ; return VOID_RETURN ; } // Blocks, which is why this is in it's own thread while (DNSServiceProcessResult(in->master.browse.bonjour_browse) == kDNSServiceErr_NoError) { //printf("DNSServiceProcessResult ref %ld\n",(long int)rs->sref) ; continue; } DNSServiceRefDeallocate(in->master.browse.bonjour_browse); in->master.browse.bonjour_browse = 0 ; MONITOR_RUNLOCK ; return VOID_RETURN; } void OW_Browse(struct connection_in *in) { if ( Globals.zero == zero_avahi ) { #if !OW_CYGWIN pthread_t thread; int err = pthread_create(&thread, DEFAULT_THREAD_ATTR, OW_Avahi_Browse, (void *) in); if (err) { LEVEL_CONNECT("Avahi Browse thread error %d.", err); } #endif } else if ( Globals.zero == zero_bonjour ) { pthread_t thread; int err = pthread_create(&thread, DEFAULT_THREAD_ATTR, OW_Browse_Bonjour, (void *) in); if (err) { LEVEL_CONNECT("Bonjour Browse thread error %d.", err); } } } #else /* OW_ZERO && OW_MT */ void OW_Browse(struct connection_in *in) { (void) in ; LEVEL_CONNECT("Avahi and Bonjour (and Multithreading) was not enabled"); } #endif /* OW_ZERO && OW_MT*/ owfs-2.8p15/module/owlib/src/c/ow_add_inflight.c0000644000175000017500000000245111664034004016507 00000000000000/* $Id: ow_add_inflight.c,v 1.10 2011/11/26 00:51:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" /* Can only be called by a separate (monitoring) thread so the write-lock won't deadlock */ /* This allows adding new Bus Masters while program is running * The master is usually only read-locked for normal operation * write lock is done in a separate thread when no requests are being processed */ void Add_InFlight( GOOD_OR_BAD (*nomatch)(struct connection_in * trial,struct connection_in * existing), struct connection_in * new_in ) { if ( new_in == NO_CONNECTION ) { return ; } LEVEL_DEBUG("Request master be added: %s", SOC(new_in)->devicename); CONNIN_WLOCK ; if ( nomatch != NULL ) { struct connection_in * in ; for ( in = Inbound_Control.head ; in != NO_CONNECTION ; in = in->next ) { if ( GOOD( nomatch( new_in, in )) ) { continue ; } LEVEL_DEBUG("Already exists as index=%d",in->index) ; CONNIN_WUNLOCK ; RemoveIn( new_in ) ; return ; } } LinkIn(new_in); CONNIN_WUNLOCK ; } owfs-2.8p15/module/owlib/src/c/ow_server_enet.c0000644000175000017500000003152211705420154016416 00000000000000/* $Id: ow_server_enet.c,v 1.53 2012/01/18 01:29:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* not our owserver, but a stand-alone device made by EDS called OW-SERVER-ENET */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" #define BYTE_string(x) ((BYTE *)(x)) static RESET_TYPE OWServer_Enet_reset(const struct parsedname *pn); static void OWServer_Enet_close(struct connection_in *in); static enum search_status OWServer_Enet_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD OWServer_Enet_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void OWServer_Enet_setroutines(struct connection_in *in); static GOOD_OR_BAD OWServer_Enet_select( const struct parsedname * pn ) ; static GOOD_OR_BAD OWServer_Enet_reopen(struct connection_in *in) ; static GOOD_OR_BAD OWServer_Enet_read( BYTE * buf, size_t size, struct connection_in * in ) ; static GOOD_OR_BAD OWServer_Enet_write(const BYTE * buf, size_t size, struct connection_in *in) ; static GOOD_OR_BAD OWServer_Enet_write_string( char * buf, struct connection_in *in) ; static char OWServer_Enet_command( char * cmd_string, struct connection_in * in ) ; static RESET_TYPE OWServer_Enet_reset_in(struct connection_in * in); static GOOD_OR_BAD OWServer_Enet_directory(struct device_search *ds, struct connection_in * in) ; static enum ENET_dir OWServer_Enet_directory_loop(struct device_search *ds, struct connection_in * in) ; static GOOD_OR_BAD OWServer_Enet_sendback_part(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) ; #define BAD_CHAR ( (char) -1 ) static void OWServer_Enet_setroutines(struct connection_in *in) { in->iroutines.detect = OWServer_Enet_detect; in->iroutines.reset = OWServer_Enet_reset; in->iroutines.next_both = OWServer_Enet_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = OWServer_Enet_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = OWServer_Enet_select ; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE ; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = OWServer_Enet_close; in->iroutines.flags = ADAP_FLAG_dirgulp | ADAP_FLAG_no2409path | ADAP_FLAG_overdrive | ADAP_FLAG_bundle | ADAP_FLAG_no2404delay ; in->bundling_length = HA7E_FIFO_SIZE; } GOOD_OR_BAD OWServer_Enet_detect(struct connection_in *in) { /* Set up low-level routines */ OWServer_Enet_setroutines(in); in->Adapter = adapter_ENET; in->adapter_name = "OWServer_Enet"; in->busmode = bus_enet; // A lot of telnet parameters, really only used // to goose the connection when reconnecting // The ENET tolerates telnet, but isn't really // into RFC2217 COM_set_standard(in) ; SOC(in)->timeout.tv_sec = 0 ; SOC(in)->timeout.tv_usec = 600000 ; SOC(in)->flow = flow_none; // flow control SOC(in)->baud = B115200 ; if ( SOC(in)->devicename == NULL) { return gbBAD; } SOC(in)->type = ct_telnet ; RETURN_BAD_IF_BAD( COM_open(in) ) ; // Always returns 0D0A in->master.enet.reopening = 0 ; memset( in->master.enet.sn, 0x00, SERIAL_NUMBER_SIZE ) ; // Assume single channel in->master.enet.channel = 0 ; in->master.enet.head = in ; // refer to the head (this channnel) RETURN_GOOD_IF_GOOD( OWServer_Enet_reopen(in)) ; RETURN_GOOD_IF_GOOD( OWServer_Enet_reopen(in)) ; LEVEL_DEFAULT("Problem opening OW_SERVER_ENET on IP address=[%s] port=[%s] -- is the \"1-Wire Setup\" enabled?", SAFESTRING(SOC(in)->dev.tcp.host), SOC(in)->dev.tcp.service ); return gbBAD ; } static GOOD_OR_BAD OWServer_Enet_reopen(struct connection_in *in) { if ( in->master.enet.reopening ) { LEVEL_DEBUG("Attempt to double-reopen %s",SAFESTRING(SOC(in)->devicename)) ; return gbBAD ; } // clear "stored" Enet device memset( in->master.enet.sn, 0x00, SERIAL_NUMBER_SIZE ) ; RETURN_BAD_IF_BAD( COM_open(in) ) ; //printf("ENET: reopen com port\n"); telnet_change( in ) ; // Really just to send a prompt in->master.enet.reopening = 1 ; // flag in reopening mode if ( OWServer_Enet_command( "", in ) == '?' ) { in->master.enet.reopening = 0 ; // out of reopening mode return gbGOOD ; } in->master.enet.reopening = 0 ; // out of reopening mode LEVEL_DEBUG("Cannot read the initial prompt"); return gbBAD ; } static RESET_TYPE OWServer_Enet_reset(const struct parsedname *pn) { return OWServer_Enet_reset_in( pn->selected_connection ) ; } static RESET_TYPE OWServer_Enet_reset_in(struct connection_in * in) { char reset_response = OWServer_Enet_command( "R\r", in ) ; switch ( reset_response ) { case 'P': in->AnyDevices = anydevices_yes; return BUS_RESET_OK; case 'N': in->AnyDevices = anydevices_no; return BUS_RESET_OK; case BAD_CHAR: LEVEL_DEBUG("Problem sending reset character"); return BUS_RESET_ERROR; default: LEVEL_DEBUG("Unrecognized BUS reset character <%c>",reset_response ) ; return BUS_RESET_ERROR; } } static enum search_status OWServer_Enet_next_both(struct device_search *ds, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; //Special case for DS2409 hub, use low-level code if ( pn->ds2409_depth>0 ) { return search_error ; } if (ds->LastDevice) { return search_done; } if (ds->index == -1) { if ( BAD(OWServer_Enet_directory(ds, in)) ) { return search_error; } } // LOOK FOR NEXT ELEMENT ++ds->index; LEVEL_DEBUG("Index %d", ds->index); switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } #define DEVICE_LENGTH 16 #define EXCLAIM_LENGTH 1 enum ENET_dir { ENET_dir_ok, ENET_dir_repeat, ENET_dir_bad } ; static GOOD_OR_BAD OWServer_Enet_directory(struct device_search *ds, struct connection_in * in) { int i ; for ( i=0 ; i<10 ; ++i ) { switch ( OWServer_Enet_directory_loop( ds, in ) ) { case ENET_dir_ok: return gbGOOD ; case ENET_dir_repeat: LEVEL_DEBUG("Repeating directory loop because of communication error"); continue ; case ENET_dir_bad: LEVEL_DEBUG("directory error"); return gbBAD; } } LEVEL_DEBUG("Too many attempts at a directory listing"); return gbBAD ; } static enum ENET_dir OWServer_Enet_directory_loop(struct device_search *ds, struct connection_in * in) { char resp[DEVICE_LENGTH+in->master.serial.tcp.CRLF_size]; char * search_first ; char * search_next ; if ( ds->search == _1W_CONDITIONAL_SEARCH_ROM ) { search_first = "C\r" ; search_next = "c\r" ; } else { search_first = "S\r" ; search_next = "s\r" ; } DirblobClear( &(ds->gulp) ); if (ds->search != _1W_CONDITIONAL_SEARCH_ROM) { in->AnyDevices = anydevices_no; } // send the first search if ( BAD( OWServer_Enet_write_string( search_first, in)) ) { return ENET_dir_bad ; } do { size_t read_so_far = 0 ; // read first character if ( BAD(OWServer_Enet_read(BYTE_string(resp), EXCLAIM_LENGTH, in)) ) { return ENET_dir_bad ; } switch (resp[0]) { case '!': return ENET_dir_ok ; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': read_so_far = EXCLAIM_LENGTH+in->master.serial.tcp.CRLF_size ; break ; default: return ENET_dir_repeat ; } // read rest of the characters if ( BAD(OWServer_Enet_read(BYTE_string(&resp[read_so_far]), DEVICE_LENGTH-read_so_far, in)) ) { return ENET_dir_bad; } BYTE sn[SERIAL_NUMBER_SIZE]; sn[7] = string2num(&resp[0]); sn[6] = string2num(&resp[2]); sn[5] = string2num(&resp[4]); sn[4] = string2num(&resp[6]); sn[3] = string2num(&resp[8]); sn[2] = string2num(&resp[10]); sn[1] = string2num(&resp[12]); sn[0] = string2num(&resp[14]); LEVEL_DEBUG("SN found: " SNformat, SNvar(sn)); // Set as current "Address" for adapter memcpy( in->master.enet.sn, sn, SERIAL_NUMBER_SIZE) ; // CRC check if (CRC8(sn, SERIAL_NUMBER_SIZE) || (sn[0] == 0x00)) { LEVEL_DEBUG("BAD family or CRC8"); return ENET_dir_repeat; } DirblobAdd(sn, &(ds->gulp) ); if (ds->search != _1W_CONDITIONAL_SEARCH_ROM) { in->AnyDevices = anydevices_yes; } // send the subsequent search if ( BAD(OWServer_Enet_write_string( search_next, in)) ) { return ENET_dir_bad ; } } while (1) ; } /* select a device for reference */ static GOOD_OR_BAD OWServer_Enet_select( const struct parsedname * pn ) { struct connection_in * in = pn->selected_connection ; char send_address[] = "A7766554433221100\r" ; // Apparently need to reset before select (Unlike the HA7S) RETURN_BAD_IF_BAD( gbRESET( BUS_reset(pn)) ) ; if ( (pn->selected_device==NO_DEVICE) || (pn->selected_device==DeviceThermostat) ) { return gbGOOD ; } if ( memcmp( pn->sn, in->master.enet.sn, SERIAL_NUMBER_SIZE ) != 0 ) { num2string( &send_address[ 1], pn->sn[7] ) ; num2string( &send_address[ 3], pn->sn[6] ) ; num2string( &send_address[ 5], pn->sn[5] ) ; num2string( &send_address[ 7], pn->sn[4] ) ; num2string( &send_address[ 9], pn->sn[3] ) ; num2string( &send_address[11], pn->sn[2] ) ; num2string( &send_address[13], pn->sn[1] ) ; num2string( &send_address[15], pn->sn[0] ) ; // Set as current "Address" for adapter memcpy( in->master.enet.sn, pn->sn, SERIAL_NUMBER_SIZE) ; } else { // Serial number already loaded in adapter strcpy( send_address, "M\r" ) ; } return (OWServer_Enet_command( send_address, in ) == '+') ? gbGOOD : gbBAD ; } /* send a command and get the '+' */ static char OWServer_Enet_command( char * cmd_string, struct connection_in * in ) { char cmd_response[1+in->master.serial.tcp.CRLF_size] ; //printf("ENET: Send command\n"); if ( BAD( OWServer_Enet_write_string( cmd_string, in )) ) { LEVEL_DEBUG("Error sending string <%s>", cmd_string ) ; return BAD_CHAR ; } //printf("ENET: Get Response\n"); if ( BAD( OWServer_Enet_read( BYTE_string(cmd_response), 1, in )) ) { LEVEL_DEBUG("Error reading response to <%s>", cmd_string ) ; return BAD_CHAR ; } return cmd_response[0] ; } static GOOD_OR_BAD OWServer_Enet_read( BYTE * buf, size_t size, struct connection_in * in ) { return COM_read( buf, size+in->master.serial.tcp.CRLF_size, in ) ; } static GOOD_OR_BAD OWServer_Enet_write_string( char * buf, struct connection_in *in) { int length = strlen(buf) ; //printf("ENET: Sending %d length string\n", length); if ( length == 0 ) { return gbGOOD ; } return OWServer_Enet_write( BYTE_string(buf), length, in ) ; } static GOOD_OR_BAD OWServer_Enet_write(const BYTE * buf, size_t size, struct connection_in *in) { RETURN_GOOD_IF_GOOD( COM_write_simple( buf, size, in ) ) ; //printf("ENET: Error in sending data\n"); if ( SOC(in)->file_descriptor == FILE_DESCRIPTOR_BAD ) { //printf("ENET: Connection closed\n"); RETURN_BAD_IF_BAD( OWServer_Enet_reopen( in ) ) ; //printf("ENET: Connection reopened\n"); RETURN_GOOD_IF_GOOD( COM_write_simple( buf, size, in ) ) ; //printf("ENET: Error sending data second time\n"); } //printf("ENET: Bad sending experience\n"); return gbBAD ; } #define MAX_ENET_MEMORY_GULP 64 // Send data and return response block -- up to 32 bytes static GOOD_OR_BAD OWServer_Enet_sendback_part(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; char send_data[1+MAX_ENET_MEMORY_GULP*2+3] ; char get_data[MAX_ENET_MEMORY_GULP*2+in->master.serial.tcp.CRLF_size] ; send_data[0] = 'W' ; bytes2string(&send_data[1], data, size) ; send_data[1+2*size] = '\r' ; send_data[1+2*size+1] = '\0' ; if ( BAD( OWServer_Enet_write_string( send_data, in)) ) { LEVEL_DEBUG("Error with sending ENET block") ; return gbBAD ; } if ( BAD(OWServer_Enet_read( BYTE_string(get_data), size*2, in)) ) { LEVEL_DEBUG("Error with reading ENET block") ; return gbBAD ; } string2bytes(get_data, resp, size) ; return gbGOOD ; } static GOOD_OR_BAD OWServer_Enet_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { int left; //printf("ENET sendback %d bytes\n",(int) size) ; for ( left=size ; left>0 ; left -= MAX_ENET_MEMORY_GULP ) { size_t pass_start = size - left ; size_t pass_size = (left>MAX_ENET_MEMORY_GULP) ? MAX_ENET_MEMORY_GULP : left ; RETURN_BAD_IF_BAD( OWServer_Enet_sendback_part( &data[pass_start], &resp[pass_start], pass_size, pn ) ) ; } return gbGOOD; } static void OWServer_Enet_close(struct connection_in *in) { // the statndard COM_free cleans up the connection (void) in ; } owfs-2.8p15/module/owlib/src/c/ow_fs_id.c0000664000175000017500000000367611352033033015166 00000000000000/* $Id: ow_fs_id.c,v 1.3 2010/03/23 03:31:39 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_ID(struct one_wire_query *owq) { ASCII id[12]; struct parsedname *pn = PN(owq); bytes2string(id, &(pn->sn[1]), 6); return OWQ_format_output_offset_and_size(id, 12, owq); } ZERO_OR_ERROR FS_r_ID(struct one_wire_query *owq) { int sn_index, id_index; ASCII id[12]; struct parsedname *pn = PN(owq); for (sn_index = 6, id_index = 0; sn_index > 0; --sn_index, id_index += 2) { num2string(&id[id_index], pn->sn[sn_index]); } return OWQ_format_output_offset_and_size(id, 12, owq); } owfs-2.8p15/module/owlib/src/c/ow_w1_dispatch.c0000644000175000017500000001324711673502013016306 00000000000000/* $Id: ow_w1_dispatch.c,v 1.34 2011/12/19 00:23:39 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is a modestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" static GOOD_OR_BAD W1_write_pipe( FILE_DESCRIPTOR_OR_ERROR file_descriptor, struct netlink_parse * nlp ) ; static void Dispatch_Packet( struct netlink_parse * nlp) ; static void Dispatch_Packet_root( struct netlink_parse * nlp) ; static void Dispatch_Packet_nonroot( struct netlink_parse * nlp) ; // write to an internal pipe (in another thread). Use a timepout in case that thread has terminated. static GOOD_OR_BAD W1_write_pipe( FILE_DESCRIPTOR_OR_ERROR file_descriptor, struct netlink_parse * nlp ) { do { int select_value ; struct timeval tv = { Globals.timeout_w1, 0 } ; fd_set writeset ; FD_ZERO(&writeset) ; FD_SET(file_descriptor,&writeset) ; select_value = select(file_descriptor+1,NULL,&writeset,NULL,&tv) ; if ( select_value == -1 ) { if (errno != EINTR) { ERROR_CONNECT("Netlink dispatch error"); return gbBAD ; } // repeat path for EINTR } else if ( select_value == 0 ) { LEVEL_DEBUG("Netlink dispatch timeout"); return gbBAD; } else { int write_ret = write( file_descriptor, (const void *)nlp->nlm, nlp->nlm->nlmsg_len ) ; if (write_ret < 0 ) { ERROR_DEBUG("Netlink dispatch write error"); } else if ( (size_t) write_ret < nlp->nlm->nlmsg_len ) { LEVEL_DEBUG("Only able to write %d of %d bytes to pipe",write_ret, nlp->nlm->nlmsg_len); return gbBAD ; } return gbGOOD ; } } while (1) ; } // Get the w1 bus id from the nlm sequence number and dispatch to that bus static void Dispatch_Packet( struct netlink_parse * nlp) { int bus = NL_BUS(nlp->nlm->nlmsg_seq) ; // root w1 master message -- add and remove if ( bus == 0 ) { // root w1 master message -- add and remove LEVEL_DEBUG("Netlink message directed to root W1 master"); Dispatch_Packet_root( nlp ) ; } else { // non-root w1 message -- individual bus master messages LEVEL_DEBUG("Netlink message directed to W1 bus master %d",bus); CONNIN_RLOCK ; Dispatch_Packet_nonroot( nlp ) ; CONNIN_RUNLOCK ; } } // Get the w1 bus id from the nlm sequence number and dispatch to that bus static void Dispatch_Packet_root( struct netlink_parse * nlp) { // root w1 master message -- add and remove /* Need to run the add/remove in a separate thread so that netlink messages can still be parsed and CONNIN_RLOCK won't deadlock */ pthread_t thread ; // make a copy for the new thread (which we will have to destroy) // the copy includes the packet // and the actual message appended to the end struct netlink_parse * nlp_copy = owmalloc( sizeof(struct netlink_parse) + NLMSG_SPACE(nlp->nlm->nlmsg_len) ) ; if ( nlp_copy == NULL ) { return ; } memcpy( nlp_copy, nlp, sizeof(struct netlink_parse) ) ; nlp_copy->nlm = (struct nlmsghdr *) nlp_copy->follow ; memcpy( nlp_copy->follow, nlp->nlm, nlp->nlm->nlmsg_len ) ; // Need run through parser to set pointers to new buffer if ( BAD( Netlink_Parse_Buffer(nlp_copy) ) ) { owfree( nlp_copy ) ; return ; } // Now send if ( pthread_create( &thread, DEFAULT_THREAD_ATTR, w1_master_command, (void *) nlp_copy ) == 0 ) { LEVEL_DEBUG("Sending this packet to root bus"); } else { owfree( nlp_copy ) ; LEVEL_DEBUG("Thread creation problem"); } return ; } // Get the w1 bus id from the nlm sequence number and dispatch to that bus static void Dispatch_Packet_nonroot( struct netlink_parse * nlp) { int bus = NL_BUS(nlp->nlm->nlmsg_seq) ; struct connection_in * in ; for ( in = Inbound_Control.head ; in != NO_CONNECTION ; in = in->next ) { //printf("Matching %d/%s/%s/%s/ to bus.%d %d/%s/%s/%s/\n",bus_zero,name,type,domain,now->index,now->busmode,now->master.tcp.name,now->master.tcp.type,now->master.tcp.domain); if ( in->busmode == bus_w1 && in->master.w1.id == bus ) { if ( GOOD( W1_write_pipe(in->master.w1.netlink_pipe[fd_pipe_write], nlp) ) ) { LEVEL_DEBUG("Sending this packet to w1_bus_master%d",bus); } else { LEVEL_DEBUG("Error sending w1_bus_master%d",bus); } return ; } } LEVEL_DEBUG("W1 netlink message for non-existent bus %d",bus); } // Infinite loop waiting for netlink packets, to be sent to internal pipes as appropriate void * W1_Dispatch( void * v ) { (void) v ; DETACH_THREAD; w1_list_masters() ; // ask for master list while ( FILE_DESCRIPTOR_VALID( SOC(Inbound_Control.w1_monitor)->file_descriptor ) ) { struct netlink_parse nlp ; nlp.nlm = NULL ; LEVEL_DEBUG("Dispatch loop"); if ( GOOD ( Netlink_Parse_Get( &nlp ) ) ) { Dispatch_Packet( &nlp ) ; } SAFEFREE( nlp.nlm ) ; } LEVEL_DEBUG("Normal exit."); return VOID_RETURN; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_multicast.c0000644000175000017500000001046211736626772016124 00000000000000/* $Id: ow_multicast.c,v 1.27 2012/04/01 18:18:05 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #ifdef HAVE_ARPA_INET_H #include #endif #if OW_HA7 /* Multicast to discover HA7 servers */ /* Wait 10 seconds for responses */ /* returns number found (>=0) or <0 on error */ /* Taken from Embedded Data Systems' documentation */ /* http://www.talk1wire.com/?q=node/7 */ #pragma pack(push,1) struct HA7_response { char signature[2] ; uint16_t command ; uint16_t port ; uint16_t sslport ; char serial_num[12] ; // MAC char dev_name[64] ; } ; #pragma pack(pop) static int Test_HA7_response( struct HA7_response * ha7_response ) { LEVEL_DEBUG("From ha7_response: signature=%.2s, command=%X, port=%d, ssl=%d, MAC=%.12s, device=%s", ha7_response->signature, ntohs(ha7_response->command), ntohs(ha7_response->port), ntohs(ha7_response->sslport), ha7_response->serial_num, ha7_response->dev_name) ; if (memcmp("HA", ha7_response->signature, 2)) { LEVEL_CONNECT("HA7 response signature error"); return 1; } if ( 0x8001 != ntohs(ha7_response->command) ) { LEVEL_CONNECT("HA7 response command error"); return 1; } return 0 ; } static void Setup_HA7_hint( struct addrinfo * hint ) { memset(hint, 0, sizeof(struct addrinfo)); #ifdef AI_NUMERICSERV hint->ai_flags = AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV; #else hint->ai_flags = AI_CANONNAME | AI_NUMERICHOST; #endif hint->ai_family = AF_INET; // hint->ai_socktype = SOCK_DGRAM | SOCK_CLOEXEC ; // udp hint->ai_socktype = SOCK_DGRAM ; // udp hint->ai_protocol = 0; } static int Get_HA7_response( struct addrinfo *now, char * name ) { struct timeval tv = { 50, 0 }; FILE_DESCRIPTOR_OR_ERROR file_descriptor; struct HA7_response ha7_response ; struct sockaddr_in from ; socklen_t fromlen = sizeof(struct sockaddr_in) ; int on = 1; file_descriptor = socket(now->ai_family, now->ai_socktype, now->ai_protocol) ; if ( FILE_DESCRIPTOR_NOT_VALID(file_descriptor) ) { ERROR_DEBUG("Cannot get socket file descriptor for broadcast."); return 1; } fcntl (file_descriptor, F_SETFD, FD_CLOEXEC); // for safe forking if (setsockopt(file_descriptor, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) == -1) { ERROR_DEBUG("Cannot set socket option for broadcast."); return 1; } if (sendto(file_descriptor, "HA\000\001", 4, 0, now->ai_addr, now->ai_addrlen) != 4) { ERROR_CONNECT("Trouble sending broadcast message"); return 1; } /* now read */ if ( udp_read(file_descriptor, &ha7_response, sizeof(struct HA7_response), &tv, &from, &fromlen) != sizeof(struct HA7_response) ) { LEVEL_CONNECT("HA7 response bad length"); return 1; } if ( Test_HA7_response( &ha7_response ) ) { return 1 ; } UCLIBCLOCK ; snprintf(name,INET_ADDRSTRLEN+20,"%s:%d",inet_ntoa(from.sin_addr),ntohs(ha7_response.port)); UCLIBCUNLOCK ; return 0 ; } GOOD_OR_BAD FS_FindHA7(void) { struct addrinfo *ai; struct addrinfo hint; struct addrinfo *now; int number_found = 0; int getaddr_error ; LEVEL_DEBUG("Attempting udp multicast search for the HA7Net bus master at 224.1.2.3:4567"); Setup_HA7_hint( &hint ) ; if ((getaddr_error = getaddrinfo("224.1.2.3", "4567", &hint, &ai))) { LEVEL_CONNECT("Couldn't set up HA7 broadcast message %s", gai_strerror(getaddr_error)); return gbBAD; } for (now = ai; now; now = now->ai_next) { ASCII name[INET_ADDRSTRLEN+20]; // tcp quad + port struct connection_in *in; if ( Get_HA7_response( now, name ) ) { continue ; } in = NewIn(NO_CONNECTION) ; if (in == NO_CONNECTION) { continue; } SOC(in)->type = ct_tcp ; SOC(in)->devicename = owstrdup(name); in->busmode = bus_ha7net; LEVEL_CONNECT("HA7Net bus master discovered at %s",SOC(in)->devicename); ++number_found ; } freeaddrinfo(ai); return number_found > 0 ? gbGOOD : gbBAD ; } #endif /* OW_HA7 */ owfs-2.8p15/module/owlib/src/c/ow_2760.c0000644000175000017500000016157011740076517014513 00000000000000/* $Id: ow_2760.c,v 1.90 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Changes 7/2004 Extensive improvements based on input from Serg Oskin */ #include #include "owfs_config.h" #include "ow_2760.h" #include "ow_thermocouple.h" /* ------- Prototypes ----------- */ /* DS2406 switch */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_lock); WRITE_FUNCTION(FS_w_lock); READ_FUNCTION(FS_r_volt); READ_FUNCTION(FS_r_temp); READ_FUNCTION(FS_r_current); READ_FUNCTION(FS_r_vis); READ_FUNCTION(FS_r_vis_avg); READ_FUNCTION(FS_r_pio); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_r_vh); WRITE_FUNCTION(FS_w_vh); READ_FUNCTION(FS_r_vis_off); WRITE_FUNCTION(FS_w_vis_off); READ_FUNCTION(FS_r_ah); WRITE_FUNCTION(FS_w_ah); READ_FUNCTION(FS_r_abias); WRITE_FUNCTION(FS_w_abias); READ_FUNCTION(FS_r_templim); WRITE_FUNCTION(FS_w_templim); READ_FUNCTION(FS_r_voltlim); WRITE_FUNCTION(FS_w_voltlim); READ_FUNCTION(FS_r_vbias); WRITE_FUNCTION(FS_w_vbias); READ_FUNCTION(FS_r_timer); WRITE_FUNCTION(FS_w_timer); READ_FUNCTION(FS_r_bit); WRITE_FUNCTION(FS_w_bit); WRITE_FUNCTION(FS_charge); WRITE_FUNCTION(FS_refresh); READ_FUNCTION(FS_WS603_temperature); READ_FUNCTION(FS_WS603_r_data); READ_FUNCTION(FS_WS603_r_param); READ_FUNCTION(FS_WS603_wind_speed); READ_FUNCTION(FS_WS603_wind_direction); READ_FUNCTION(FS_WS603_r_led); READ_FUNCTION(FS_WS603_light); READ_FUNCTION(FS_WS603_volt); READ_FUNCTION(FS_WS603_r_wind_calibration); WRITE_FUNCTION(FS_WS603_w_wind_calibration); READ_FUNCTION(FS_WS603_r_direction_calibration); WRITE_FUNCTION(FS_WS603_w_direction_calibration); READ_FUNCTION(FS_WS603_r_light_threshold); WRITE_FUNCTION(FS_WS603_led_control); WRITE_FUNCTION(FS_WS603_r_led_model); #if OW_THERMOCOUPLE READ_FUNCTION(FS_thermocouple); READ_FUNCTION(FS_rangelow); READ_FUNCTION(FS_rangehigh); /* ------- Structures ----------- */ #define F_thermocouple \ {"typeB" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeB/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_b}, } , \ {"typeB/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_b}, } , \ {"typeB/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_b}, } , \ \ {"typeE" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeE/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_e}, } , \ {"typeE/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_e}, } , \ {"typeE/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_e}, } , \ \ {"typeJ" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeJ/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_j}, } , \ {"typeJ/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_j}, } , \ {"typeJ/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_j}, } , \ \ {"typeK" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeK/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_k}, } , \ {"typeK/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_k}, } , \ {"typeK/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_k}, } , \ \ {"typeN" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeN/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_n}, } , \ {"typeN/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_n}, } , \ {"typeN/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_n}, } , \ \ {"typeR" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeR/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_r}, } , \ {"typeR/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_r}, } , \ {"typeR/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_r}, } , \ \ {"typeS" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeS/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_s}, } , \ {"typeS/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_s}, } , \ {"typeS/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_s}, } , \ \ {"typeT" ,PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir , fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION , VISIBLE, NO_FILETYPE_DATA, } , \ {"typeT/temperature",PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_volatile, FS_thermocouple, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_t}, } , \ {"typeT/range_low" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangelow, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_t}, } , \ {"typeT/range_high" ,PROPERTY_LENGTH_TEMP, NON_AGGREGATE,ft_temperature, fc_static , FS_rangehigh, NO_WRITE_FUNCTION , VISIBLE, {i:e_type_t}, } , #else /* OW_THERMOCOUPLE */ #define F_thermocouple #endif /* OW_THERMOCOUPLE */ #define _1W_DS27XX_PROTECT_REG 0x00 #define _1W_DS27XX_STATUS_REG 0x01 #define _1W_DS27XX_STATUS_REG_INIT 0x31 #define _1W_DS2770_TIMER 0x02 #define _1W_DS2760_SPECIAL_REG 0x08 #define _1W_DS2780_SPECIAL_REG 0x15 #define _1W_DS2780_AVERAGE_CURRENT 0x08 #define _1W_DS2756_AVERAGE_CURRENT 0x1A #define _1W_DS27XX_VOLTAGE 0x0C #define _1W_DS27XX_CURRENT 0x0E #define _1W_DS27XX_ACCUMULATED 0x10 #define _1W_DS2770_CURRENT_OFFSET 0x32 #define _1W_DS2760_CURRENT_OFFSET 0x33 #define _1W_DS2780_CURRENT_OFFSET 0x61 #define _1W_DS2760_TEMPERATURE 0x18 #define _1W_DS2780_TEMPERATURE 0x0A #define _1W_DS2780_PARAM_REG 0x60 struct LockPage { int pages; size_t reg; size_t size; off_t offset[3]; }; #define Pages2720 2 #define Pages2751 2 #define Pages2755 3 #define Pages2760 2 #define Pages2770 3 #define Pages2780 2 #define Size2720 4 #define Size2751 16 #define Size2755 32 #define Size2760 16 #define Size2770 16 #define Size2780 16 static struct LockPage P2720 = { Pages2720, 0x07, Size2720, {0x20, 0x30, 0x00,}, }; static struct LockPage P2751 = { Pages2751, 0x07, Size2751, {0x20, 0x30, 0x00,}, }; static struct LockPage P2755 = { Pages2755, 0x07, Size2755, {0x20, 0x40, 0x60,}, }; static struct LockPage P2760 = { Pages2760, 0x07, Size2760, {0x20, 0x30, 0x00,}, }; static struct LockPage P2770 = { Pages2770, 0x07, Size2770, {0x20, 0x30, 0x40,}, }; static struct LockPage P2780 = { Pages2780, 0x1F, Size2780, {0x20, 0x60, 0x00,}, }; static struct aggregate L2720 = { Pages2720, ag_numbers, ag_separate }; static struct aggregate L2751 = { Pages2751, ag_numbers, ag_separate }; static struct aggregate L2755 = { Pages2755, ag_numbers, ag_separate }; static struct aggregate L2760 = { Pages2760, ag_numbers, ag_separate }; static struct aggregate L2770 = { Pages2770, ag_numbers, ag_separate }; static struct aggregate L2780 = { Pages2780, ag_numbers, ag_separate }; static struct filetype DS2720[] = { F_STANDARD, {"memory", 256, NULL, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NULL, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2720, &L2720, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2720}, }, {"lock", PROPERTY_LENGTH_YESNO, &L2720, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2720}, }, {"cc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 3}, }, {"ce", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 1}, }, {"dc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 2}, }, {"de", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 0}, }, {"doc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 4}, }, {"ot", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 0}, }, {"ov", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 7}, }, {"psf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 7}, }, {"uv", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 6}, }, }; DeviceEntry(31, DS2720, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2740[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_pio, FS_w_pio, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis_B", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, {f:1.5625E-6}, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"smod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 6}, }, }; DeviceEntry(36, DS2740, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2751[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2751, &L2751, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2751}, }, {"amphours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_ah, FS_w_ah, VISIBLE, NO_FILETYPE_DATA, }, {"current", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"currentbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_abias, FS_w_abias, VISIBLE, NO_FILETYPE_DATA, }, {"lock", PROPERTY_LENGTH_YESNO, &L2751, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2751}, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_w_pio, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"sensed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"defaultpmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG_INIT << 8) | 5}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"por", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 0}, }, {"uven", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 3}, }, F_thermocouple }; DeviceEntry(51, DS2751, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2755[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2755, &L2755, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2755}, }, {"lock", PROPERTY_LENGTH_YESNO, &L2755, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2751}, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_w_pio, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"sensed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis_avg", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis_avg, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"alarm_set", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_float, fc_volatile, FS_r_templim, FS_w_templim, VISIBLE, {u:0x85}, }, {"defaultpmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG_INIT << 8) | 5}, }, {"pie1", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 7}, }, {"pie0", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 6}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"rnaop", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 4}, }, {"uven", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 3}, }, {"ios", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 2}, }, {"uben", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 1}, }, {"ovd", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 0}, }, {"por", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 0}, }, F_thermocouple }; DeviceEntryExtended(35, DS2755, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); struct aggregate Aled_control = { 4, ag_numbers, ag_aggregate, }; static struct filetype DS2760[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2760, &L2760, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2760}, }, {"amphours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_ah, FS_w_ah, VISIBLE, NO_FILETYPE_DATA, }, {"current", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"currentbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_abias, FS_w_abias, VISIBLE, NO_FILETYPE_DATA, }, {"lock", PROPERTY_LENGTH_YESNO, &L2760, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2760}, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_w_pio, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"sensed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 6}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"cc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 3}, }, {"ce", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 1}, }, {"coc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 5}, }, {"defaultpmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG_INIT << 8) | 5}, }, {"defaultswen", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG_INIT << 8) | 3}, }, {"dc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 2}, }, {"de", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 0}, }, {"doc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 4}, }, {"mstr", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 5}, }, {"ov", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 7}, }, {"ps", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2760_SPECIAL_REG << 8) | 7}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"swen", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 3}, }, {"uv", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_PROTECT_REG << 8) | 6}, }, F_thermocouple {"WS603", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/calibration", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/calibration/wind_speed", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_r_wind_calibration, FS_WS603_w_wind_calibration, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/calibration/direction", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_r_direction_calibration, FS_WS603_w_direction_calibration, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_WS603_temperature, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/data_string", 5, NON_AGGREGATE, ft_binary, fc_volatile, FS_WS603_r_data, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"WS603/param_string", 5, NON_AGGREGATE, ft_binary, fc_stable, FS_WS603_r_param, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"WS603/wind_speed", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_WS603_wind_speed, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/direction", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_wind_direction, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/LED/status", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_r_led, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/LED/control", PROPERTY_LENGTH_UNSIGNED, &Aled_control, ft_unsigned, fc_stable, NO_READ_FUNCTION, FS_WS603_led_control, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/LED/model", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_r_led_model, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/light", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/light/intensity", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_light, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/light/threshold", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_r_light_threshold, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"WS603/volt", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_WS603_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(30, DS2760, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2770[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2770, &L2770, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2770}, }, {"amphours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_ah, FS_w_ah, VISIBLE, NO_FILETYPE_DATA, }, {"current", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"currentbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_r_abias, FS_w_abias, VISIBLE, NO_FILETYPE_DATA, }, {"lock", PROPERTY_LENGTH_YESNO, &L2770, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2770}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"charge", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_charge, VISIBLE, NO_FILETYPE_DATA, }, {"cini", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 1}, }, {"cstat1", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 7}, }, {"cstat0", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 6}, }, {"ctype", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 0}, }, {"defaultpmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG_INIT << 8) | 5}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"refresh", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_refresh, VISIBLE, NO_FILETYPE_DATA, }, {"timer", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_timer, FS_w_timer, VISIBLE, NO_FILETYPE_DATA, }, F_thermocouple }; DeviceEntry(2E, DS2770, NO_GENERIC_READ, NO_GENERIC_WRITE); /* DS2780 also includees the DS2775 DS2776 DS2784 */ static struct filetype DS2780[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2780, &L2780, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2780}, }, {"lock", PROPERTY_LENGTH_YESNO, &L2780, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2780}, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_w_pio, VISIBLE, {u:(_1W_DS2780_SPECIAL_REG << 8) | 0}, }, {"sensed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2780_SPECIAL_REG << 8) | 0}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis_avg", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis_avg, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"chgtf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 7}, }, {"aef", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 6}, }, {"sef", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"learnf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 4}, }, {"uvf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 2}, }, {"porf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 1}, }, {"nben", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 7}, }, {"uven", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 6}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 5}, }, {"rnaop", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 4}, }, {"dc", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 3}, }, F_thermocouple }; DeviceEntry(32, DS2780, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2781[] = { F_STANDARD, {"memory", 256, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", Size2780, &L2780, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, {v:&P2780}, }, {"lock", PROPERTY_LENGTH_YESNO, &L2780, ft_yesno, fc_stable, FS_r_lock, FS_w_lock, VISIBLE, {v:&P2780}, }, {"PIO", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_w_pio, VISIBLE, {u:(_1W_DS2780_SPECIAL_REG << 8) | 0}, }, {"sensed", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, NO_WRITE_FUNCTION, VISIBLE, {u:(_1W_DS2780_SPECIAL_REG << 8) | 0}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vbias", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_vbias, FS_w_vbias, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis_offset", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis_off, FS_w_vis_off, VISIBLE, NO_FILETYPE_DATA, }, {"vis_avg", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vis_avg, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volt", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_volt, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"volthours", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_vh, FS_w_vh, VISIBLE, NO_FILETYPE_DATA, }, {"aef", PROPERTY_LENGTH_YESNO,NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 4}, }, {"pmod", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit,VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 5}, }, {"porf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 1}, }, {"sef", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 5}, }, {"uven", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS2780_PARAM_REG << 8) | 6}, }, {"uvf", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_bit, FS_w_bit, VISIBLE, {u:(_1W_DS27XX_STATUS_REG << 8) | 2}, }, F_thermocouple }; DeviceEntry(3D, DS2781, NO_GENERIC_READ, NO_GENERIC_WRITE); /* DS2784 - specific */ #define _1W_WRITE_CHALLENGE 0x0C #define _1W_COMPUTE_MAC_WITHOUT 0x36 #define _1W_COMPUTE_MAC_WITH 0x35 #define _1W_COPY_DATA 0x48 #define _1W_CLEAR_SECRET 0x5A #define _1W_COMPUTE_NEXT_SECRET_WITHOUT 0x30 #define _1W_COMPUTE_NEXT_SECRET_WITH 0x33 #define _1W_LOCK_SECRET 0x60 #define _1W_REFRESH 0x63 #define _1W_READ_DATA 0x69 #define _1W_LOCK 0x6A #define _1W_WRITE_DATA 0x6C #define _1W_SET_OVERDRIVE 0x8B #define _1W_CLEAR_OVERDRIVE 0x8D #define _1W_START_CHARGE 0xB5 #define _1W_RECALL_DATA 0xB8 #define _1W_STOP_CHARGE 0xBE #define _1W_RESET 0xC4 #define _WS603_COMMAND_ADDRESS 0x80 #define _WS603_RESPONSE_ADDRESS 0x88 #define _WS603_READ_DATA 0xA1 #define _WS603_READ_PARAMETER 0xA0 #define _WS603_LED_CONTROL 0xA2 #define _WS603_WIND_SPEED_CALIBRATION 0xA3 #define _WS603_WIND_DIRECTION_CALIBRATION 0xA4 #define WS603_ENDBYTE(b) ( ( ( (b) & 0x0F ) *16 ) + 0x0E ) /* ------- Functions ------------ */ /* DS2406 */ static GOOD_OR_BAD OW_r_sram(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_sram(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_mem(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_mem(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_recall_eeprom(const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_copy_eeprom(const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_lock(const struct parsedname *pn); static GOOD_OR_BAD OW_r_int(int *I, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_int(const int *I, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_int8(int *I, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_int8(const int *I, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_cmd(const BYTE cmd, const struct parsedname *pn); static struct LockPage * Lockpage( const struct parsedname * pn ) ; static char WS603_CHECKSUM( BYTE * byt, int length ) ; static GOOD_OR_BAD WS603_Send( BYTE * byt, int length, struct parsedname * pn ) ; static GOOD_OR_BAD WS603_Get( BYTE cmd, BYTE * byt, int length, struct parsedname * pn ) ; static GOOD_OR_BAD WS603_Transaction( BYTE * cmd, int length, BYTE * resp, struct parsedname * pn ) ; static GOOD_OR_BAD WS603_Get_Readings( BYTE * data, struct parsedname * pn ) ; static GOOD_OR_BAD WS603_Get_Parameters( BYTE * data, struct parsedname * pn ) ; /* 2406 memory read */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { /* read is not a "paged" endeavor, the CRC comes after a full read */ OWQ_length(owq) = OWQ_size(owq) ; return GB_to_Z_OR_E(OW_r_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq), PN(owq))) ; } /* 2406 memory write */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { //printf("2406 read size=%d, offset=%d\n",(int)size,(int)offset); return GB_to_Z_OR_E(OW_r_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq) + ((struct LockPage *) OWQ_pn(owq).selected_filetype->data.v)->offset[OWQ_pn(owq).extension], PN(owq))) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_mem ((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq) + ((struct LockPage *) OWQ_pn(owq).selected_filetype->data.v)->offset[OWQ_pn(owq).extension], PN(owq))) ; } /* 2406 memory write */ static ZERO_OR_ERROR FS_r_lock(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD( OW_r_mem(&data, 1, ((struct LockPage *) OWQ_pn(owq).selected_filetype->data.v)->reg, PN(owq)) ) ; OWQ_Y(owq) = UT_getbit(&data, OWQ_pn(owq).extension); return 0; } static ZERO_OR_ERROR FS_w_lock(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_lock(PN(owq))) ; } /* Note, it's EPROM -- write once */ static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { /* write is "byte at a time" -- not paged */ return GB_to_Z_OR_E(OW_w_mem((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_vis(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; _FLOAT f = 0.; RETURN_ERROR_IF_BAD( OW_r_int(&I, _1W_DS27XX_CURRENT, pn) ); switch (pn->sn[0]) { case 0x36: //DS2740 f = 6.25E-6; if (pn->selected_filetype->data.v) { f = pn->selected_filetype->data.f; // for DS2740BU } break; case 0x51: //DS2751 case 0x35: //DS2755 case 0x30: //DS2760 f = 15.625E-6 / 8; // Jan Bertelsen's correction break; case 0x28: //DS2770 f = 1.56E-6; break; case 0x32: //DS2780 case 0x3D: //DS2781 f = 1.5625E-6; break; } OWQ_F(owq) = f * I; return 0; } // Volt-hours static ZERO_OR_ERROR FS_r_vis_avg(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; GOOD_OR_BAD ret = gbBAD; switch (pn->sn[0]) { case 0x32: //DS2780 case 0x3D: //DS2781 ret = OW_r_int(&I, _1W_DS2780_AVERAGE_CURRENT, pn); OWQ_F(owq) = .0000015625 * I; break; case 0x35: //DS2755 ret = OW_r_int(&I, _1W_DS2756_AVERAGE_CURRENT, pn); OWQ_F(owq) = .000001953 * I; break; } return GB_to_Z_OR_E(ret); } // Volt-hours static ZERO_OR_ERROR FS_r_vh(struct one_wire_query *owq) { int I; RETURN_ERROR_IF_BAD( OW_r_int(&I, _1W_DS27XX_ACCUMULATED, PN(owq)) ) ; OWQ_F(owq) = .00000625 * I; return 0; } // Volt-hours static ZERO_OR_ERROR FS_w_vh(struct one_wire_query *owq) { int I = OWQ_F(owq) / .00000625; return GB_to_Z_OR_E(OW_w_int(&I, _1W_DS27XX_ACCUMULATED, PN(owq))); } // Volt-limits static ZERO_OR_ERROR FS_r_voltlim(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; RETURN_ERROR_IF_BAD( OW_r_int(&I, pn->selected_filetype->data.u, pn) ) ; OWQ_F(owq) = .00000625 * I; return 0; } // Volt-limits static ZERO_OR_ERROR FS_w_voltlim(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I = OWQ_F(owq) / .00000625; return GB_to_Z_OR_E(OW_w_int(&I, pn->selected_filetype->data.u, pn) ) ; } // Volt-limits static ZERO_OR_ERROR FS_r_templim(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; RETURN_ERROR_IF_BAD( OW_r_int8(&I, pn->selected_filetype->data.u, pn) ) ; OWQ_F(owq) = I; return 0; } // Volt-limits static ZERO_OR_ERROR FS_w_templim(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I = OWQ_F(owq); if (I < -128) { return -ERANGE; } if (I > 127) { return -ERANGE; } return GB_to_Z_OR_E( OW_w_int8(&I, pn->selected_filetype->data.u, pn) ); } // timer static ZERO_OR_ERROR FS_r_timer(struct one_wire_query *owq) { int I; RETURN_ERROR_IF_BAD( OW_r_int(&I, _1W_DS2770_TIMER, PN(owq)) ) ; OWQ_F(owq) = .015625 * I; return 0; } // timer static ZERO_OR_ERROR FS_w_timer(struct one_wire_query *owq) { int I = OWQ_F(owq) / .015625; return GB_to_Z_OR_E( OW_w_int(&I, _1W_DS2770_TIMER, PN(owq)) ); } // Amp-hours -- using 25mOhm internal resistor static ZERO_OR_ERROR FS_r_ah(struct one_wire_query *owq) { if (FS_r_vh(owq)) { return -EINVAL; } OWQ_F(owq) = OWQ_F(owq) / .025; return 0; } // Amp-hours -- using 25mOhm internal resistor static ZERO_OR_ERROR FS_w_ah(struct one_wire_query *owq) { OWQ_F(owq) = OWQ_F(owq) * .025; return FS_w_vh(owq); } // current offset static ZERO_OR_ERROR FS_r_vis_off(struct one_wire_query *owq) { int I; RETURN_ERROR_IF_BAD( OW_r_int8(&I, 0x7B, PN(owq)) ); OWQ_F(owq) = 1.56E-6 * I; return 0; } // current offset static ZERO_OR_ERROR FS_w_vis_off(struct one_wire_query *owq) { int I = OWQ_F(owq) / 1.56E-6; if (I < -128) { return -ERANGE; } if (I > 127) { return -ERANGE; } return GB_to_Z_OR_E( OW_w_int8(&I, 0x7B, PN(owq)) ); } // Current bias -- using 25mOhm internal resistor static ZERO_OR_ERROR FS_r_abias(struct one_wire_query *owq) { _FLOAT vbias = 0. ; ZERO_OR_ERROR z_or_e = FS_r_sibling_F( &vbias, "vbias", owq ) ; OWQ_F(owq) = vbias / .025; return z_or_e ; } // Current bias -- using 25mOhm internal resistor static ZERO_OR_ERROR FS_w_abias(struct one_wire_query *owq) { return FS_w_sibling_F( OWQ_F(owq) * .025, "vbias", owq ) ; } // Read current using internal 25mOhm resistor and Vis static ZERO_OR_ERROR FS_r_current(struct one_wire_query *owq) { _FLOAT vis = 0.; ZERO_OR_ERROR z_or_e = FS_r_sibling_F( &vis, "vis", owq ) ; OWQ_F(owq) = vis / .025; return z_or_e ; } static ZERO_OR_ERROR FS_r_vbias(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; switch (pn->sn[0]) { case 0x51: //DS2751 case 0x30: //DS2760 RETURN_ERROR_IF_BAD( OW_r_int8(&I, _1W_DS2760_CURRENT_OFFSET, pn) ) ; OWQ_F(owq) = 15.625E-6 * I; break; case 0x35: //DS2755 RETURN_ERROR_IF_BAD( OW_r_int8(&I, _1W_DS2760_CURRENT_OFFSET, pn) ) ; OWQ_F(owq) = 1.95E-6 * I; break; case 0x28: //DS2770 // really a 2byte value! RETURN_ERROR_IF_BAD( OW_r_int(&I, _1W_DS2770_CURRENT_OFFSET, pn) ) ; OWQ_F(owq) = 1.5625E-6 * I; break; case 0x32: //DS2780 case 0x3D: //DS2780 RETURN_ERROR_IF_BAD( OW_r_int8(&I, _1W_DS2780_CURRENT_OFFSET, pn) ) ; OWQ_F(owq) = 1.5625E-6 * I; break; } return 0; } static ZERO_OR_ERROR FS_w_vbias(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; GOOD_OR_BAD ret = 0; // assign unnecessarily to avoid compiler warning switch (pn->sn[0]) { case 0x51: //DS2751 case 0x30: //DS2760 I = OWQ_F(owq) / 15.625E-6; if (I < -128) { return -ERANGE; } if (I > 127) { return -ERANGE; } ret = OW_w_int8(&I, _1W_DS2760_CURRENT_OFFSET, pn); break; case 0x35: //DS2755 I = OWQ_F(owq) / 1.95E-6; if (I < -128) { return -ERANGE; } if (I > 127) { return -ERANGE; } ret = OW_w_int8(&I, _1W_DS2760_CURRENT_OFFSET, pn); break; case 0x28: //DS2770 I = OWQ_F(owq) / 1.5625E-6; if (I < -32768) { return -ERANGE; } if (I > 32767) { return -ERANGE; } // really 2 bytes ret = OW_w_int(&I, _1W_DS2770_CURRENT_OFFSET, pn); break; case 0x32: //DS2780 I = OWQ_F(owq) / 1.5625E-6; if (I < -128) { return -ERANGE; } if (I > 127) { return -ERANGE; } ret = OW_w_int8(&I, _1W_DS2780_CURRENT_OFFSET, pn); break; } return GB_to_Z_OR_E( ret ); } static ZERO_OR_ERROR FS_r_volt(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; RETURN_ERROR_IF_BAD( OW_r_int(&I, _1W_DS27XX_VOLTAGE, pn) ) ; switch (pn->sn[0]) { case 0x3D: //DS2781 OWQ_F(owq) = (I / 32) * .00976; break; default: OWQ_F(owq) = (I / 32) * .00488; break; } return 0; } static ZERO_OR_ERROR FS_r_temp(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int I; size_t off; switch (pn->sn[0]) { case 0x32: //DS2780 case 0x3D: //DS2781 off = _1W_DS2780_TEMPERATURE; break; default: off = _1W_DS2760_TEMPERATURE; } RETURN_ERROR_IF_BAD( OW_r_int(&I, off, pn) ) ; OWQ_F(owq) = (I / 32) * .125; return 0; } static ZERO_OR_ERROR FS_r_bit(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int bit = BYTE_MASK(pn->selected_filetype->data.u); size_t location = pn->selected_filetype->data.u >> 8; BYTE c[1]; RETURN_ERROR_IF_BAD( OW_r_mem(c, 1, location, pn) ) ; OWQ_Y(owq) = UT_getbit(c, bit); return 0; } static ZERO_OR_ERROR FS_w_bit(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int bit = BYTE_MASK(pn->selected_filetype->data.u); size_t location = pn->selected_filetype->data.u >> 8; BYTE c[1]; RETURN_ERROR_IF_BAD( OW_r_mem(c, 1, location, pn) ) ; UT_setbit(c, bit, OWQ_Y(owq) != 0); return GB_to_Z_OR_E( OW_w_mem(c, 1, location, pn) ); } /* switch PIO sensed*/ static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { if (FS_r_bit(owq)) { return -EINVAL; } OWQ_Y(owq) = !OWQ_Y(owq); return 0; } static ZERO_OR_ERROR FS_charge(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_cmd(OWQ_Y(owq) ? _1W_START_CHARGE : _1W_STOP_CHARGE, PN(owq))) ; } static ZERO_OR_ERROR FS_refresh(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_cmd(_1W_REFRESH, PN(owq))) ; } /* write PIO -- bit 6 */ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { OWQ_Y(owq) = !OWQ_Y(owq); return FS_w_bit(owq); } static ZERO_OR_ERROR FS_WS603_temperature(struct one_wire_query *owq) { return FS_r_sibling_F( &OWQ_F(owq), "temperature", owq ) ; } static ZERO_OR_ERROR FS_WS603_r_data( struct one_wire_query *owq) { BYTE data[5] ; RETURN_ERROR_IF_BAD( WS603_Get_Readings( data, PN(owq) ) ) ; return OWQ_format_output_offset_and_size( (char *) data, 5, owq); } static ZERO_OR_ERROR FS_WS603_r_param( struct one_wire_query *owq) { BYTE data[5] ; RETURN_ERROR_IF_BAD( WS603_Get_Parameters( data, PN(owq) ) ) ; return OWQ_format_output_offset_and_size( (char *) data, 5, owq); } static ZERO_OR_ERROR FS_WS603_wind_speed( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; UINT wind_cal ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/data_string", owq ) ) { return -EINVAL ; } if ( FS_r_sibling_U( &wind_cal, "WS603/calibration/wind_speed", owq ) ) { wind_cal = 100 ; } else if ( wind_cal == 0 || wind_cal >199 ) { wind_cal = 100 ; } OWQ_F(owq) = data[0]*2.453*1.069*1000*wind_cal/(3600.*100.) ; return 0 ; } static ZERO_OR_ERROR FS_WS603_wind_direction( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/data_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[1] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_r_led( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/data_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[2] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_light( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/data_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[3] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_volt( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/data_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[4] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_r_led_model( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/param_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[0] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_r_wind_calibration( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/param_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[1] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_w_wind_calibration( struct one_wire_query *owq) { BYTE data[4] = { _WS603_WIND_SPEED_CALIBRATION, OWQ_U(owq) & 0xFF, 0x00, 0x00, } ; return GB_to_Z_OR_E( WS603_Send( data, 4, PN(owq) ) ) ; } static ZERO_OR_ERROR FS_WS603_r_direction_calibration( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/param_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[2] ; return 0 ; } static ZERO_OR_ERROR FS_WS603_w_direction_calibration( struct one_wire_query *owq) { BYTE data[4] = { _WS603_WIND_DIRECTION_CALIBRATION, OWQ_U(owq) & 0xFF, 0x00, 0x00, } ; return GB_to_Z_OR_E( WS603_Send( data, 4, PN(owq) ) ) ; } static ZERO_OR_ERROR FS_WS603_led_control( struct one_wire_query *owq) { BYTE data[7] = { _WS603_LED_CONTROL, OWQ_array_U(owq, 0) & 0xFF, OWQ_array_U(owq, 1) & 0xFF, OWQ_array_U(owq, 2) & 0xFF, OWQ_array_U(owq, 3) & 0xFF, 0x00, 0x00, } ; return GB_to_Z_OR_E( WS603_Send( data, 7, PN(owq) ) ) ; } static ZERO_OR_ERROR FS_WS603_r_light_threshold( struct one_wire_query *owq) { size_t length = 5 ; BYTE data[length] ; if ( FS_r_sibling_binary( (char *) data, &length, "WS603/param_string", owq ) ) { return -EINVAL ; } OWQ_U(owq) = data[3] ; return 0 ; } static struct LockPage * Lockpage( const struct parsedname * pn ) { switch( pn->sn[0]) { case 0x31: //DS2720 return &P2720 ; case 0x36: //DS2740 return NULL ; case 0x51: //DS2751 return &P2751 ; case 0x35: //DS2755 return &P2755 ; case 0x30: //DS2760 return &P2760 ; case 0x28: //DS2770 return &P2770 ; case 0x32: //DS2780 case 0x3D: //DS2781 return &P2780 ; default: return NULL ; } } // This routine tests to see if the memory range is eeprom and calls recall_eeprom if it is // otherwise a good return static GOOD_OR_BAD OW_recall_eeprom( const size_t size, const off_t offset, const struct parsedname *pn) { BYTE p[] = { _1W_RECALL_DATA, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_END, }; int eeprom_range ; struct LockPage * lp = Lockpage(pn) ; if ( Lockpage == NULL ) { LEVEL_DEBUG("No eeprom information for this device.") ; return gbGOOD ; } for ( eeprom_range = 0 ; eeprom_range < lp->pages ; ++eeprom_range ) { off_t range_offset = lp->offset[eeprom_range] ; if ( (off_t)(offset+size) <= range_offset ) { // before this range continue ; } if ( offset >= (off_t)(range_offset + lp->size) ) { // after this range continue ; } p[1] = BYTE_MASK(range_offset) ; return BUS_transaction(t,pn) ; } return gbGOOD ; } /* just read the sram -- eeprom may need to be recalled if you want it */ static GOOD_OR_BAD OW_r_sram(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE p[] = { _1W_READ_DATA, BYTE_MASK(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_READ(data, size), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_r_mem(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { RETURN_BAD_IF_BAD( OW_recall_eeprom(size, offset, pn) ) ; return OW_r_sram(data, size, offset, pn) ; } /* Special processing for eeprom -- page is the address of a 16 byte page (e.g. 0x20) */ static GOOD_OR_BAD OW_copy_eeprom(const size_t size, const off_t offset, const struct parsedname *pn) { BYTE p[] = { _1W_COPY_DATA, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_END, }; int eeprom_range ; struct LockPage * lp = Lockpage(pn) ; if ( Lockpage == NULL ) { LEVEL_DEBUG("No eeprom information for this device.") ; return gbGOOD ; } for ( eeprom_range = 0 ; eeprom_range < lp->pages ; ++eeprom_range ) { off_t range_offset = lp->offset[eeprom_range] ; if ( (off_t) (offset+size) <= range_offset ) { // before this range continue ; } if ( offset >= (off_t)(range_offset + lp->size) ) { // after this range continue ; } p[1] = BYTE_MASK(range_offset) ; return BUS_transaction(t,pn) ; } return gbGOOD ; } static GOOD_OR_BAD OW_w_sram(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE p[] = { _1W_WRITE_DATA, BYTE_MASK(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_WRITE(data, size), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_cmd(const BYTE cmd, const struct parsedname *pn) { struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(&cmd), TRXN_END, }; return BUS_transaction(t, pn); } static GOOD_OR_BAD OW_w_mem(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { RETURN_BAD_IF_BAD( OW_recall_eeprom(size, offset, pn) ) ; RETURN_BAD_IF_BAD( OW_w_sram(data, size, offset, pn) ) ; return OW_copy_eeprom(size, offset, pn) ; } static GOOD_OR_BAD OW_r_int(int *I, off_t offset, const struct parsedname *pn) { BYTE i[2]; RETURN_BAD_IF_BAD( OW_r_sram(i, 2, offset, pn) ); // Data in the DS27xx is stored MSB/LSB -- different from DS2438 for example // Thanks to Jan Bertelsen for finding this! I[0] = (((int) ((int8_t) i[0]) << 8) + ((uint8_t) i[1])); return gbGOOD; } static GOOD_OR_BAD OW_w_int(const int *I, off_t offset, const struct parsedname *pn) { BYTE i[2] = { BYTE_MASK(I[0] >> 8), BYTE_MASK(I[0]), }; return OW_w_sram(i, 2, offset, pn); } static GOOD_OR_BAD OW_r_int8(int *I, off_t offset, const struct parsedname *pn) { BYTE i[1]; RETURN_BAD_IF_BAD( OW_r_sram(i, 1, offset, pn) ); //I[0] = ((int)((int8_t)i[0]) ) ; I[0] = UT_int8(i); return gbGOOD; } static GOOD_OR_BAD OW_w_int8(const int *I, off_t offset, const struct parsedname *pn) { BYTE i[1] = { BYTE_MASK(I[0]), }; return OW_w_sram(i, 1, offset, pn); } static GOOD_OR_BAD OW_lock(const struct parsedname *pn) { BYTE lock[] = { _1W_WRITE_DATA, 0x07, 0x40, _1W_LOCK, 0x00 }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE(lock, 5), TRXN_END, }; UT_setbit(&lock[2], pn->extension, 1); lock[4] = ((struct LockPage *) pn->selected_filetype->data.v)->offset[pn->extension]; return BUS_transaction(t, pn); } #if OW_THERMOCOUPLE static ZERO_OR_ERROR FS_rangelow(struct one_wire_query *owq) { OWQ_F(owq) = Thermocouple_range_low(OWQ_pn(owq).selected_filetype->data.i); return 0; } static ZERO_OR_ERROR FS_rangehigh(struct one_wire_query *owq) { OWQ_F(owq) = Thermocouple_range_high(OWQ_pn(owq).selected_filetype->data.i); return 0; } static ZERO_OR_ERROR FS_thermocouple(struct one_wire_query *owq) { _FLOAT T_coldjunction, vis, mV; /* Get measured voltage */ if ( FS_r_sibling_F( &vis, "vis", owq ) != 0 ) { return -EINVAL ; } mV = vis * 1000; /* convert Volts to mVolts */ /* Get cold junction temperature */ if ( FS_r_sibling_F( &T_coldjunction, "temperature", owq ) != 0 ) { return -EINVAL ; } OWQ_F(owq) = ThermocoupleTemperature(mV, T_coldjunction, OWQ_pn(owq).selected_filetype->data.i); return 0; } #endif /* OW_THERMOCOUPLE */ // Based on Les Arbes notes http://www.lesarbresdesign.info/automation/ws603-weather-instrument static GOOD_OR_BAD WS603_Send( BYTE * byt, int length, struct parsedname * pn ) { int repeat ; BYTE resp[length] ; // Finish setting up string byt[length-2] = WS603_CHECKSUM( byt, length-2 ) ; byt[length-1] = WS603_ENDBYTE( byt[0] ) ; // Send the command and check that it was received for ( repeat = 0 ; repeat < 20; ++repeat ) { if ( GOOD(OW_w_sram( byt, length, _WS603_COMMAND_ADDRESS, pn ) ) && ( GOOD( OW_r_sram( resp, length, _WS603_COMMAND_ADDRESS, pn ) ) ) ) { if ( memcmp( byt, resp, length ) == 0 ) { return gbGOOD ; } } UT_delay(20) ; } LEVEL_DEBUG("Cannot send command to WS603") ; return gbBAD ; } // Based on Les Arbes notes http://www.lesarbresdesign.info/automation/ws603-weather-instrument static GOOD_OR_BAD WS603_Get( BYTE cmd, BYTE * byt, int length, struct parsedname * pn ) { int repeat ; // Send the command and check that it was received for ( repeat = 0 ; repeat < 21; ++repeat ) { UT_delay(20) ; if ( GOOD( OW_r_sram( (BYTE *)byt, length, _WS603_RESPONSE_ADDRESS, pn ) ) ) { if ( ( byt[0] == cmd ) && ( byt[length-1] == WS603_CHECKSUM( byt, length-1 ) ) ) { return gbGOOD ; } } } LEVEL_DEBUG("Cannot read response to WS603") ; return gbBAD ; } static GOOD_OR_BAD WS603_Transaction( BYTE * cmd, int length, BYTE * resp, struct parsedname * pn ) { RETURN_BAD_IF_BAD( WS603_Send( cmd, length, pn ) ) ; return WS603_Get( cmd[0], resp, 7, pn ) ; } static char WS603_CHECKSUM( BYTE * byt, int length ) { int l ; BYTE sum = 0 ; for ( l=0 ; l < length ; ++l ) { sum += byt[l] ; } return sum & 0xFF ; } // return 5 bytes of data static GOOD_OR_BAD WS603_Get_Readings( BYTE * data, struct parsedname * pn ) { BYTE resp[7] ; BYTE cmd[3] = { _WS603_READ_DATA, 0x00, 0x00, } ; RETURN_BAD_IF_BAD( WS603_Transaction( cmd, 3, resp, pn ) ) ; memcpy( data, &resp[1], 5 ) ; return gbGOOD ; } // return 5 bytes of data static GOOD_OR_BAD WS603_Get_Parameters( BYTE * data, struct parsedname * pn ) { BYTE resp[7] ; BYTE cmd[3] = { _WS603_READ_PARAMETER, 0x00, 0x00, } ; RETURN_BAD_IF_BAD( WS603_Transaction( cmd, 3, resp, pn ) ) ; memcpy( data, &resp[1], 5 ) ; return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_memory.c0000664000175000017500000001073111367606004015412 00000000000000/* $Id: ow_memory.c,v 1.20 2010/05/03 17:46:44 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_connection.h" #define _1W_READ_F0 0xF0 #define _1W_READ_A5 0xA5 #define _1W_READ_AA 0xAA static void Set_OWQ_length(struct one_wire_query *owq); static GOOD_OR_BAD OW_r_crc16(BYTE code, struct one_wire_query *owq, size_t page, size_t pagesize); static void Set_OWQ_length(struct one_wire_query *owq) { switch (OWQ_pn(owq).selected_filetype->format) { case ft_binary: case ft_ascii: case ft_vascii: case ft_alias: OWQ_length(owq) = OWQ_size(owq); break; default: break; } } /* No CRC -- 0xF0 code */ GOOD_OR_BAD COMMON_read_memory_F0(struct one_wire_query *owq, size_t page, size_t pagesize) { off_t offset = OWQ_offset(owq) + page * pagesize; BYTE p[3] = { _1W_READ_F0, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ((BYTE *) OWQ_buffer(owq), OWQ_size(owq)), TRXN_END, }; Set_OWQ_length(owq); return BUS_transaction(t, PN(owq)); } /* read up to end of page to CRC16 -- 0xA5 code */ static GOOD_OR_BAD OW_r_crc16(BYTE code, struct one_wire_query *owq, size_t page, size_t pagesize) { off_t offset = OWQ_offset(owq) + page * pagesize; size_t size = OWQ_size(owq); BYTE p[3 + pagesize + 2]; int rest = pagesize - (offset % pagesize); struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, rest), TRXN_END, }; p[0] = code; p[1] = BYTE_MASK(offset); p[2] = BYTE_MASK(offset >> 8); RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq))) ; memcpy(OWQ_buffer(owq), &p[3], size); Set_OWQ_length(owq); return gbGOOD; } /* read up to end of page to CRC16 -- 0xA5 code */ GOOD_OR_BAD COMMON_read_memory_crc16_A5(struct one_wire_query *owq, size_t page, size_t pagesize) { return OW_r_crc16(_1W_READ_A5, owq, page, pagesize)?-EINVAL:0; } /* read up to end of page to CRC16 -- 0xA5 code */ GOOD_OR_BAD COMMON_read_memory_crc16_AA(struct one_wire_query *owq, size_t page, size_t pagesize) { return OW_r_crc16(_1W_READ_AA, owq, page, pagesize)?-EINVAL:0; } /* read up to end of page to CRC16 -- 0xA5 code */ /* Extra 8 bytes, (for counter) too -- discarded */ GOOD_OR_BAD COMMON_read_memory_toss_counter(struct one_wire_query *owq, size_t page, size_t pagesize) { off_t offset = OWQ_offset(owq) + page * pagesize; BYTE p[3 + pagesize + 8 + 2]; int rest = pagesize - (offset % pagesize); struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, rest + 8), TRXN_END, }; p[0] = _1W_READ_A5; p[1] = BYTE_MASK(offset); p[2] = BYTE_MASK(offset >> 8); RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq))) ; memcpy(OWQ_buffer(owq), &p[3], OWQ_size(owq)); Set_OWQ_length(owq); return gbGOOD; } #define _1W_Throw_Away_Bytes 1 /* 0xA5 code */ /* Extra 8 bytes, too */ GOOD_OR_BAD COMMON_read_memory_plus_counter(BYTE * extra, size_t page, size_t pagesize, struct parsedname *pn) { off_t offset = (page + 1) * pagesize - _1W_Throw_Away_Bytes; // last byte of page BYTE p[3 + _1W_Throw_Away_Bytes + 8 + 2] = { _1W_READ_A5, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, _1W_Throw_Away_Bytes + 8), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; if (extra) { memcpy(extra, &p[3 + _1W_Throw_Away_Bytes], 8); } LEVEL_DEBUG("Counter Data: " SNformat, SNvar(extra)); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_return_code.c0000644000175000017500000002211511667513706016421 00000000000000/* $Id: ow_return_code.c,v 1.10 2011/12/06 22:31:34 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" char * return_code_strings[] = { "Good result", // 0 "Startup - command line parameters invalid", "legacy - No such entity", "Startup - a device could not be opened", "legacy - Interrupted", "legacy - IO error", // 5 "Startup - network could not be opened", "Startup - Avahi library could not be loaded", "Startup - Bonjour library could not be loaded", "legacy - Bad filesystem", "Startup - zeroconf communication problem", // 10 "legacy - Temporary interruption", "legacy - memory exhausted", "legacy - Access error", "legacy - Communication fault", "Startup - memory could not be allocated", // 15 "legacy - Busy", "Program - not initialized", "Program - not yet ready", "legacy - No such device", "legacy - Not a directory", // 20 "legacy - Is a directory", "legacy - Invalid transaction", "Program - closing", "Program - closed", "Program - cannot close", // 25 "Path - input path too long", "Path - bad path syntax", "Device - Device name bad CRC8", "Device - Unrecognized device name or alias", "legacy - Read-only file system", // 30 "Device - alias name too long", "Device - unrecognized device property", "Device - device property not an array", "legacy - Out of range", "Device - device property should be an array", // 35 "legacy - Name too long", "Device - device not a bit field", "Device - array index out of range", "Device - device property not a subpath", "legacy - Loop discovered", // 40 "Device - device not found", "legacy - No message", "Device - other device error", "Bus - bus short", "Bus - no such bus", // 45 "Bus - bus not appropriate", "Bus - bus not responding", "Bus - bus being reset", "Bus - bus closed", "Bus - bus could not be opened", // 50 "Bus - communication error on bus", "Bus - communication timeout", "Bus - telnet error", "Bus - tcp error", "Bus - bus is local", // 55 "Bus - bus is remote", "Read - data too large", "Read - data communication error", "Read - not a property", "Read - not a readable property", // 60 "Write - data too large", "Write - data too small", "Write - data wrong format", "Write - not a property", "Write - not a writable property", // 65 "Write - read-only mode", "Write - data communication error", "Directory - output path too long", "Directory - not a directory", // 69 "Presence - not a device", // 70 "Unknown query type", "Owserver protocol - socket problem", "Owserver protocol - timeout", "legacy - Bad message", "Owserver protocol - version mismatch", // 75 "Owserver protocol - packet size error", "Path - extra text in path", "Internal - unexpected null pointer", "Internal - unable to allocate memory", "Unassigned error 80", // 80 "Unassigned error 81", "Unassigned error 82", "Unassigned error 83", "Unassigned error 84", "Unassigned error 85", // 85 "Unassigned error 86", "Unassigned error 87", "Unassigned error 88", "Unassigned error 89", "legacy - Message size problem", // 90 "Unassigned error 91", "Unassigned error 92", "Unassigned error 93", "Unassigned error 94", "legacy - Not supported", // 95 "Unassigned error 96", "Unassigned error 97", "legacy - Address in use", "legacy - Address not available", "Unassigned error 100", // 100 "Unassigned error 101", "Unassigned error 102", "legacy - Connection aborted", "Unassigned error 104", "legacy - No buffers", // 105 "Unassigned error 106", "Unassigned error 107", "Unassigned error 108", "Unassigned error 109", "Unassigned error 110", // 110 "Unassigned error 111", "Unassigned error 112", "Unassigned error 113", "Unassigned error 114", "Unassigned error 115", // 115 "Unassigned error 116", "Unassigned error 117", "Unassigned error 118", "Unassigned error 119", "Unassigned error 120", // 120 "Unassigned error 121", "Unassigned error 122", "Unassigned error 123", "Unassigned error 124", "Unassigned error 125", // 125 "Unassigned error 126", "Unassigned error 127", "Unassigned error 128", "Unassigned error 129", "Unassigned error 130", // 130 "Unassigned error 131", "Unassigned error 132", "Unassigned error 133", "Unassigned error 134", "Unassigned error 135", // 135 "Unassigned error 136", "Unassigned error 137", "Unassigned error 138", "Unassigned error 139", "Unassigned error 140", // 140 "Unassigned error 141", "Unassigned error 142", "Unassigned error 143", "Unassigned error 144", "Unassigned error 145", // 145 "Unassigned error 146", "Unassigned error 147", "Unassigned error 148", "Unassigned error 149", "Unassigned error 150", // 150 "Unassigned error 151", "Unassigned error 152", "Unassigned error 153", "Unassigned error 154", "Unassigned error 155", // 155 "Unassigned error 156", "Unassigned error 157", "Unassigned error 158", "Unassigned error 159", "Unassigned error 160", // 160 "Unassigned error 161", "Unassigned error 162", "Unassigned error 163", "Unassigned error 164", "Unassigned error 165", // 165 "Unassigned error 166", "Unassigned error 167", "Unassigned error 168", "Unassigned error 169", "Unassigned error 170", // 170 "Unassigned error 171", "Unassigned error 172", "Unassigned error 173", "Unassigned error 174", "Unassigned error 175", // 175 "Unassigned error 176", "Unassigned error 177", "Unassigned error 178", "Unassigned error 179", "Unassigned error 180", // 180 "Unassigned error 181", "Unassigned error 182", "Unassigned error 183", "Unassigned error 184", "Unassigned error 185", // 185 "Unassigned error 186", "Unassigned error 187", "Unassigned error 188", "Unassigned error 189", "Unassigned error 190", // 190 "Unassigned error 191", "Unassigned error 192", "Unassigned error 193", "Unassigned error 194", "Unassigned error 195", // 195 "Unassigned error 196", "Unassigned error 197", "Unassigned error 198", "Unassigned error 199", "Unassigned error 200", // 200 "Unassigned error 201", "Unassigned error 202", "Unassigned error 203", "Unassigned error 204", "Unassigned error 205", // 205 "Unassigned error 206", "Unassigned error 207", "Unassigned error 208", "Unassigned error 209", "Error number out of range", // 210 return_code_out_of_bounds // Note: If you add more return_codes, make sure you adjust // #define return_code_out_of_bounds 210 // it's defined in ow_return_code.h } ; int return_code_calls[N_RETURN_CODES] ; void Return_code_setup(void) { int i ; for ( i=0 ; ireturn_code != 0 ) { // Already set? #if OW_DEBUG if (Globals.error_level>=e_err_debug) { err_msg( e_err_type_level, e_err_debug, d_file, d_line, d_func, "%s: Resetting error from %d <%s> to %d",SAFESTRING(pn->path),pn->return_code,return_code_strings[pn->return_code],rc); } #endif } if ( rc > return_code_out_of_bounds || rc < 0 ) { // Out of bounds? #if OW_DEBUG if (Globals.error_level>=e_err_debug) { err_msg( e_err_type_level, e_err_debug, d_file, d_line, d_func, "%s: Reset out of bounds error from %d to %d <%s>",SAFESTRING(pn->path),rc,return_code_out_of_bounds,return_code_strings[return_code_out_of_bounds]); } #endif pn->return_code = return_code_out_of_bounds ; ++ return_code_calls[return_code_out_of_bounds] ; } else { // Error and success pn->return_code = rc ; ++ return_code_calls[rc] ; if ( rc != 0 ) { // Error found -- return_code_calls[0] ; #if OW_DEBUG if (Globals.error_level>=e_err_debug) { err_msg( e_err_type_level, e_err_debug, d_file, d_line, d_func, "%s: Set error to %d <%s>",SAFESTRING(pn->path),rc,return_code_strings[rc]); } #endif } } } void return_code_set_scalar( int raw_rc, int * pi, const char * d_file, int d_line, const char * d_func ) { int rc = raw_rc ; if ( rc < 0 ) { // make positive rc = -rc ; } if ( rc > return_code_out_of_bounds || rc < 0 ) { // Out of bounds? //printf("Return code out of bounds\n"); #if OW_DEBUG if (Globals.error_level>=e_err_debug) { err_msg( e_err_type_level, e_err_debug, d_file, d_line, d_func, "Reset out of bounds error from %d to %d <%s>",rc,return_code_out_of_bounds,return_code_strings[return_code_out_of_bounds]); } #endif *pi = return_code_out_of_bounds ; ++ return_code_calls[return_code_out_of_bounds] ; } else { // Error and success //printf("Return code in bounds\n"); *pi = rc ; ++ return_code_calls[rc] ; if ( rc != 0 ) { //printf("Return code still non-zero\n"); // Error found -- return_code_calls[0] ; #if OW_DEBUG if (Globals.error_level>=e_err_debug) { err_msg( e_err_type_level, e_err_debug, d_file, d_line, d_func, "Set error to %d <%s>",rc,return_code_strings[rc]); } #endif } } //printf("Return code done\n"); } owfs-2.8p15/module/owlib/src/c/ow_exit.c0000664000175000017500000000341711562366031015056 00000000000000/* $Id: ow_exit.c,v 1.1 2011/05/11 01:53:29 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: paul.alfille@gmail.com Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" void ow_exit(int exit_code) { LEVEL_DEBUG("Exit code = %d", exit_code); if (IS_MAINTHREAD) { LibClose(); } #ifdef __UCLIBC__ /* Process never die on WRT54G router with uClibc if exit() is used */ _exit(exit_code); #else exit(exit_code); #endif } void exit_handler(int signo, siginfo_t * info, void *context) { (void) context; #if OW_MT if (info) { LEVEL_DEBUG ("Signal=%d, errno %d, code %d, pid=%ld, Threads: this=%lu main=%lu", signo, info->si_errno, info->si_code, (long int) info->si_pid, pthread_self(), main_threadid); } else { LEVEL_DEBUG("Signal=%d, Threads: this=%lu, main=%lu", signo, pthread_self(), main_threadid); } if (StateInfo.shutting_down) { LEVEL_DEBUG("exit_handler: shutdown already in progress. signo=%d, self=%lu, main=%lu", signo, pthread_self(), main_threadid); } else { StateInfo.shutting_down = 1; if (info != NULL) { if (SI_FROMUSER(info)) { LEVEL_DEBUG("Kill signal from user"); } if (SI_FROMKERNEL(info)) { LEVEL_DEBUG("Kill signal from system"); } } if (!IS_MAINTHREAD) { LEVEL_DEBUG("Kill from main thread: %lu this=%lu Signal=%d", main_threadid, pthread_self(), signo); pthread_kill(main_threadid, signo); } else { LEVEL_DEBUG("Ignore kill from this thread. main=%lu this=%lu Signal=%d", main_threadid, pthread_self(), signo); } } #else (void) signo; (void) info; StateInfo.shutting_down = 1; #endif return; } owfs-2.8p15/module/owlib/src/c/ow_stateinfo.c0000664000175000017500000000077711377034702016110 00000000000000/* $Id: ow_stateinfo.c,v 1.6 2010/05/25 20:57:38 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" struct stateinfo StateInfo = { .owlib_state = lib_state_pre, .start_time = 0, .dir_time = 0, .shutting_down = 0, }; owfs-2.8p15/module/owlib/src/c/ow_alloc.c0000664000175000017500000000430411421224341015162 00000000000000/* $Id: ow_alloc.c,v 1.3 2010/07/20 04:41:05 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include #include "owfs_config.h" #include "ow.h" void *OWcalloc(const char * file, int line, const char * func, size_t nmemb, size_t size) { void * v = calloc(nmemb,size); printf("%p alloc %s:%s[%d] CALLOC size=%d nmemb=%d\n",v,file,func,line,(int)size,(int)nmemb); return v; } void *OWmalloc(const char * file, int line, const char * func, size_t size) { void * v = malloc(size); printf("%p alloc %s:%s[%d] MALLOC size=%d\n",v,file,func,line,(int)size); return v; } void OWfree(const char * file, int line, const char * func, void *ptr) { printf("%p free %s:%s[%d] FREE\n",ptr,file,func,line); free(ptr); } void OWtreefree(void *ptr) { OWfree("BinaryTree", 0, "tdestroy", ptr) ; } void *OWrealloc(const char * file, int line, const char * func, void *ptr, size_t size) { void * v = realloc(ptr,size); printf("%p free %s:%s[%d] REALLOC\n",ptr,file,func,line); printf("%p alloc %s:%s[%d] REALLOC size=%d\n",v,file,func,line,(int)size); return v; } char *OWstrdup(const char * file, int line, const char * func, const char *s) { char * c = strdup(s); printf("%p alloc %s:%s[%d] STRDUP s=%s\n",c,file,func,line,s); return c; } owfs-2.8p15/module/owlib/src/c/ow_fs_type.c0000664000175000017500000000325011352033033015537 00000000000000/* $Id: ow_fs_type.c,v 1.3 2010/03/23 03:31:39 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_type(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return OWQ_format_output_offset_and_size_z(pn->selected_device->readable_name, owq); } owfs-2.8p15/module/owlib/src/c/ow_usb_monitor.c0000644000175000017500000001157611731463643016455 00000000000000/* $Id: ow_usb_monitor.c,v 1.18 2012/03/13 14:13:19 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_usb_msg.h" #if OW_USB && OW_MT static void USB_monitor_close(struct connection_in *in); static GOOD_OR_BAD usb_monitor_in_use(const struct connection_in * in_selected) ; static void USB_scan_for_adapters(void) ; static void * USB_monitor_loop( void * v ); /* Device-specific functions */ GOOD_OR_BAD USB_monitor_detect(struct connection_in *in) { struct address_pair ap ; pthread_t thread ; Parse_Address( SOC(in)->devicename, &ap ) ; SOC(in)->type = ct_none ; if ( ap.first.type == address_numeric ) { Globals.usb_scan_interval = ap.first.number ; } else { Globals.usb_scan_interval = DEFAULT_USB_SCAN_INTERVAL ; } Free_Address( &ap ) ; SAFEFREE(SOC(in)->devicename) ; SOC(in)->devicename = owstrdup("USB bus monitor") ; SOC(in)->file_descriptor = FILE_DESCRIPTOR_BAD; in->iroutines.detect = USB_monitor_detect; in->Adapter = adapter_browse_monitor; /* OWFS assigned value */ in->iroutines.reset = NO_RESET_ROUTINE; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE ; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = USB_monitor_close; in->iroutines.flags = ADAP_FLAG_sham; in->adapter_name = "USB scan"; in->busmode = bus_usb_monitor ; Init_Pipe( in->master.usb_monitor.shutdown_pipe ) ; if ( pipe( in->master.usb_monitor.shutdown_pipe ) != 0 ) { ERROR_DEFAULT("Cannot allocate a shutdown pipe. The program shutdown may be messy"); Init_Pipe( in->master.usb_monitor.shutdown_pipe ) ; } fcntl (in->master.usb_monitor.shutdown_pipe[fd_pipe_read], F_SETFD, FD_CLOEXEC); // for safe forking fcntl (in->master.usb_monitor.shutdown_pipe[fd_pipe_write], F_SETFD, FD_CLOEXEC); // for safe forking RETURN_BAD_IF_BAD( usb_monitor_in_use(in) ) ; if ( pthread_create(&thread, DEFAULT_THREAD_ATTR, USB_monitor_loop, (void *) in) != 0 ) { ERROR_CALL("Cannot create the USB monitoring program thread"); return gbBAD ; } return gbGOOD ; } static GOOD_OR_BAD usb_monitor_in_use(const struct connection_in * in_selected) { struct connection_in *in; for (in = Inbound_Control.head; in != NO_CONNECTION; in = in->next) { if ( in == in_selected ) { continue ; } if ( in->busmode != bus_usb_monitor ) { continue ; } return gbBAD ; } return gbGOOD; // not found in the current inbound list } static void USB_monitor_close(struct connection_in *in) { SAFEFREE(SOC(in)->devicename) ; if ( FILE_DESCRIPTOR_VALID( in->master.usb_monitor.shutdown_pipe[fd_pipe_write] ) ) { ignore_result = write( in->master.usb_monitor.shutdown_pipe[fd_pipe_write],"X",1) ; //dummy payload } Test_and_Close_Pipe(in->master.usb_monitor.shutdown_pipe) ; } static void * USB_monitor_loop( void * v ) { struct connection_in * in = v ; FILE_DESCRIPTOR_OR_ERROR file_descriptor = in->master.usb_monitor.shutdown_pipe[fd_pipe_read] ; DETACH_THREAD; do { fd_set readset; struct timeval tv = { Globals.usb_scan_interval, 0, }; /* Initialize readset */ FD_ZERO(&readset); if ( FILE_DESCRIPTOR_VALID( file_descriptor ) ) { FD_SET(file_descriptor, &readset); } if ( select( file_descriptor+1, &readset, NULL, NULL, &tv ) != 0 ) { break ; // don't scan any more -- perhaps a close? } USB_scan_for_adapters() ; } while (1) ; return VOID_RETURN ; } /* Open a DS9490 -- low level code (to allow for repeats) */ static void USB_scan_for_adapters(void) { struct usb_list ul; MONITOR_RLOCK ; LEVEL_DEBUG("USB SCAN!"); USB_first(&ul); while ( GOOD(USB_next(&ul)) ) { struct connection_in * in = AllocIn(NO_CONNECTION) ; if ( in == NO_CONNECTION ) { return ; } SOC(in)->devicename = DS9490_device_name(&ul) ; SOC(in)->type = ct_usb ; // Can do detect. Becasue the name makes this a specific adapter (USB pair) // we won't do a directory and won't add the directory and devices with the wrong index if ( BAD( DS9490_detect(in)) ) { // Remove the extra connection RemoveIn(in); } else { // Add the device, but no need to check for bad match Add_InFlight( NULL, in ) ; } } MONITOR_RUNLOCK ; } #else /* OW_USB && OW_MT */ GOOD_OR_BAD USB_monitor_detect(struct connection_in *in) { (void) in ; LEVEL_CALL( "USB monitoring support not enabled" ) ; return gbBAD ; } #endif /* OW_USB && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_2423.c0000644000175000017500000001673011740076517014504 00000000000000/* $Id: ow_2423.c,v 1.73 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2423.h" /* ------- Prototypes ----------- */ /* DS2423 counter */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_counter); READ_FUNCTION(FS_pagecount); #if OW_CACHE READ_FUNCTION(FS_r_mincount); WRITE_FUNCTION(FS_w_mincount); #endif /* OW_CACHE */ /* ------- Structures ----------- */ static struct aggregate A2423 = { 16, ag_numbers, ag_separate, }; static struct aggregate A2423c = { 2, ag_letters, ag_separate, }; static struct filetype DS2423[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2423, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"pages/count", PROPERTY_LENGTH_UNSIGNED, &A2423, ft_unsigned, fc_volatile, FS_pagecount, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"counters", PROPERTY_LENGTH_UNSIGNED, &A2423c, ft_unsigned, fc_volatile, FS_counter, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, #if OW_CACHE {"mincount", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_mincount, FS_w_mincount, VISIBLE, NO_FILETYPE_DATA, }, #endif /*OW_CACHE */ }; DeviceEntryExtended(1D, DS2423, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x5A #define _1W_READ_MEMORY 0xF0 #define _1W_READ_MEMORY_PLUS_COUNTER 0xA5 #define _1W_COUNTER_FILL 0x00 /* Persistent storage */ Make_SlaveSpecificTag(CUM, fc_persistent); // cumulative /* ------- Functions ------------ */ /* DS2423 */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_counter(struct one_wire_query *owq, size_t page, size_t pagesize); /* 2423A/D Counter */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, pagesize, COMMON_read_memory_toss_counter)) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } static ZERO_OR_ERROR FS_counter(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(OW_r_counter(owq, OWQ_pn(owq).extension + 14, pagesize)) ; } static ZERO_OR_ERROR FS_pagecount(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(OW_r_counter(owq, OWQ_pn(owq).extension, pagesize)) ; } #if OW_CACHE /* Special code for cumulative counters -- read/write -- uses the caching system for storage */ /* Different from LCD system, counters are NOT reset with each read */ static ZERO_OR_ERROR FS_r_mincount(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT st[3], ct[2]; // stored and current counter values RETURN_ERROR_IF_BAD( OW_r_counter(owq, 14, 32) ) ; ct[0] = OWQ_U(owq); RETURN_ERROR_IF_BAD( OW_r_counter(owq, 15, 32) ) ; ct[1] = OWQ_U(owq); if ( BAD( Cache_Get_SlaveSpecific((void *) st, 3 * sizeof(UINT), SlaveSpecificTag(CUM), pn)) ) { // record doesn't (yet) exist st[2] = ct[0] < ct[1] ? ct[0] : ct[1]; } else { UINT d0 = ct[0] - st[0]; //delta counter.A UINT d1 = ct[1] - st[1]; // delta counter.B st[2] += d0 < d1 ? d0 : d1; // add minimum delta } st[0] = ct[0]; st[1] = ct[1]; OWQ_U(owq) = st[2]; if (Cache_Add_SlaveSpecific((void *) st, 3 * sizeof(UINT), SlaveSpecificTag(CUM), pn)) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_w_mincount(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT st[3]; // stored and current counter values st[2] = OWQ_U(owq); RETURN_ERROR_IF_BAD( OW_r_counter(owq, 14, 32) ) ; st[0] = OWQ_U(owq); RETURN_ERROR_IF_BAD( OW_r_counter(owq, 15, 32) ); st[1] = OWQ_U(owq); if (Cache_Add_SlaveSpecific((void *) st, 3 * sizeof(UINT), SlaveSpecificTag(CUM), pn)) { return -EINVAL; } return 0; } #endif /*OW_CACHE */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[1 + 2 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tcopy_crc[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 3 + size), TRXN_END, }; struct transaction_log treread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ(&p[1], 3 + size), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_END, }; /* Copy to scratchpad */ memcpy(&p[3], data, size); if (((offset + size) & 0x1F)) { // doesn't end on page boundary, no crc16 RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; } else { // DOES end on page boundary, can check CRC16 RETURN_BAD_IF_BAD(BUS_transaction(tcopy_crc, pn)) ; } /* Re-read scratchpad and compare */ /* Note that we tacitly shift the data one byte down for the E/S byte */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(treread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(twrite, pn)) ; UT_delay(32); return gbGOOD; } /* read counter (just past memory) */ /* Nathan Holmes helped troubleshoot this one! */ static GOOD_OR_BAD OW_r_counter(struct one_wire_query *owq, size_t page, size_t pagesize) { BYTE extra[8]; if (COMMON_read_memory_plus_counter(extra, page, pagesize, PN(owq))) { return gbBAD; } #if 0 if (extra[4] != _1W_COUNTER_FILL || extra[5] != _1W_COUNTER_FILL || extra[6] != _1W_COUNTER_FILL || extra[7] != _1W_COUNTER_FILL) { return gbBAD; } #endif /* counter is held in the 4 bytes after the data */ OWQ_U(owq) = UT_uint32(extra); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_eds.c0000644000175000017500000021144011740076517014660 00000000000000/* $Id: ow_eds.c,v 1.39 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_eds.h" /* ------- Prototypes ----------- */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_tag); READ_FUNCTION(FS_r_type); READ_FUNCTION(FS_r_float16); READ_FUNCTION(FS_r_i8) ; WRITE_FUNCTION(FS_w_i8) ; READ_FUNCTION(FS_r_8) ; WRITE_FUNCTION(FS_w_8) ; READ_FUNCTION(FS_r_16) ; WRITE_FUNCTION(FS_w_16) ; READ_FUNCTION(FS_r_24) ; WRITE_FUNCTION(FS_w_24) ; READ_FUNCTION(FS_r_32) ; WRITE_FUNCTION(FS_w_32) ; READ_FUNCTION(FS_r_float8) ; WRITE_FUNCTION(FS_w_float8) ; READ_FUNCTION(FS_r_float24) ; WRITE_FUNCTION(FS_w_float24) ; WRITE_FUNCTION(FS_clear); /* Extensive testing of the EDS0068 threchold writing shows a delay * is needed before a written value is readable */ #define _EDS_WRITE_DELAY_msec 700 #define _EDS_WRITE_SCRATCHPAD 0x0F #define _EDS_READ_SCRATCHPAD 0xAA #define _EDS_COPY_SCRATCHPAD 0x55 #define _EDS_READ_MEMMORY_NO_CRC 0xF0 #define _EDS_READ_MEMORY_WITH_CRC 0xA5 #define _EDS_CLEAR_ALARMS 0x33 #define _EDS_PAGES 3 #define _EDS_PAGESIZE 32 /* EDS0064 locations */ #define _EDS0064_Temp 0x22 // 16 bit float #define _EDS0064_Humidity 0x24 // 16 bit float #define _EDS0064_Dew 0x26 // 16 bit float #define _EDS0064_Humidex 0x28 // 16 bit float #define _EDS0064_Hindex 0x2A // 16 bit float #define _EDS0064_mbar 0x2C // 24 bit float #define _EDS0064_inHg 0x2F // 24 bit float #define _EDS0064_Lux 0x32 // uint24 #define _EDS0064_Alarm_state 0x3A // uint16 #define _EDS0064_Seconds_counter 0x3C // uint32 #define _EDS0064_Conditional_search 0x40 // uint16 #define _EDS0064_Temp_hi 0x42 // int8 #define _EDS0064_Temp_lo 0x43 // int8 #define _EDS0064_Hum_hi 0x44 // int8 #define _EDS0064_Hum_lo 0x45 // int8 #define _EDS0064_Dew_hi 0x46 // int8 #define _EDS0064_Dew_lo 0x47 // int8 #define _EDS0064_Hdex_hi 0x48 // int8 #define _EDS0064_Hdex_lo 0x49 // int8 #define _EDS0064_HI_hi 0x4A // int8 #define _EDS0064_HI_lo 0x4B // int8 #define _EDS0064_mbar_hi 0x4C // 24 bit float #define _EDS0064_mbar_lo 0x4F // 24 bit float #define _EDS0064_inHg_hi 0x52 // 24 bit float #define _EDS0064_inHg_lo 0x55 // 24 bit float #define _EDS0064_Lux_hi 0x58 // uint24 #define _EDS0064_Lux_lo 0x5B // uint24 #define _EDS0064_Relay_function 0x5E // byte #define _EDS0064_Relay_state 0x5F // byte /* EDS0071 locations */ #define _EDS0071_Tag 0x00 // 30 chars #define _EDS0071_ID 0x1E // uint16 #define _EDS0071_Temp 0x22 // 24bit float #define _EDS0071_RTD 0x25 // 24bit float #define _EDS0071_Conversion 0x28 // uint24 #define _EDS0071_Calibration 0x30 // uint32 //#define _EDS0071_Relay_state 0x35 // byte #define _EDS0071_Alarm_state 0x36 // byte #define _EDS0071_Conversion_counter 0x38 // uint32 #define _EDS0071_Seconds_counter 0x3C // uint32 #define _EDS0071_Conditional_search 0x40 // byte #define _EDS0071_free_byte 0x41 // byte #define _EDS0071_Temp_hi 0x42 // 24bit float #define _EDS0071_Temp_lo 0x45 // 24bit float #define _EDS0071_RTD_hi 0x48 // 24bit float #define _EDS0071_RTD_lo 0x4B // 24bit float #define _EDS0071_Calibration_key 0x5C // byte #define _EDS0071_RTD_delay 0x5D // byte #define _EDS0071_Relay_function 0x5E // byte #define _EDS0071_Relay_state 0x5F // byte static enum e_visibility VISIBLE_EDS0064( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0065( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0066( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0067( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0068( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0071( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EDS0072( const struct parsedname * pn ) ; #define _EDS_TAG_LENGTH 30 #define _EDS_TYPE_LENGTH 7 // struct bitfield { "alias_link", number_of_bits, shift_left, } static struct bitfield eds0064_cond_temp_hi = { "EDS0064/set_alarm/alarm_function", 1, 0, } ; static struct bitfield eds0064_cond_temp_lo = { "EDS0064/set_alarm/alarm_function", 1, 1, } ; static struct bitfield eds0064_cond_hum_hi = { "EDS0064/set_alarm/alarm_function", 1, 2, } ; static struct bitfield eds0064_cond_hum_lo = { "EDS0064/set_alarm/alarm_function", 1, 3, } ; static struct bitfield eds0064_cond_dp_hi = { "EDS0064/set_alarm/alarm_function", 1, 4, } ; static struct bitfield eds0064_cond_dp_lo = { "EDS0064/set_alarm/alarm_function", 1, 5, } ; static struct bitfield eds0064_cond_hdex_hi = { "EDS0064/set_alarm/alarm_function", 1, 6, } ; static struct bitfield eds0064_cond_hdex_lo = { "EDS0064/set_alarm/alarm_function", 1, 7, } ; static struct bitfield eds0064_cond_hindex_hi = { "EDS0064/set_alarm/alarm_function", 1, 8, } ; static struct bitfield eds0064_cond_hindex_lo = { "EDS0064/set_alarm/alarm_function", 1, 9, } ; static struct bitfield eds0064_cond_mbar_hi = { "EDS0064/set_alarm/alarm_function", 1, 10, } ; static struct bitfield eds0064_cond_mbar_lo = { "EDS0064/set_alarm/alarm_function", 1, 11, } ; static struct bitfield eds0064_cond_inHg_hi = { "EDS0064/set_alarm/alarm_function", 1, 12, } ; static struct bitfield eds0064_cond_inHg_lo = { "EDS0064/set_alarm/alarm_function", 1, 13, } ; static struct bitfield eds0064_cond_lux_hi = { "EDS0064/set_alarm/alarm_function", 1, 14, } ; static struct bitfield eds0064_cond_lux_lo = { "EDS0064/set_alarm/alarm_function", 1, 15, } ; static struct bitfield eds0064_temp_hi = { "EDS0064/alarm/state", 1, 0, } ; static struct bitfield eds0064_temp_lo = { "EDS0064/alarm/state", 1, 1, } ; static struct bitfield eds0064_hum_hi = { "EDS0064/alarm/state", 1, 2, } ; static struct bitfield eds0064_hum_lo = { "EDS0064/alarm/state", 1, 3, } ; static struct bitfield eds0064_dp_hi = { "EDS0064/alarm/state", 1, 4, } ; static struct bitfield eds0064_dp_lo = { "EDS0064/alarm/state", 1, 5, } ; static struct bitfield eds0064_hdex_hi = { "EDS0064/alarm/state", 1, 6, } ; static struct bitfield eds0064_hdex_lo = { "EDS0064/alarm/state", 1, 7, } ; static struct bitfield eds0064_hindex_hi = { "EDS0064/alarm/state", 1, 8, } ; static struct bitfield eds0064_hindex_lo = { "EDS0064/alarm/state", 1, 9, } ; static struct bitfield eds0064_mbar_hi = { "EDS0064/alarm/state", 1, 10, } ; static struct bitfield eds0064_mbar_lo = { "EDS0064/alarm/state", 1, 11, } ; static struct bitfield eds0064_inHg_hi = { "EDS0064/alarm/state", 1, 12, } ; static struct bitfield eds0064_inHg_lo = { "EDS0064/alarm/state", 1, 13, } ; static struct bitfield eds0064_lux_hi = { "EDS0064/alarm/state", 1, 14, } ; static struct bitfield eds0064_lux_lo = { "EDS0064/alarm/state", 1, 15, } ; static struct bitfield eds0064_relay_state = { "EDS0064/relay_state", 1, 0, } ; static struct bitfield eds0064_led_state = { "EDS0064/relay_state", 1, 1, } ; static struct bitfield eds0064_led_function = { "EDS0064/relay_function", 2, 2, } ; // struct bitfield { "alias_link", number_of_bits, shift_left, } static struct bitfield eds0071_cond_temp_hi = { "EDS0071/set_alarm/alarm_function", 1, 0, } ; static struct bitfield eds0071_cond_temp_lo = { "EDS0071/set_alarm/alarm_function", 1, 1, } ; static struct bitfield eds0071_cond_RTD_hi = { "EDS0071/set_alarm/alarm_function", 1, 2, } ; static struct bitfield eds0071_cond_RTD_lo = { "EDS0071/set_alarm/alarm_function", 1, 3, } ; static struct bitfield eds0071_temp_hi = { "EDS0071/alarm/state", 1, 0, } ; static struct bitfield eds0071_temp_lo = { "EDS0071/alarm/state", 1, 1, } ; static struct bitfield eds0071_RTD_hi = { "EDS0071/alarm/state", 1, 2, } ; static struct bitfield eds0071_RTD_lo = { "EDS0071/alarm/state", 1, 3, } ; static struct bitfield eds0071_relay_state = { "EDS0071/relay_state", 1, 0, } ; static struct bitfield eds0071_led_state = { "EDS0071/relay_state", 1, 1, } ; static struct bitfield eds0071_relay_function = { "EDS0071/relay_function", 2, 0, } ; static struct bitfield eds0071_led_function = { "EDS0071/relay_function", 2, 2, } ; /* ------- Structures ----------- */ static struct aggregate AEDS = { _EDS_PAGES, ag_numbers, ag_separate, }; static struct filetype EDS[] = { F_STANDARD, {"memory", _EDS_PAGES * _EDS_PAGESIZE, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", _EDS_PAGESIZE, &AEDS, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"tag", _EDS_TAG_LENGTH, NON_AGGREGATE, ft_ascii, fc_stable, FS_r_tag, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device_type", _EDS_TYPE_LENGTH, NON_AGGREGATE, ft_ascii, fc_link, FS_r_type, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device_id", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_16, NO_WRITE_FUNCTION, VISIBLE, {u: _EDS0071_ID,}, }, /* EDS 0064 */ {"EDS0064", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0064, {u: _EDS0064_Temp,}, }, {"EDS0064/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0064, {u: _EDS0064_Seconds_counter,}, }, {"EDS0064/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_function,}, }, {"EDS0064/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_state,}, }, {"EDS0064/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_cond_temp_hi,}, }, {"EDS0064/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_cond_temp_lo,}, }, {"EDS0064/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, INVISIBLE, {u: _EDS0064_Conditional_search,}, }, {"EDS0064/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0064, {u: _EDS0064_Temp_hi,}, }, {"EDS0064/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0064, {u: _EDS0064_Temp_lo,}, }, {"EDS0064/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0064_Alarm_state,}, }, {"EDS0064/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0064, {v: &eds0064_temp_hi,}, }, {"EDS0064/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0064, {v: &eds0064_temp_lo,}, }, {"EDS0064/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_relay_state,}, }, {"EDS0064/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_led_function,}, }, {"EDS0064/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0064, NO_FILETYPE_DATA, }, {"EDS0064/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_led_state,}, }, {"EDS0064/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0064, {v: &eds0064_led_function,}, }, /* EDS 0065 */ {"EDS0065", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Temp,}, }, {"EDS0065/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Humidity,}, }, {"EDS0065/dew_point", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Dew,}, }, {"EDS0065/humidex", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Humidex,}, }, {"EDS0065/heat_index", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Hindex,}, }, {"EDS0065/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_function,}, }, {"EDS0065/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_state,}, }, {"EDS0065/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {u: _EDS0064_Seconds_counter,}, }, {"EDS0065/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_temp_hi,}, }, {"EDS0065/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_temp_lo,}, }, {"EDS0065/set_alarm/humidity_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hum_hi,}, }, {"EDS0065/set_alarm/humidity_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hum_lo,}, }, {"EDS0065/set_alarm/humidex_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hdex_hi,}, }, {"EDS0065/set_alarm/humidex_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hdex_lo,}, }, {"EDS0065/set_alarm/heat_index_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hindex_hi,}, }, {"EDS0065/set_alarm/heat_index_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_hindex_lo,}, }, {"EDS0065/set_alarm/dew_point_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_dp_hi,}, }, {"EDS0065/set_alarm/dew_point_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_cond_dp_lo,}, }, {"EDS0065/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, INVISIBLE, {u: _EDS0064_Conditional_search,}, }, {"EDS0065/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Temp_hi,}, }, {"EDS0065/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Temp_lo,}, }, {"EDS0065/threshold/humidity_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_i8, FS_w_i8, VISIBLE_EDS0065, {u: _EDS0064_Hum_hi,}, }, {"EDS0065/threshold/humidity_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_i8, FS_w_i8, VISIBLE_EDS0065, {u: _EDS0064_Hum_lo,}, }, {"EDS0065/threshold/dew_point_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Dew_hi,}, }, {"EDS0065/threshold/dew_point_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Dew_lo,}, }, {"EDS0065/threshold/heat_index_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_HI_hi,}, }, {"EDS0065/threshold/heat_index_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_HI_lo,}, }, {"EDS0065/threshold/humidex_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Hdex_hi,}, }, {"EDS0065/threshold/humidex_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0065, {u: _EDS0064_Hdex_lo,}, }, {"EDS0065/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0064_Alarm_state,}, }, {"EDS0065/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0071_temp_hi,}, }, {"EDS0065/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_temp_lo,}, }, {"EDS0065/alarm/humidity_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hum_hi,}, }, {"EDS0065/alarm/humidity_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hum_lo,}, }, {"EDS0065/alarm/humidex_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hdex_hi,}, }, {"EDS0065/alarm/humidex_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hdex_lo,}, }, {"EDS0065/alarm/heat_index_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hindex_hi,}, }, {"EDS0065/alarm/heat_index_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_hindex_lo,}, }, {"EDS0065/alarm/dew_point_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_dp_hi,}, }, {"EDS0065/alarm/dew_point_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0065, {v: &eds0064_dp_lo,}, }, {"EDS0065/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_relay_state,}, }, {"EDS0065/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_led_function,}, }, {"EDS0065/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0065, NO_FILETYPE_DATA, }, {"EDS0065/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_led_state,}, }, {"EDS0065/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0065, {v: &eds0064_led_function,}, }, /* EDS 0066 */ {"EDS0066", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {u: _EDS0064_Temp,}, }, {"EDS0066/pressure", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {u: _EDS0064_mbar,}, }, {"EDS0066/inHg", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {u: _EDS0064_inHg,}, }, {"EDS0066/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_function,}, }, {"EDS0066/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_state,}, }, {"EDS0066/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {u: _EDS0064_Seconds_counter,}, }, {"EDS0066/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_temp_hi,}, }, {"EDS0066/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_temp_lo,}, }, {"EDS0066/set_alarm/pressure_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_mbar_hi,}, }, {"EDS0066/set_alarm/pressure_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_mbar_lo,}, }, {"EDS0066/set_alarm/inHg_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_inHg_hi,}, }, {"EDS0066/set_alarm/inHg_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_cond_inHg_lo,}, }, {"EDS0066/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, INVISIBLE, {u: _EDS0064_Conditional_search,}, }, {"EDS0066/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0066, {u: _EDS0064_Temp_hi,}, }, {"EDS0066/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0066, {u: _EDS0064_Temp_lo,}, }, {"EDS0066/threshold/pressure_hi" , PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0066, {u: _EDS0064_mbar_hi,}, }, {"EDS0066/threshold/pressure_low", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0066, {u: _EDS0064_mbar_lo,}, }, {"EDS0066/threshold/inHg_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0066, {u: _EDS0064_inHg_hi,}, }, {"EDS0066/threshold/inHg_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0066, {u: _EDS0064_inHg_lo,}, }, {"EDS0066/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0064_Alarm_state,}, }, {"EDS0066/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_temp_hi,}, }, {"EDS0066/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_temp_lo,}, }, {"EDS0066/alarm/pressure_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_mbar_hi,}, }, {"EDS0066/alarm/pressure_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_mbar_lo,}, }, {"EDS0066/alarm/inHg_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_inHg_hi,}, }, {"EDS0066/alarm/inHg_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0066, {v: &eds0064_inHg_lo,}, }, {"EDS0066/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_relay_state,}, }, {"EDS0066/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_led_function,}, }, {"EDS0066/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0066, NO_FILETYPE_DATA, }, {"EDS0066/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_led_state,}, }, {"EDS0066/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0066, {v: &eds0064_led_function,}, }, /* EDS 0067 */ {"EDS0067", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {u: _EDS0064_Temp,}, }, {"EDS0067/light", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_24, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {u: _EDS0064_Lux,}, }, {"EDS0067/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_function,}, }, {"EDS0067/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_state,}, }, {"EDS0067/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {u: _EDS0064_Seconds_counter,}, }, {"EDS0067/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_cond_temp_hi,}, }, {"EDS0067/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_cond_temp_lo,}, }, {"EDS0067/set_alarm/light_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_cond_lux_hi,}, }, {"EDS0067/set_alarm/light_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_cond_lux_lo,}, }, {"EDS0067/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, INVISIBLE, {u: _EDS0064_Conditional_search,}, }, {"EDS0067/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0067, {u: _EDS0064_Temp_hi,}, }, {"EDS0067/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0067, {u: _EDS0064_Temp_lo,}, }, {"EDS0067/threshold/light_hi ", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_24, FS_w_24, VISIBLE_EDS0067, {u: _EDS0064_Lux_hi,}, }, {"EDS0067/threshold/light_low", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_24, FS_w_24, VISIBLE_EDS0067, {u: _EDS0064_Lux_lo,}, }, {"EDS0067/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0064_Alarm_state,}, }, {"EDS0067/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {v: &eds0064_temp_hi,}, }, {"EDS0067/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {v: &eds0064_temp_lo,}, }, {"EDS0067/alarm/light_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {v: &eds0064_lux_hi,}, }, {"EDS0067/alarm/light_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0067, {v: &eds0064_lux_lo,}, }, {"EDS0067/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_relay_state,}, }, {"EDS0067/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_led_function,}, }, {"EDS0067/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0067, NO_FILETYPE_DATA, }, {"EDS0067/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_led_state,}, }, {"EDS0067/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0067, {v: &eds0064_led_function,}, }, /* EDS 0068 */ {"EDS0068", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Temp,}, }, {"EDS0068/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Humidity,}, }, {"EDS0068/dew_point", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Dew,}, }, {"EDS0068/humidex", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Humidex,}, }, {"EDS0068/heat_index", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float16, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Hindex,}, }, {"EDS0068/pressure", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_mbar,}, }, {"EDS0068/inHg", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_inHg,}, }, {"EDS0068/light", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_24, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Lux,}, }, {"EDS0068/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_function,}, }, {"EDS0068/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0064_Relay_state,}, }, {"EDS0068/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {u: _EDS0064_Seconds_counter,}, }, {"EDS0068/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_temp_hi,}, }, {"EDS0068/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_temp_lo,}, }, {"EDS0068/set_alarm/humidity_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hum_hi,}, }, {"EDS0068/set_alarm/humidity_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hum_lo,}, }, {"EDS0068/set_alarm/humidex_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hdex_hi,}, }, {"EDS0068/set_alarm/humidex_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hdex_lo,}, }, {"EDS0068/set_alarm/heat_index_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hindex_hi,}, }, {"EDS0068/set_alarm/heat_index_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_hindex_lo,}, }, {"EDS0068/set_alarm/dew_point_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_dp_hi,}, }, {"EDS0068/set_alarm/dew_point_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_dp_lo,}, }, {"EDS0068/set_alarm/pressure_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_mbar_hi,}, }, {"EDS0068/set_alarm/pressure_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_mbar_lo,}, }, {"EDS0068/set_alarm/inHg_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_inHg_hi,}, }, {"EDS0068/set_alarm/inHg_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_inHg_lo,}, }, {"EDS0068/set_alarm/light_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_lux_hi,}, }, {"EDS0068/set_alarm/light_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_cond_lux_lo,}, }, {"EDS0068/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, FS_w_16, INVISIBLE, {u: _EDS0064_Conditional_search,}, }, {"EDS0068/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Temp_hi,}, }, {"EDS0068/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Temp_lo,}, }, {"EDS0068/threshold/humidity_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Hum_hi,}, }, {"EDS0068/threshold/humidity_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Hum_lo,}, }, {"EDS0068/threshold/dew_point_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Dew_hi,}, }, {"EDS0068/threshold/dew_point_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Dew_lo,}, }, {"EDS0068/threshold/heat_index_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_HI_hi,}, }, {"EDS0068/threshold/heat_index_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_HI_lo,}, }, {"EDS0068/threshold/humidex_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Hdex_hi,}, }, {"EDS0068/threshold/humidex_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float8, FS_w_float8, VISIBLE_EDS0068, {u: _EDS0064_Hdex_lo,}, }, {"EDS0068/threshold/pressure_hi" , PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0068, {u: _EDS0064_mbar_hi,}, }, {"EDS0068/threshold/pressure_low", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0068, {u: _EDS0064_mbar_lo,}, }, {"EDS0068/threshold/inHg_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0068, {u: _EDS0064_inHg_hi,}, }, {"EDS0068/threshold/inHg_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0068, {u: _EDS0064_inHg_lo,}, }, {"EDS0068/threshold/light_hi" , PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_24, FS_w_24, VISIBLE_EDS0068, {u: _EDS0064_Lux_hi,}, }, {"EDS0068/threshold/light_low", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_24, FS_w_24, VISIBLE_EDS0068, {u: _EDS0064_Lux_lo,}, }, {"EDS0068/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_16, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0064_Alarm_state,}, }, {"EDS0068/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0071_temp_hi,}, }, {"EDS0068/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_temp_lo,}, }, {"EDS0068/alarm/humidity_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hum_hi,}, }, {"EDS0068/alarm/humidity_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hum_lo,}, }, {"EDS0068/alarm/humidex_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hdex_hi,}, }, {"EDS0068/alarm/humidex_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hdex_lo,}, }, {"EDS0068/alarm/heat_index_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hindex_hi,}, }, {"EDS0068/alarm/heat_index_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_hindex_lo,}, }, {"EDS0068/alarm/dew_point_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_dp_hi,}, }, {"EDS0068/alarm/dew_point_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_dp_lo,}, }, {"EDS0068/alarm/pressure_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_mbar_hi,}, }, {"EDS0068/alarm/pressure_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_mbar_lo,}, }, {"EDS0068/alarm/inHg_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_inHg_hi,}, }, {"EDS0068/alarm/inHg_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_inHg_lo,}, }, {"EDS0068/alarm/light_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_lux_hi,}, }, {"EDS0068/alarm/light_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0068, {v: &eds0064_lux_lo,}, }, {"EDS0068/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_relay_state,}, }, {"EDS0068/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_led_function,}, }, {"EDS0068/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0068, NO_FILETYPE_DATA, }, {"EDS0068/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_led_state,}, }, {"EDS0068/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0068, {v: &eds0064_led_function,}, }, /* EDS0071 */ {"EDS0071", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {u: _EDS0071_Temp,}, }, {"EDS0071/resistance", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {u: _EDS0071_RTD,}, }, {"EDS0071/raw", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_24, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0071_Conversion,}, }, {"EDS0071/user_byte", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_EDS0071, {u: _EDS0071_free_byte,}, }, {"EDS0071/delay", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_EDS0071, {u: _EDS0071_RTD_delay,}, }, {"EDS0071/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Relay_function,}, }, {"EDS0071/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Relay_state,}, }, {"EDS0071/calibration", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/calibration/constant", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {u: _EDS0071_Calibration,}, }, {"EDS0071/calibration/key", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_8, FS_w_8, VISIBLE_EDS0071, {u: _EDS0071_Calibration_key,}, }, {"EDS0071/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {u: _EDS0071_Seconds_counter,}, }, {"EDS0071/counter/samples", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {u: _EDS0071_Conversion_counter,}, }, {"EDS0071/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/set_alarm/temp_hi", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_cond_temp_hi,}, }, {"EDS0071/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_cond_temp_lo,}, }, {"EDS0071/set_alarm/resistance__hi", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_cond_RTD_hi,}, }, {"EDS0071/set_alarm/resistance_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_cond_RTD_lo,}, }, {"EDS0071/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Conditional_search,}, }, {"EDS0071/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/threshold/temp_hi", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0071, {u: _EDS0071_Temp_hi,}, }, {"EDS0071/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0071, {u: _EDS0071_Temp_lo,}, }, {"EDS0071/threshold/resistance_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0071, {u: _EDS0071_RTD_hi,}, }, {"EDS0071/threshold/resistance_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0071, {u: _EDS0071_RTD_lo,}, }, {"EDS0071/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0071_Alarm_state,}, }, {"EDS0071/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {v: &eds0071_temp_hi,}, }, {"EDS0071/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {v: &eds0071_temp_lo,}, }, {"EDS0071/alarm/resistance_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {v: &eds0071_RTD_hi,}, }, {"EDS0071/alarm/resistance_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0071, {v: &eds0071_RTD_lo,}, }, {"EDS0071/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0071/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_relay_state,}, }, {"EDS0071/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_led_function,}, }, {"EDS0071/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0071/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_led_state,}, }, {"EDS0071/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0071, {v: &eds0071_led_function,}, }, /* EDS0072 */ {"EDS0072", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {u: _EDS0071_Temp,}, }, {"EDS0072/resistance", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_float24, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {u: _EDS0071_RTD,}, }, {"EDS0072/raw", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_24, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0071_Conversion,}, }, {"EDS0072/user_byte", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_EDS0072, {u: _EDS0071_free_byte,}, }, {"EDS0072/delay", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, VISIBLE_EDS0072, {u: _EDS0071_RTD_delay,}, }, {"EDS0072/relay_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Relay_function,}, }, {"EDS0072/relay_state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Relay_state,}, }, {"EDS0072/calibration", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/calibration/constant", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {u: _EDS0071_Calibration,}, }, {"EDS0072/calibration/key", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_8, FS_w_8, VISIBLE_EDS0072, {u: _EDS0071_Calibration_key,}, }, {"EDS0072/counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/counter/seconds", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {u: _EDS0071_Seconds_counter,}, }, {"EDS0072/counter/samples", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_32, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {u: _EDS0071_Conversion_counter,}, }, {"EDS0072/set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_cond_temp_hi,}, }, {"EDS0072/set_alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_cond_temp_hi,}, }, {"EDS0072/set_alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_cond_temp_lo,}, }, {"EDS0072/set_alarm/RTD_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_cond_RTD_hi,}, }, {"EDS0072/set_alarm/RTD_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_cond_RTD_lo,}, }, {"EDS0072/set_alarm/alarm_function", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, FS_w_8, INVISIBLE, {u: _EDS0071_Conditional_search,}, }, {"EDS0072/threshold", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0071, NO_FILETYPE_DATA, }, {"EDS0072/threshold/temp_hi" , PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0072, {u: _EDS0071_Temp_hi,}, }, {"EDS0072/threshold/temp_low", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0072, {u: _EDS0071_Temp_lo,}, }, {"EDS0072/threshold/resistance_hi" , PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0072, {u: _EDS0071_RTD_hi,}, }, {"EDS0072/threshold/resistance_low", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_float24, FS_w_float24, VISIBLE_EDS0072, {u: _EDS0071_RTD_lo,}, }, {"EDS0072/alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/alarm/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_clear, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/alarm/state", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_8, NO_WRITE_FUNCTION, INVISIBLE, {u: _EDS0071_Alarm_state,}, }, {"EDS0072/alarm/temp_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {v: &eds0071_temp_hi,}, }, {"EDS0072/alarm/temp_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {v: &eds0071_temp_lo,}, }, {"EDS0072/alarm/RTD_hi" , PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {v: &eds0071_RTD_hi,}, }, {"EDS0072/alarm/RTD_low", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, NO_WRITE_FUNCTION, VISIBLE_EDS0072, {v: &eds0071_RTD_lo,}, }, {"EDS0072/relay", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/relay/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_relay_state,}, }, {"EDS0072/relay/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_led_function,}, }, {"EDS0072/LED", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EDS0072, NO_FILETYPE_DATA, }, {"EDS0072/LED/state", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_led_state,}, }, {"EDS0072/LED/control", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_r_bitfield, FS_w_bitfield, VISIBLE_EDS0072, {v: &eds0071_led_function,}, }, }; DeviceEntryExtended(7E, EDS, DEV_temp | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) ; static GOOD_OR_BAD OW_w_mem_crc(BYTE * data, size_t size, off_t offset, struct parsedname *pn) ; static GOOD_OR_BAD OW_r_mem_small(BYTE * data, size_t size, off_t offset, struct parsedname * pn); static int VISIBLE_EDS( const struct parsedname * pn ) ; static GOOD_OR_BAD OW_clear( struct parsedname * pn) ; /* finds the visibility value (0x0071 ...) either cached, or computed via the device_id (then cached) */ static int VISIBLE_EDS( const struct parsedname * pn ) { int device_id = -1 ; LEVEL_DEBUG("Checking visibility of %s",SAFESTRING(pn->path)) ; if ( BAD( GetVisibilityCache( &device_id, pn ) ) ) { struct one_wire_query * owq = OWQ_create_from_path(pn->path) ; // for read if ( owq != NULL) { UINT U_device_id ; if ( FS_r_sibling_U( &U_device_id, "device_id", owq ) == 0 ) { device_id = U_device_id ; SetVisibilityCache( device_id, pn ) ; } OWQ_destroy(owq) ; } } return device_id ; } static enum e_visibility VISIBLE_EDS0064( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0064: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0065( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0065: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0066( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0066: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0067( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0067: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0068( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0068: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0071( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0071: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EDS0072( const struct parsedname * pn ) { switch ( VISIBLE_EDS(pn) ) { case 0x0072: return visible_now ; default: return visible_not_now ; } } static ZERO_OR_ERROR FS_r_tag(struct one_wire_query *owq) { return FS_r_mem(owq) ; } static ZERO_OR_ERROR FS_clear(struct one_wire_query *owq) { if ( OWQ_Y(owq) != 0 ) { RETURN_ERROR_IF_BAD( OW_clear( PN(owq) ) ) ; } return 0 ; } static ZERO_OR_ERROR FS_r_type(struct one_wire_query *owq) { UINT id ; ASCII typ[_EDS_TYPE_LENGTH+1] ; RETURN_ERROR_IF_BAD( FS_r_sibling_U( &id, "device_id", owq ) ) ; UCLIBCLOCK ; snprintf(typ,sizeof(typ),"EDS%.4X",id); UCLIBCUNLOCK ; return OWQ_format_output_offset_and_size_z(typ,owq); } /* 8 bit float */ static ZERO_OR_ERROR FS_r_float8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_F(owq) = (_FLOAT) ((int8_t) (data[0] )) ; return 0 ; } /* 16 bit float in DS18B20 format */ static ZERO_OR_ERROR FS_r_float16(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 16/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_F(owq) = (_FLOAT) ((int16_t) ((data[1] << 8) | data[0] )) * .0625 ; return 0 ; } /* 24 bit float with resolution 1/2048th */ static ZERO_OR_ERROR FS_r_float24(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 24/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); // use 32 bit with 0 for lowest byte OWQ_F(owq) = (_FLOAT) ((int32_t) ((data[2] << 24) | (data[1] << 16) | ( data[0] << 8 ) )) / ( 2048.*256.) ; return 0 ; } /* write a 24 bit value from a register stored in filetype.data */ /* write as a signed float with resolution 1/2048th */ static ZERO_OR_ERROR FS_w_float24(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 24/8 ; BYTE data[bytes] ; int32_t big = 256. * 2048. * OWQ_F(owq) ; data[0] = (big>>8) & 0xFF ; data[1] = (big>>16) & 0xFF ; data[2] = (big>>24) & 0xFF ; return GB_to_Z_OR_E( OW_w_mem( data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, pagesize, COMMON_read_memory_F0)) ; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*_EDS_PAGESIZE) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t size = OWQ_size(owq) ; off_t start = OWQ_offset(owq) ; BYTE * position = (BYTE *)OWQ_buffer(owq) ; size_t write_size = _EDS_PAGESIZE - (start % _EDS_PAGESIZE) ; while ( size > 0 ) { if ( write_size > size ) { write_size = size ; } RETURN_ERROR_IF_BAD( OW_w_mem(position, write_size, start, PN(owq)) ) ; position += write_size ; start += write_size ; size -= write_size ; write_size = _EDS_PAGESIZE ; } return 0; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*_EDS_PAGESIZE) ; } /* read a signed 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_r_i8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_I(owq) = (int8_t) data[0] ; return 0 ; } /* write a signed 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_w_i8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; data[0] = BYTE_MASK( OWQ_I(owq) ) ; return GB_to_Z_OR_E(OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read an 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_r_8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = data[0] ; return 0 ; } /* write an 8 bit value from a register stored in filetype.data plus extension */ static ZERO_OR_ERROR FS_w_8(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 8/8 ; BYTE data[bytes] ; data[0] = BYTE_MASK( OWQ_U(owq) ) ; return GB_to_Z_OR_E(OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read a 16 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_r_16(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 16/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = UT_int16(data) ; return 0 ; } /* write a 24 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_w_24(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 24/8 ; BYTE data[bytes] ; UT_uint16_to_bytes( OWQ_U(owq), data ) ; return GB_to_Z_OR_E( OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read a 24 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_r_24(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 24/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = UT_int24(data) ; return 0 ; } /* write a 16 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_w_16(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 16/8 ; BYTE data[bytes] ; UT_uint24_to_bytes( OWQ_U(owq), data ) ; return GB_to_Z_OR_E( OW_w_mem(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ) ; } /* read a 32 bit value from a register stored in filetype.data */ static ZERO_OR_ERROR FS_r_32(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int bytes = 32/8 ; BYTE data[bytes] ; RETURN_ERROR_IF_BAD( OW_r_mem_small(data, bytes, pn->selected_filetype->data.u + bytes * pn->extension, pn ) ); OWQ_U(owq) = UT_int32(data) ; return 0 ; } /* write an 8 bit value from a register stored in filetype.data */ /* write as a signed float*/ static ZERO_OR_ERROR FS_w_float8(struct one_wire_query *owq) { int8_t val = OWQ_F(owq) ; OWQ_I(owq) = val ; return FS_w_8(owq) ; } static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 1 + _EDS_PAGESIZE + 2] = { _EDS_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(p, 3 + size), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ( &p[1], 3 + size), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(_EDS_WRITE_DELAY_msec), TRXN_END, }; // use different scheme for write that goes to page end (use CRC) if ( ( (offset + size) & 0x1F) == 0 ) { /* to end of page */ return OW_w_mem_crc( data, size, offset, pn ) ; } /* Copy to scratchpad */ memcpy(&p[3], data, size); RETURN_BAD_IF_BAD(BUS_transaction(twrite, pn)) ; /* Re-read scratchpad and compare */ /* Note: location of data has now shifted down a byte for E/S register */ p[0] = _EDS_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* write Scratchpad to SRAM */ p[0] = _EDS_COPY_SCRATCHPAD; return BUS_transaction(tcopy, pn) ; } // write to end of page (size is appropriate) static GOOD_OR_BAD OW_w_mem_crc(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 1 + _EDS_PAGESIZE + 2] = { _EDS_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log twrite[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WR_CRC16(p, 1, 3 + size), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(_EDS_WRITE_DELAY_msec), TRXN_END, }; /* Copy to scratchpad -- use CRC16 */ memcpy(&p[3], data, size); RETURN_BAD_IF_BAD(BUS_transaction(twrite, pn)) ; /* Re-read scratchpad and compare */ /* Note: location of data has now shifted down a byte for E/S register */ p[0] = _EDS_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* write Scratchpad to SRAM */ p[0] = _EDS_COPY_SCRATCHPAD; return BUS_transaction(tcopy, pn) ; } /* Read a few bytes within a page */ static GOOD_OR_BAD OW_r_mem_small(BYTE * data, size_t size, off_t offset, struct parsedname * pn) { BYTE p[3] = { _EDS_READ_MEMMORY_NO_CRC, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ( data, size), TRXN_END, }; return BUS_transaction(t, pn); } /* Clear alarms */ static GOOD_OR_BAD OW_clear( struct parsedname * pn) { BYTE p[1] = { _EDS_CLEAR_ALARMS }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_END, }; return BUS_transaction(t, pn); } owfs-2.8p15/module/owlib/src/c/ow_1923.c0000644000175000017500000006012411740076517014504 00000000000000/* $Id: ow_1923.c,v 1.56 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Notes on DS1923 passwords The DS1923 has (optional) password protection for data reads, and full read/write This creaqtes problems for the filesystem metaphore, that typically doesn't allow aditional information to be sent with every operation. Our solution is to have the password stored in memory in each session, and thus used transparently when read/write pcalls are done. There are therefore several password operations: 1. Setting/clearing passwords in the chip 2. Setting local (memory) knowledge of the password 3. Turning password protection on/off So we have two cases: 1. No passowrd protection Then any read/write should succeed. There are issues with the testing since password protection needs memory access to test. It should be possible to set passwords (and password protection) from this state 2. Passord protection set on chip Passords need to be set in memory to */ #include #include "owfs_config.h" #include "ow_1923.h" /* ------- Prototypes ----------- */ /* DS1923 Battery */ READ_FUNCTION(FS_r_temperature); READ_FUNCTION(FS_r_humid); READ_FUNCTION(FS_r_date); WRITE_FUNCTION(FS_w_date); READ_FUNCTION(FS_r_counter); WRITE_FUNCTION(FS_w_counter); READ_FUNCTION(FS_bitread); WRITE_FUNCTION(FS_bitwrite); READ_FUNCTION(FS_rbitread); WRITE_FUNCTION(FS_rbitwrite); READ_FUNCTION(FS_clearmem); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_run); WRITE_FUNCTION(FS_w_run); WRITE_FUNCTION(FS_w_mip); READ_FUNCTION(FS_r_delay); WRITE_FUNCTION(FS_w_delay); READ_FUNCTION(FS_enable_osc); /* ------- Structures ----------- */ struct BitRead { size_t location; int bit; }; static struct BitRead BitReads[] = { {0x0215, 1,}, // Mission in progress {0x0213, 4,}, // rollover {0x0212, 0,}, // clock running {0x0213, 0,}, //sample temp in progress {0x0213, 1,}, //sample humidity in progress //{ 0x0214, 7, } , //temperature in progress //{ 0x0214, 4, } , //sample in progress }; /* Device configuration byte (Address 0x0226) Add detection and support for all of them... 00000000 DS2422 00100000 DS1923 01000000 DS1922L 01100000 DS1922T */ struct Mission { _DATE start; int rollover; int interval; int samples; }; static struct aggregate A1923p = { 18, ag_numbers, ag_separate, }; static struct aggregate A1923l = { 2048, ag_numbers, ag_mixed, }; static struct aggregate A1923h = { 63, ag_numbers, ag_mixed, }; static struct aggregate A1923m = { 12, ag_numbers, ag_aggregate, }; static struct filetype DS1923[] = { F_STANDARD, #if 0 /* Just test functions */ {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, #endif {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A1923p, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_r_temperature, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_r_humid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"clock", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"clock/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_second, FS_r_date, FS_w_date, VISIBLE, NO_FILETYPE_DATA, }, {"clock/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, NO_FILETYPE_DATA, }, {"clock/running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_rbitread, FS_rbitwrite, VISIBLE, {v:&BitReads[2]}, }, #if 0 /* Just test functions */ {"running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_run, FS_w_run, VISIBLE, NO_FILETYPE_DATA, }, {"clearmem", 1, NON_AGGREGATE, ft_binary, fc_stable, FS_clearmem, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"enableosc", 1, NON_AGGREGATE, ft_binary, fc_stable, FS_enable_osc, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, #endif {"mission", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission/running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_bitread, FS_w_mip, VISIBLE, {v:&BitReads[0]}, }, {"mission/rollover", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_bitread, FS_bitwrite, VISIBLE, {v:&BitReads[1]}, }, {"mission/delay", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_delay, FS_w_delay, VISIBLE, NO_FILETYPE_DATA, }, {"mission/samplingtemp", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_bitread, NO_WRITE_FUNCTION, VISIBLE, {v:&BitReads[3]}, }, {"mission/samplinghumidity", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_bitread, NO_WRITE_FUNCTION, VISIBLE, {v:&BitReads[4]}, }, #if 0 {"mission/frequency", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, {u: FS_r_samplerate}, {u: FS_w_samplerate}, VISIBLE, NO_FILETYPE_DATA, }, {"mission/samples", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, {u: FS_r_3byte}, {o: NULL}, VISIBLE, {s:0x021A}, }, {"mission/delay", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_delay, FS_w_delay, VISIBLE, NO_FILETYPE_DATA, }, {"mission/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_volatile, {d:FS_mdate}, NO_READ_FUNCTION, NO_WRITE_FUNCTION,VISIBLE, NO_FILETYPE_DATA }, {"mission/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_volatile, {d: FS_mdate}, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"mission/easystart", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, {o: NULL}, {u: FS_easystart}, VISIBLE, NO_FILETYPE_DATA, }, #endif }; DeviceEntryExtended(41, DS1923, DEV_temp | DEV_alarm | DEV_ovdr | DEV_resume, NO_GENERIC_READ, NO_GENERIC_WRITE); /* Persistent storage */ Make_SlaveSpecificTag(RPW, fc_persistent); // Read password Make_SlaveSpecificTag(FPW, fc_persistent); // Full password #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD_WITH_PASSWORD 0x99 #define _1W_READ_MEMORY_WITH_PASSWORD_AND_CRC 0x69 #define _1W_CLEAR_MEMORY_WITH_PASSWORD 0x96 #define _1W_FORCED_CONVERSION 0x55 #define _1W_FORCED_CONVERSION_START 0xFF #define _1W_START_MISSION_WITH_PASSWORD 0xCC #define _1W_START_MISSION_WITH_PASSWORD_START 0xFF #define _1W_STOP_MISSION_WITH_PASSWORD 0x33 #define _1W_STOP_MISSION_WITH_PASSWORD_START 0xFF #define _1W_MEM_GENERAL_PURPOSE 0x0000 #define _1W_MEM_REGISTER_P1 0x0200 #define _1W_MEM_REGISTER_P2 0x0220 #define _1W_MEM_CALIBRATION_P1 0x0240 #define _1W_MEM_CALIBRATION_P2 0x0260 #define _1W_MEM_DATALOG 0x1000 /* ------- Functions ------------ */ /* DS1923 */ static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_temperature(_FLOAT * T, const UINT delay, struct parsedname *pn); static GOOD_OR_BAD OW_r_humid(_FLOAT * H, const UINT delay, struct parsedname *pn); static GOOD_OR_BAD OW_startmission(unsigned long mdelay, struct parsedname *pn); static GOOD_OR_BAD OW_mission_timing(unsigned long mdelay, struct parsedname *pn) ; static GOOD_OR_BAD OW_startmission_post_setup( struct parsedname * pn ) ; static GOOD_OR_BAD OW_mission_default_setup( struct parsedname * pn ) ; static GOOD_OR_BAD OW_stopmission(struct parsedname *pn); static GOOD_OR_BAD OW_MIP(struct parsedname *pn); static GOOD_OR_BAD OW_clearmemory(struct parsedname *pn); static GOOD_OR_BAD OW_force_conversion(const UINT delay, struct parsedname *pn); static GOOD_OR_BAD OW_2date(_DATE * d, const BYTE * data); static GOOD_OR_BAD OW_oscillator(const int on, struct parsedname *pn); static void OW_date(const _DATE * d, BYTE * data); static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E( COMMON_readwrite_paged(owq, 0, pagesize, OW_r_mem)) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E( COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } /* mission delay */ static ZERO_OR_ERROR FS_r_delay(struct one_wire_query *owq) { BYTE data[3]; RETURN_ERROR_IF_BAD( OW_r_mem(data, 3, 0x0216, PN(owq)) ); // should be 3 bytes! //u[0] = (((UINT)data[2])<<16) | (((UINT)data[1])<<8) | data[0] ; OWQ_U(owq) = (((UINT) data[1]) << 8) | data[0]; return 0; } /* mission delay */ static ZERO_OR_ERROR FS_w_delay(struct one_wire_query *owq) { UINT U = OWQ_U(owq); BYTE data[3] = { U & 0xFF, (U >> 8) & 0xFF, (U >> 16) & 0xFF }; if ( BAD(OW_MIP(PN(owq)) ) ) { return -EBUSY; } return GB_to_Z_OR_E( OW_w_mem(data, 3, 0x0216, PN(owq))) ; } /* Just a test-function */ static ZERO_OR_ERROR FS_enable_osc(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); #if 0 /* Just write to address without any check */ BYTE d = 0x01; RETURN_ERROR_IF_BAD( OW_w_mem(&d, 1, 0x0212, pn) ); #else RETURN_ERROR_IF_BAD(OW_oscillator(1, pn)); #endif memset(OWQ_buffer(owq), 0, 1); return 0; } /* clock running? */ static ZERO_OR_ERROR FS_r_run(struct one_wire_query *owq) { BYTE cr; RETURN_ERROR_IF_BAD( OW_r_mem(&cr, 1, 0x0212, PN(owq)) ); // only bit 0 and 1 should be used! if (cr & 0xFC) { return -EINVAL; } OWQ_Y(owq) = (cr & 0x01); return 0; } /* stop/start clock running */ static ZERO_OR_ERROR FS_w_run(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE cr; BYTE check; RETURN_ERROR_IF_BAD( OW_r_mem(&cr, 1, 0x0212, pn) ); // only bit 0 and 1 should be used! if (cr & 0xFC) { return -EINVAL; } cr = OWQ_Y(owq) ? (cr | 0x01) : (cr & 0xFE); RETURN_ERROR_IF_BAD( OW_w_mem(&cr, 1, 0x0212, pn) ); /* Double check written value */ RETURN_ERROR_IF_BAD( OW_r_mem(&check, 1, 0x0212, pn) ); if (check != cr) { return -EINVAL; } return 0; } /* start/stop mission */ static ZERO_OR_ERROR FS_w_mip(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); unsigned long mdelay; BYTE data[3]; //printf("FS_w_mip:\n"); if (OWQ_Y(owq)) { /* start a mission! */ //printf("FS_w_mip: start\n"); RETURN_ERROR_IF_BAD( OW_r_mem(data, 3, 0x0216, pn) ); mdelay = data[0] | data[1] << 8 | data[2] << 16; return GB_to_Z_OR_E(OW_startmission(mdelay, pn)); } else { //printf("FS_w_mip: stop\n"); return GB_to_Z_OR_E( OW_stopmission(pn) ); } } static ZERO_OR_ERROR FS_bitread(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE d; struct BitRead *br; if (pn->selected_filetype->data.v == NULL) { return -EINVAL; } br = ((struct BitRead *) (pn->selected_filetype->data.v)); RETURN_ERROR_IF_BAD( OW_r_mem(&d, 1, br->location, pn) ); OWQ_Y(owq) = UT_getbit(&d, br->bit); return 0; } static ZERO_OR_ERROR FS_bitwrite(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE d; struct BitRead *br; if (pn->selected_filetype->data.v == NULL) { return -EINVAL; } br = ((struct BitRead *) (pn->selected_filetype->data.v)); RETURN_ERROR_IF_BAD( OW_r_mem(&d, 1, br->location, pn) ); UT_setbit(&d, br->bit, OWQ_Y(owq)); return GB_to_Z_OR_E( OW_w_mem(&d, 1, br->location, pn) ) ; } static ZERO_OR_ERROR FS_rbitread(struct one_wire_query *owq) { ZERO_OR_ERROR ret = FS_bitread(owq); OWQ_Y(owq) = !OWQ_Y(owq); return ret; } static int FS_rbitwrite(struct one_wire_query *owq) { OWQ_Y(owq) = !OWQ_Y(owq); return FS_bitwrite(owq); } /* Temperature -- force if not in progress */ static ZERO_OR_ERROR FS_r_temperature(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT delay = 666; RETURN_ERROR_IF_BAD( OW_MIP(pn)); RETURN_ERROR_IF_BAD(OW_force_conversion(delay, pn)); return GB_to_Z_OR_E(OW_r_temperature(&OWQ_F(owq), delay, pn)) ; } static ZERO_OR_ERROR FS_r_humid(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); UINT delay = 666; RETURN_ERROR_IF_BAD( OW_MIP(pn)); RETURN_ERROR_IF_BAD(OW_force_conversion(delay, pn)); return GB_to_Z_OR_E(OW_r_humid(&OWQ_F(owq), delay, pn)) ; } /* translate 7 byte field to a Unix-style date (number) */ static GOOD_OR_BAD OW_2date(_DATE * d, const BYTE * data) { struct tm t; /* Prefill entries */ d[0] = NOW_TIME; if (gmtime_r(d, &t) == NULL) { //printf("OW_2date: error1\n"); return gbBAD; } //printf ("_DATE: sec=%d, min=%d, hour=%d, mday=%d, mon=%d, year=%d, wday=%d, isdst=%d\n", t.tm_sec, t.tm_min, t.tm_hour, t.tm_mday, t.tm_mon, t.tm_year, t.tm_wday, t.tm_isdst); #define bcd2dec(x) (((x)&0x70)>>4)*10 + ((x)&0x0F) t.tm_sec = bcd2dec(data[0]); t.tm_min = bcd2dec(data[1]); if (data[2] & 0x40) { // am/pm mode t.tm_hour = ((data[2] & 0x20) ? 12 : 0) + bcd2dec(data[2] & 0x1F); } else { t.tm_hour = bcd2dec(data[2] & 0x2F); } t.tm_mday = bcd2dec(data[3] & 0x2F); t.tm_mon = bcd2dec(data[4] & 0x1F); // should be range 0-11 //The number of years since 1900. t.tm_year = (data[4] & 0x80 ? 100 : 0) + bcd2dec(data[5] & 0xFF); //printf("_DATE_READ data=%2X, %2X, %2X, %2X, %2X, %2X\n", data[0], data[1], data[2], data[3], data[4], data[5]); //printf ("_DATE: sec=%d, min=%d, hour=%d, mday=%d, mon=%d, year=%d, wday=%d, isdst=%d\n", t.tm_sec, t.tm_min, t.tm_hour, t.tm_mday, t.tm_mon, t.tm_year, t.tm_wday, t.tm_isdst); /* Pass through time_t again to validate */ if ((*d = mktime(&t)) == -1) { //printf("2date: error2\n"); return gbBAD; } return gbGOOD; } static GOOD_OR_BAD OW_oscillator(const int on, struct parsedname *pn) { BYTE d; BYTE check; /* Since the DS1923 has a bug and permanently hangs if oscillator is * turned off, I make this real paranoid read/write/read of the * oscillator bit until I know the code really works. */ RETURN_BAD_IF_BAD( OW_r_mem(&d, 1, 0x0212, pn) ); /* Only bit 0 and 1 are used... All other bits should be 0 */ if (d & 0xFC) { return gbBAD; } if (on) { if (d & 0x01) { return gbGOOD; // already on } d |= 0x01; } else { if (!(d & 0x01)) { return gbGOOD; // already off } d &= 0xFE; } RETURN_ERROR_IF_BAD( OW_w_mem(&d, 1, 0x0212, pn) ); RETURN_ERROR_IF_BAD( OW_r_mem(&check, 1, 0x0212, pn) ); if (check != d) { return gbBAD; // failed to change value } UT_delay(1000); // I just want to wait a second and let clock update return gbGOOD; } /* read clock */ static ZERO_OR_ERROR FS_r_date(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_mem(data, 6, 0x0200, PN(owq)) ); return GB_to_Z_OR_E( OW_2date(&OWQ_D(owq), data) ); } /* read clock */ static ZERO_OR_ERROR FS_r_counter(struct one_wire_query *owq) { BYTE data[6]; _DATE d; /* Get date from chip */ RETURN_ERROR_IF_BAD( OW_r_mem(data, 6, 0x0200, PN(owq)) ); RETURN_ERROR_IF_BAD(OW_2date(&d, data)); OWQ_U(owq) = (UINT) d; return 0; } /* set clock */ static ZERO_OR_ERROR FS_w_date(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[6]; /* Busy if in mission */ if ( BAD( OW_MIP(pn))) { //printf("FS_w_date: mip error\n"); return -EBUSY; /* Mission in progress */ } RETURN_ERROR_IF_BAD(OW_oscillator(1, pn)) ; OW_date(&OWQ_D(owq), data); RETURN_ERROR_IF_BAD( OW_w_mem(data, 6, 0x0200, pn) ); OWQ_Y(owq) = 1; // for turning on chip return FS_w_run(owq); } static ZERO_OR_ERROR FS_w_counter(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[6]; _DATE d = (_DATE) OWQ_U(owq); /* Busy if in mission */ if ( BAD( OW_MIP(pn)) ) { return -EBUSY; /* Mission in progress */ } OW_date(&d, data); return GB_to_Z_OR_E( OW_w_mem(data, 6, 0x0200, pn) ) ; } static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 1 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; BYTE passwd[8]; int rest = 32 - (offset & 0x1F); struct transaction_log t_scratch[] = { TRXN_START, TRXN_WRITE(p,3+rest), TRXN_END, } ; struct transaction_log t_check[] = { TRXN_START, TRXN_WR_CRC16(p,1,3+rest), TRXN_COMPARE(&p[4],data,size), TRXN_END, }; struct transaction_log t_write[] = { TRXN_START, TRXN_WRITE(p,4), TRXN_WRITE(passwd,8), TRXN_DELAY(1) , TRXN_END, }; memset(passwd, 0xFF, 8); // dummy password memcpy(&p[3], data, size); RETURN_BAD_IF_BAD( BUS_transaction(t_scratch,pn) ) ; /* Re-read scratchpad and compare */ /* Note: location of data has now shifted down a byte for E/S register */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD( BUS_transaction(t_check,pn) ) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD_WITH_PASSWORD; RETURN_BAD_IF_BAD( BUS_transaction(t_write,pn) ) ; return gbGOOD; } static GOOD_OR_BAD OW_clearmemory(struct parsedname *pn) { BYTE p[3 + 8 + 32 + 2] = { _1W_CLEAR_MEMORY_WITH_PASSWORD, }; BYTE r; struct transaction_log t[] = { TRXN_START , TRXN_WRITE(p,10), TRXN_DELAY(1), TRXN_END , } ; memset(&p[1], 0xFF, 8); // password p[9] = 0xFF; // dummy byte RETURN_BAD_IF_BAD( BUS_transaction(t,pn) ) ; RETURN_BAD_IF_BAD( OW_r_mem(&r, 1, 0x0215, pn) ); LEVEL_DEBUG("Read 0x0215: MEMCLR=%d %02X", (r & 0x08 ? 1 : 0), r); return gbGOOD; } // At most one page static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 32 + 2] = { _1W_READ_MEMORY_WITH_PASSWORD_AND_CRC, LOW_HIGH_ADDRESS(offset), }; int rest = 32 - (offset & 0x1F); BYTE passwd[8]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_WRITE(passwd,8), TRXN_READ(&p[3],rest+2), TRXN_CRC16(p,3+rest+2), TRXN_END, }; memset(passwd, 0xFF, 8); // dummy password //printf("OW_r_mem: size=%lX offset=%lX %02X %02X %02X\n", size, offset, p[0], p[1], p[2]); RETURN_BAD_IF_BAD( BUS_transaction( t, pn) ) ; memcpy(data, &p[3], size); return gbGOOD; } /* many things are disallowed if mission in progress */ /* returns 1 if MIP, 0 if not, <0 if error */ static GOOD_OR_BAD OW_MIP(struct parsedname *pn) { BYTE data; RETURN_BAD_IF_BAD( OW_r_mem(&data, 1, 0x0215, pn) ); /* read status register */ if (UT_getbit(&data, 1)) { return gbBAD; } return gbGOOD; } /* set clock */ static void OW_date(const _DATE * d, BYTE * data) { struct tm tm; int year; /* Convert time format */ gmtime_r(d, &tm); data[0] = tm.tm_sec + 6 * (tm.tm_sec / 10); /* dec->bcd */ data[1] = tm.tm_min + 6 * (tm.tm_min / 10); /* dec->bcd */ data[2] = tm.tm_hour + 6 * (tm.tm_hour / 10); /* dec->bcd */ data[3] = tm.tm_mday + 6 * (tm.tm_mday / 10); /* dec->bcd */ data[4] = tm.tm_mon + 6 * (tm.tm_mon / 10); /* dec->bcd */ year = tm.tm_year % 100; data[5] = year + 6 * (year / 10); /* dec->bcd */ if (tm.tm_year > 99 && tm.tm_year < 200) { data[4] |= 0x80; } //printf("_DATE_WRITE data=%2X, %2X, %2X, %2X, %2X, %2X\n",data[0],data[1],data[2],data[3],data[4],data[5]); //printf("_DATE: sec=%d, min=%d, hour=%d, mday=%d, mon=%d, year=%d, wday=%d, isdst=%d\n",tm.tm_sec,tm.tm_min,tm.tm_hour,tm.tm_mday,tm.tm_mon,tm.tm_year,tm.tm_wday,tm.tm_isdst) ; } static GOOD_OR_BAD OW_force_conversion(const UINT delay, struct parsedname *pn) { BYTE p[2] = { _1W_FORCED_CONVERSION, _1W_FORCED_CONVERSION_START }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(p), TRXN_DELAY(delay), TRXN_END, } ; RETURN_BAD_IF_BAD(OW_oscillator(1, pn)); /* Mission not progress, force conversion */ return BUS_transaction(t,pn) ; } static GOOD_OR_BAD OW_r_temperature(_FLOAT * T, const UINT delay, struct parsedname *pn) { BYTE data[32]; (void) delay; RETURN_BAD_IF_BAD( OW_r_mem(data, 8, 0x020C, pn) ); /* read temp register */ *T = ((_FLOAT) ((BYTE) data[1])) / 2 - 41; if (data[7] & 0x04) { *T += ((_FLOAT) ((BYTE) data[0])) / 512; } return gbGOOD; } static GOOD_OR_BAD OW_r_humid(_FLOAT * H, const UINT delay, struct parsedname *pn) { _FLOAT ADVAL, IVAL; BYTE data[32]; (void) delay; RETURN_BAD_IF_BAD( OW_r_mem(data, 6, 0x020E, pn) ); if (data[5] & 0x08) { // high resolution IVAL = (((BYTE) data[1]) * 256 + (BYTE) data[0]) / 16; ADVAL = (IVAL * 5.02) / 4096; } else { // low resolution ADVAL = ((_FLOAT) ((BYTE) data[1])) * 5.02 / 256; } *H = (ADVAL - 0.958) / 0.0307; return gbGOOD; } static GOOD_OR_BAD OW_stopmission(struct parsedname *pn) { BYTE data[10] = { _1W_STOP_MISSION_WITH_PASSWORD, }; struct transaction_log t[] = { TRXN_START , TRXN_WRITE( data, 10) , TRXN_END , } ; memset(&data[1], 0xFF, 8); // dummy password data[9] = _1W_STOP_MISSION_WITH_PASSWORD_START; return BUS_transaction(t,pn); } static GOOD_OR_BAD OW_startmission(unsigned long mdelay, struct parsedname *pn) { RETURN_BAD_IF_BAD( OW_stopmission(pn) ); RETURN_BAD_IF_BAD( OW_mission_timing(mdelay,pn) ); RETURN_BAD_IF_BAD( OW_clearmemory(pn) ); RETURN_BAD_IF_BAD( OW_mission_default_setup(pn) ) ; RETURN_BAD_IF_BAD( OW_startmission_post_setup(pn) ); return gbGOOD ; } static GOOD_OR_BAD OW_mission_timing(unsigned long mdelay, struct parsedname *pn) { BYTE cc; BYTE start_delay[3] ; if (mdelay == 0) { return gbGOOD; /* stay stopped */ } if (mdelay & 0xFF000000) { return gbBAD; /* Bad interval */ } RETURN_BAD_IF_BAD( OW_r_mem(&cc, 1, 0x0212, pn) ); if (cc & 0xFC) { return -EINVAL; } if (!(cc & 0x01)) { /* clock stopped */ OWQ_allocate_struct_and_pointer(owq_dateset); OWQ_create_temporary(owq_dateset, NULL, 0, 0, pn); OWQ_D(owq_dateset) = NOW_TIME; /* start clock */ if (FS_w_date(owq_dateset)) { return gbBAD; /* set the clock to current time */ } UT_delay(1000); /* wait for the clock to count a second */ } if (mdelay >= 15 * 60) { cc |= 0x02; // Enable high speed sample (minute) mdelay = mdelay / 60; } else { cc &= 0xFD; // Enable high speed sample (second) } RETURN_BAD_IF_BAD( OW_w_mem(&cc, 1, 0x0212, pn) ); // mission start delay start_delay[0] = (mdelay & 0xFF); start_delay[1] = (mdelay & 0xFF00) >> 8; start_delay[2] = (mdelay & 0xFF0000) >> 16; return OW_w_mem(start_delay, 3, 0x0216, pn) ; } static GOOD_OR_BAD OW_mission_default_setup( struct parsedname * pn ) { BYTE data = 0x00 ; data |= 0xA0; // Bit 6&7 always set data |= 0x01; // start Temp logging data |= 0x02; // start Humidity logging data |= 0x04; // store Temp in high resolution data |= 0x08; // store Humidity in high resolution data |= 0x10; // Rollover and overwrite //data |= 0x20 ; // start mission upon temperature alarm return OW_w_mem(&data, 1, 0x0213, pn); } static GOOD_OR_BAD OW_startmission_post_setup( struct parsedname * pn ) { BYTE p[10] = { _1W_START_MISSION_WITH_PASSWORD, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE(p,10), TRXN_END, } ; memset(&p[1], 0xFF, 8); // dummy password p[9] = _1W_START_MISSION_WITH_PASSWORD_START; // dummy byte return BUS_transaction(t,pn) ; } owfs-2.8p15/module/owlib/src/c/ow_tcp_free.c0000644000175000017500000000156011707143413015665 00000000000000/* $Id: ow_tcp_free.c,v 1.2 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif /* ---------------------------------------------- */ /* raw COM port interface routines */ /* ---------------------------------------------- */ //free serial port and restore attributes /* Called on head of multigroup bus */ void tcp_free(struct connection_in *connection) { if ( SOC(connection)->state == cs_virgin ) { return ; } COM_close( connection ) ; FreeClientAddr( connection ) ; } owfs-2.8p15/module/owlib/src/c/ow_2408.c0000644000175000017500000005514011740076517014505 00000000000000/* $Id: ow_2408.c,v 1.77 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* LCD drivers, two designs Maxim / AAG uses 7 PIO pins based on Public domain code from Application Note 3286 Hobby-Boards by Eric Vickery Paul, Go right ahead and use it for whatever you want. I just provide it as an example for people who are using the LCD Driver. It originally came from an application that I was working on (and may again) but that particular code is in the public domain now. Let me know if you have any other questions. Eric */ #include #include "owfs_config.h" #include "ow_2408.h" /* ------- Prototypes ----------- */ /* DS2408 switch */ READ_FUNCTION(FS_r_strobe); WRITE_FUNCTION(FS_w_strobe); READ_FUNCTION(FS_r_pio); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_sense); READ_FUNCTION(FS_power); READ_FUNCTION(FS_r_latch); WRITE_FUNCTION(FS_w_latch); READ_FUNCTION(FS_r_s_alarm); WRITE_FUNCTION(FS_w_s_alarm); READ_FUNCTION(FS_r_por); WRITE_FUNCTION(FS_w_por); WRITE_FUNCTION(FS_Mclear); WRITE_FUNCTION(FS_Mhome); WRITE_FUNCTION(FS_Mscreen); WRITE_FUNCTION(FS_Mmessage); WRITE_FUNCTION(FS_Hclear); WRITE_FUNCTION(FS_Hhome); WRITE_FUNCTION(FS_Hscreen); WRITE_FUNCTION(FS_Hscreenyx); WRITE_FUNCTION(FS_Hmessage); WRITE_FUNCTION(FS_Honoff); #define PROPERTY_LENGTH_LCD_MESSAGE 128 /* ------- Structures ----------- */ static struct aggregate A2408 = { 8, ag_numbers, ag_aggregate, }; static struct filetype DS2408[] = { F_STANDARD, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_BITFIELD, &A2408, ft_bitfield, fc_stable, FS_r_pio, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A2408, ft_bitfield, fc_volatile, FS_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"latch", PROPERTY_LENGTH_BITFIELD, &A2408, ft_bitfield, fc_volatile, FS_r_latch, FS_w_latch, VISIBLE, NO_FILETYPE_DATA, }, {"strobe", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_strobe, FS_w_strobe, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_s_alarm, FS_w_s_alarm, VISIBLE, NO_FILETYPE_DATA, }, {"por", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_por, FS_w_por, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_M", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_M/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_Mclear, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_M/home", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_Mhome, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_M/screen", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Mscreen, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_M/message", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Mmessage, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/clear", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_Hclear, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/home", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_Hhome, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/screen", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Hscreen, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/screenyx", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Hscreenyx, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/message", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Hmessage, VISIBLE, NO_FILETYPE_DATA, }, {"LCD_H/onoff", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, NO_READ_FUNCTION, FS_Honoff, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(29, DS2408, DEV_alarm | DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_READ_PIO_REGISTERS 0xF0 #define _1W_CHANNEL_ACCESS_READ 0xF5 #define _1W_CHANNEL_ACCESS_WRITE 0x5A #define _1W_WRITE_CONDITIONAL_SEARCH_REGISTER 0xCC #define _1W_RESET_ACTIVITY_LATCHES 0xC3 #define _ADDRESS_PIO_LOGIC_STATE 0x0088 #define _ADDRESS_ALARM_REGISTERS 0x008B #define _ADDRESS_CONTROL_STATUS_REGISTER 0x008D /* Internal properties */ Make_SlaveSpecificTag(INI, fc_stable); // LCD screen initialized? /* Nibbles for LCD controller */ #define LCD_DATA_FLAG 0x08 #define NIBBLE_ONE(x) ((x)&0xF0) #define NIBBLE_TWO(x) (((x)<<4)&0xF0) #define NIBBLE_CTRL( x ) NIBBLE_ONE(x) , NIBBLE_TWO(x) #define NIBBLE_DATA( x ) NIBBLE_ONE(x)|LCD_DATA_FLAG , NIBBLE_TWO(x)|LCD_DATA_FLAG /* ------- Functions ------------ */ /* DS2408 */ static GOOD_OR_BAD OW_w_control(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_c_latch(const struct parsedname *pn); static GOOD_OR_BAD OW_w_pio(const BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_reg(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_s_alarm(const BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_pios(const BYTE * data, const size_t size, const struct parsedname *pn); /* 2408 switch */ /* 2408 switch -- is Vcc powered?*/ static ZERO_OR_ERROR FS_power(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ); OWQ_Y(owq) = UT_getbit(&data[5], 7); return 0; } static ZERO_OR_ERROR FS_r_strobe(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ); OWQ_Y(owq) = UT_getbit(&data[5], 2); return 0; } static ZERO_OR_ERROR FS_w_strobe(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, pn) ); UT_setbit(&data[5], 2, OWQ_Y(owq)); return GB_to_Z_OR_E( OW_w_control(data[5], pn) ) ; } static ZERO_OR_ERROR FS_Mclear(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int init = 1; if ( BAD( Cache_Get_SlaveSpecific(&init, sizeof(init), SlaveSpecificTag(INI), pn)) ) { OWQ_Y(owq) = 1; if ( FS_r_strobe(owq) != 0 ) { // set reset pin to strobe mode return -EINVAL; } RETURN_ERROR_IF_BAD( OW_w_pio(0x30, pn) ); UT_delay(100); // init RETURN_ERROR_IF_BAD( OW_w_pio(0x38, pn) ) ; UT_delay(10); // Enable Display, Cursor, and Blinking // Entry-mode: auto-increment, no shift RETURN_ERROR_IF_BAD( OW_w_pio(0x0F, pn) ) ; RETURN_ERROR_IF_BAD( OW_w_pio(0x06, pn) ) ; Cache_Add_SlaveSpecific(&init, sizeof(init), SlaveSpecificTag(INI), pn); } // clear RETURN_ERROR_IF_BAD( OW_w_pio(0x01, pn) ); UT_delay(2); return FS_Mhome(owq); } static ZERO_OR_ERROR FS_Mhome(struct one_wire_query *owq) { // home RETURN_ERROR_IF_BAD( OW_w_pio(0x02, PN(owq)) ); UT_delay(2); return 0; } static ZERO_OR_ERROR FS_Mscreen(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); size_t size = OWQ_size(owq); BYTE data[size]; size_t i; for (i = 0; i < size; ++i) { // no upper ascii chars if (OWQ_buffer(owq)[i] & 0x80) { return -EINVAL; } data[i] = OWQ_buffer(owq)[i] | 0x80; } return GB_to_Z_OR_E( OW_w_pios(data, size, pn) ) ; } static ZERO_OR_ERROR FS_Mmessage(struct one_wire_query *owq) { if (FS_Mclear(owq)) { return -EINVAL; } return FS_Mscreen(owq); } /* 2408 switch PIO sensed*/ /* From register 0x88 */ static ZERO_OR_ERROR FS_sense(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ) ; OWQ_U(owq) = data[0]; return 0; } /* 2408 switch PIO set*/ /* From register 0x89 */ static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ) ; OWQ_U(owq) = BYTE_INVERSE(data[1]); /* reverse bits */ return 0; } /* 2408 switch PIO change*/ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { BYTE data = BYTE_INVERSE(OWQ_U(owq)) & 0xFF ; /* reverse bits */ return GB_to_Z_OR_E(OW_w_pio(data, PN(owq))) ; } /* 2408 read activity latch */ /* From register 0x8A */ static ZERO_OR_ERROR FS_r_latch(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ); OWQ_U(owq) = data[2]; return 0; } /* 2408 write activity latch */ /* Actually resets them all */ static ZERO_OR_ERROR FS_w_latch(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_c_latch(PN(owq))) ; } /* 2408 alarm settings*/ /* From registers 0x8B-0x8D */ static ZERO_OR_ERROR FS_r_s_alarm(struct one_wire_query *owq) { BYTE d[6]; int i, p; UINT U; RETURN_ERROR_IF_BAD( OW_r_reg(d, PN(owq)) ); /* register 0x8D */ U = (d[5] & 0x03) * 100000000; /* registers 0x8B and 0x8C */ for (i = 0, p = 1; i < 8; ++i, p *= 10) { U += UT_getbit(&d[3], i) | (UT_getbit(&d[4], i) << 1) * p; } OWQ_U(owq) = U; return 0; } /* 2408 alarm settings*/ /* First digit source and logic data[2] */ /* next 8 channels */ /* data[1] polarity */ /* data[0] selection */ static ZERO_OR_ERROR FS_w_s_alarm(struct one_wire_query *owq) { BYTE data[3]; int i; UINT p; UINT U = OWQ_U(owq); for (i = 0, p = 1; i < 8; ++i, p *= 10) { UT_setbit(&data[1], i, ((int) (U / p) % 10) & 0x01); UT_setbit(&data[0], i, (((int) (U / p) % 10) & 0x02) >> 1); } data[2] = ((U / 100000000) % 10) & 0x03; return GB_to_Z_OR_E(OW_w_s_alarm(data, PN(owq))) ; } static ZERO_OR_ERROR FS_r_por(struct one_wire_query *owq) { BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, PN(owq)) ); OWQ_Y(owq) = UT_getbit(&data[5], 3); return 0; } static ZERO_OR_ERROR FS_w_por(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[6]; RETURN_ERROR_IF_BAD( OW_r_reg(data, pn) ); UT_setbit(&data[5], 3, OWQ_Y(owq)); return GB_to_Z_OR_E( OW_w_control(data[5], pn) ) ; } #define LCD_SECOND_ROW_ADDRESS 0x40 #define LCD_COMMAND_CLEAR_DISPLAY 0x01 #define LCD_COMMAND_RETURN_HOME 0x02 #define LCD_COMMAND_RIGHT_TO_LEFT 0x06 #define LCD_COMMAND_DISPLAY_ON 0x0C #define LCD_COMMAND_DISPLAY_OFF 0x08 #define LCD_COMMAND_4_BIT 0x20 #define LCD_COMMAND_4_BIT_2_LINES 0x28 #define LCD_COMMAND_ATTENTION 0x30 #define LCD_COMMAND_SET_DDRAM_ADDRESS 0x80 // structure holding the information to be placed on the LCD screen struct yx { int y ; // row int x ; // column char * string ; // input string including coordinates size_t length ; // length of string int text_start ; // counter into string } ; static GOOD_OR_BAD Parseyx( struct yx * YX ) ; static GOOD_OR_BAD binaryyx( struct yx * YX ) ; static GOOD_OR_BAD asciiyx( struct yx * YX ) ; static GOOD_OR_BAD OW_Hprintyx(struct yx * YX, struct parsedname * pn) ; static GOOD_OR_BAD OW_Hinit(struct parsedname * pn) ; #define LCD_LINE_START 1 #define LCD_LINE_END 20 #define LCD_FIRST_ROW 1 #define LCD_LAST_ROW 4 #define LCD_SAME_LOCATION_VALUE 0 // Clear the display after potential initialization static ZERO_OR_ERROR FS_Hclear(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE clear[] = { NIBBLE_CTRL(LCD_COMMAND_CLEAR_DISPLAY), NIBBLE_CTRL(LCD_COMMAND_DISPLAY_ON), NIBBLE_CTRL(LCD_COMMAND_RIGHT_TO_LEFT), }; if ( BAD( OW_Hinit(pn) ) ) { LEVEL_DEBUG("Screen initialization error"); return -EINVAL ; } return GB_to_Z_OR_E(OW_w_pios(clear, 6, pn)) ; } static GOOD_OR_BAD OW_Hinit(struct parsedname * pn) { int init = 1; // clear, display on, mode BYTE start[] = { LCD_COMMAND_ATTENTION, }; BYTE next[] = { LCD_COMMAND_ATTENTION, LCD_COMMAND_ATTENTION, LCD_COMMAND_4_BIT, NIBBLE_CTRL(LCD_COMMAND_4_BIT_2_LINES), }; BYTE data[6]; // already done? RETURN_GOOD_IF_GOOD( Cache_Get_SlaveSpecific(&init, sizeof(init), SlaveSpecificTag(INI), pn) ) if ( BAD( OW_w_control(0x04, pn) ) // strobe || BAD( OW_r_reg(data, pn) ) ) { LEVEL_DEBUG("Trouble sending strobe to Hobbyboard LCD") ; return gbBAD; } if ( data[5] != 0x84 ) { LEVEL_DEBUG("LCD is not powered"); // not powered return gbBAD ; } if ( BAD( OW_c_latch(pn) ) ) { LEVEL_DEBUG("Trouble clearing latches") ; return gbBAD ; }// clear PIOs if ( BAD( OW_w_pios(start, 1, pn) ) ) { LEVEL_DEBUG("Error sending initial attention"); return gbBAD; } UT_delay(5); if ( BAD( OW_w_pios(next, 5, pn) ) ) { LEVEL_DEBUG("Error sending setup commands"); return gbBAD; } Cache_Add_SlaveSpecific(&init, sizeof(init), SlaveSpecificTag(INI), pn); return gbGOOD ; } static GOOD_OR_BAD Parseyx( struct yx * YX ) { if ( YX->length < 2 ) { // not long enough to have an address LEVEL_DEBUG("String too short to contain the location (%d bytes)",YX->length); return gbBAD ; } if ( YX->string[0] > '0' ) { // ascii address rather than binary return asciiyx(YX); } return binaryyx( YX ) ; } // Extract coordinates from binary string and point coordinates. string and length already set. static GOOD_OR_BAD binaryyx( struct yx * YX ) { YX->y = YX->string[0] ; YX->x = YX->string[1] ; YX->text_start = 2 ; return gbGOOD ; // next char } // Extract coordinates from ascii string and point past colon. string and length already set. static GOOD_OR_BAD asciiyx( struct yx * YX ) { char * colon = memchr( YX->string, ':', YX->length ) ; // position of mandatory colon if ( colon==NULL ) { LEVEL_DEBUG("No colon in screen text location. Should be 'y.x:text'"); return gbBAD ; } if ( sscanf(YX->string, "%d,%d:", &YX->y, &YX->x ) < 2 ) { // only one value. Set row=1 YX->y = 1 ; if ( sscanf(YX->string, "%d:", &YX->x ) < 1 ) { LEVEL_DEBUG("Ascii string location not valid"); return gbBAD ; } } // start text after colon YX->text_start = ( colon - YX->string ) + 1 ; return gbGOOD ; } // put in home position static ZERO_OR_ERROR FS_Hhome(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct yx YX = { 1, 1, "", 0, 0 } ; RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ; return GB_to_Z_OR_E( OW_Hprintyx(&YX, pn) ); } // Print from home position static ZERO_OR_ERROR FS_Hmessage(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct yx YX = { 1, 1, OWQ_buffer(owq), OWQ_size(owq), 0 } ; RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ; if (FS_Hclear(owq) != 0) { return -EINVAL; } return GB_to_Z_OR_E( OW_Hprintyx(&YX, pn) ); } // print from current position static ZERO_OR_ERROR FS_Hscreen(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); // y=0 is flag to do no position setting struct yx YX = { LCD_SAME_LOCATION_VALUE, LCD_SAME_LOCATION_VALUE, OWQ_buffer(owq), OWQ_size(owq), 0 } ; RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ; return GB_to_Z_OR_E( OW_Hprintyx(&YX, pn) ); } // print from specified positionh -- // either in ascii format "y.x:text" or "x:text" // or binary (first 2 bytes are y and x) static ZERO_OR_ERROR FS_Hscreenyx(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct yx YX = { 0, 0, OWQ_buffer(owq), OWQ_size(owq), 0 } ; RETURN_ERROR_IF_BAD( Parseyx( &YX ) ) ; RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ; return GB_to_Z_OR_E( OW_Hprintyx(&YX, pn) ); } // YX structure is set with y,x,string,length, and start position of text // Fix from Klaus, dr Tiger static GOOD_OR_BAD OW_Hprintyx(struct yx * YX, struct parsedname * pn) { BYTE translated_data[2 + 2 * (YX->length-YX->text_start)]; size_t original_index ; size_t translate_index = 0; int Valid_YX = ( YX->x <= LCD_LINE_END && YX->y <= LCD_LAST_ROW && YX->x >= LCD_LINE_START && YX->y >= LCD_FIRST_ROW ) ; int Continue_YX = ( YX->y == LCD_SAME_LOCATION_VALUE || YX->x == LCD_SAME_LOCATION_VALUE ) ; if ( Valid_YX ) { BYTE chip_command ; switch (YX->y) { // row value case 1: chip_command = LCD_COMMAND_SET_DDRAM_ADDRESS; break; case 2: chip_command = LCD_COMMAND_SET_DDRAM_ADDRESS + LCD_SECOND_ROW_ADDRESS; break; case 3: chip_command = LCD_COMMAND_SET_DDRAM_ADDRESS + LCD_LINE_END; break; case 4: chip_command = (LCD_COMMAND_SET_DDRAM_ADDRESS + LCD_SECOND_ROW_ADDRESS) + LCD_LINE_END; break; default: LEVEL_DEBUG("Unrecognized row %d",YX->y) ; return gbBAD ; } chip_command += YX->x - 1; // add column (0 index) // Initial location (2 half bytes) translated_data[translate_index++] = NIBBLE_ONE(chip_command); translated_data[translate_index++] = NIBBLE_TWO(chip_command); } else if ( !Continue_YX ) { LEVEL_DEBUG("Bad screen coordinates y=%d x=%d",YX->y,YX->x); return gbBAD; } //printf("Hscreen test<%*s>\n",(int)size,buf) ; for ( original_index = YX->text_start ; original_index < YX->length ; ++original_index ) { if (YX->string[original_index]) { translated_data[translate_index++] = NIBBLE_ONE(YX->string[original_index]) | LCD_DATA_FLAG; translated_data[translate_index++] = NIBBLE_TWO(YX->string[original_index]) | LCD_DATA_FLAG; } else { //null byte becomes space translated_data[translate_index++] = NIBBLE_ONE(' ') | LCD_DATA_FLAG; translated_data[translate_index++] = NIBBLE_TWO(' ') | LCD_DATA_FLAG; } } LEVEL_DEBUG("Print the message"); return OW_w_pios(translated_data, translate_index, pn) ; } // 0x01 => blinking cursor on // 0x02 => cursor on // 0x04 => display on static ZERO_OR_ERROR FS_Honoff(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE onoff[] = { NIBBLE_DATA(OWQ_U(owq)) }; RETURN_ERROR_IF_BAD( OW_Hinit(pn) ) ; // onoff if ( BAD( OW_w_pios(onoff, 2, pn) ) ) { LEVEL_DEBUG("Error setting LCD state"); return -EINVAL; } return 0; } /* Read 6 bytes -- 0x88 PIO logic State 0x89 PIO output Latch state 0x8A PIO Activity Latch 0x8B Conditional Ch Mask 0x8C Londitional Ch Polarity 0x8D Control/Status plus 2 more bytes to get to the end of the page and qualify for a CRC16 checksum */ static GOOD_OR_BAD OW_r_reg(BYTE * data, const struct parsedname *pn) { BYTE p[3 + 8 + 2] = { _1W_READ_PIO_REGISTERS, LOW_HIGH_ADDRESS(_ADDRESS_PIO_LOGIC_STATE), }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 8), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; memcpy(data, &p[3], 6); return gbGOOD; } static GOOD_OR_BAD OW_w_pio(const BYTE data, const struct parsedname *pn) { BYTE write_string[] = { _1W_CHANNEL_ACCESS_WRITE, data, (BYTE) ~ data, }; BYTE read_back[2]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(write_string), TRXN_READ2(read_back), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; if (read_back[0] != 0xAA) { return gbBAD; } /* Ignore byte 5 read_back[1] the PIO status byte */ return gbGOOD; } /* Send several bytes to the channel */ static GOOD_OR_BAD OW_w_pios(const BYTE * data, const size_t size, const struct parsedname *pn) { BYTE cmd[] = { _1W_CHANNEL_ACCESS_WRITE, }; size_t formatted_size = 4 * size; BYTE formatted_data[formatted_size]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(cmd), TRXN_MODIFY(formatted_data, formatted_data, formatted_size), TRXN_END, }; size_t i; // setup the array // each byte takes 4 bytes after formatting for (i = 0; i < size; ++i) { int formatted_data_index = 4 * i; formatted_data[formatted_data_index + 0] = data[i]; formatted_data[formatted_data_index + 1] = (BYTE) ~ data[i]; formatted_data[formatted_data_index + 2] = 0xFF; formatted_data[formatted_data_index + 3] = 0xFF; } RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; for (i = 0; i < size; ++i) { int formatted_data_index = 4 * i; BYTE rdata = ((BYTE)~data[i]); // get rid of warning: comparison of promoted ~unsigned with unsigned if (formatted_data[formatted_data_index + 0] != data[i]) { return gbBAD; } if (formatted_data[formatted_data_index + 1] != rdata) { return gbBAD; } if (formatted_data[formatted_data_index + 2] != 0xAA) { return gbBAD; } if (formatted_data[formatted_data_index + 3] != data[i]) { return gbBAD; } } return gbGOOD; } /* Reset activity latch */ static GOOD_OR_BAD OW_c_latch(const struct parsedname *pn) { BYTE reset_string[] = { _1W_RESET_ACTIVITY_LATCHES, }; BYTE read_back[1]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(reset_string), TRXN_READ1(read_back), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; if (read_back[0] != 0xAA) { return gbBAD; } return gbGOOD; } /* Write control/status */ static GOOD_OR_BAD OW_w_control(const BYTE data, const struct parsedname *pn) { BYTE write_string[1 + 2 + 1] = { _1W_WRITE_CONDITIONAL_SEARCH_REGISTER, LOW_HIGH_ADDRESS(_ADDRESS_CONTROL_STATUS_REGISTER), data, }; BYTE check_string[1 + 2 + 3 + 2] = { _1W_READ_PIO_REGISTERS, LOW_HIGH_ADDRESS(_ADDRESS_CONTROL_STATUS_REGISTER), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE(write_string, 4), /* Read registers */ TRXN_START, TRXN_WR_CRC16(check_string, 3, 3), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; return ((data & 0x0F) != (check_string[3] & 0x0F)) ? gbBAD : gbGOOD ; } /* write alarm settings */ static GOOD_OR_BAD OW_w_s_alarm(const BYTE * data, const struct parsedname *pn) { BYTE old_register[6]; BYTE new_register[6]; BYTE control_value[1]; BYTE alarm_access[] = { _1W_WRITE_CONDITIONAL_SEARCH_REGISTER, LOW_HIGH_ADDRESS(_ADDRESS_ALARM_REGISTERS), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(alarm_access), TRXN_WRITE2(data), TRXN_WRITE1(control_value), TRXN_END, }; // get the existing register contents RETURN_BAD_IF_BAD( OW_r_reg(old_register, pn) ) ; control_value[0] = (data[2] & 0x03) | (old_register[5] & 0x0C); RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; /* Re-Read registers */ RETURN_BAD_IF_BAD(OW_r_reg(new_register, pn)) ; return (data[0] != new_register[3]) || (data[1] != new_register[4]) || (control_value[0] != (new_register[5] & 0x0F)) ? gbBAD : gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_lib_stop.c0000644000175000017500000000216511741156523015717 00000000000000/* $Id: ow_lib_stop.c,v 1.9 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" static void no_op( void * v ) { (void) v ; } /* Just close in/out devices and clear cache. Just enough to make it possible to call LibStart() again. This is called from swig/ow.i to when script wants to initialize a new server-connection. */ void LibStop(void) { char *argv[1] = { NULL }; LEVEL_CALL("Clear Cache"); Cache_Clear(); LEVEL_CALL("Closing input devices"); FreeInAll(); LEVEL_CALL("Closing outout devices"); FreeOutAll(); /* Have to reset more internal variables, and this should be fixed * by setting optind = 0 and call getopt() * (first_nonopt = last_nonopt = 1;) */ optind = 0; (void) getopt_long(1, argv, " ", NULL, NULL); optarg = NULL; optind = 1; opterr = 1; optopt = '?'; } owfs-2.8p15/module/owlib/src/c/ow_w1_monitor.c0000644000175000017500000000605411664035317016204 00000000000000/* $Id: ow_w1_monitor.c,v 1.15 2011/11/26 01:03:11 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #if OW_W1 && OW_MT #include "ow_w1.h" static void W1_monitor_close(struct connection_in *in); static GOOD_OR_BAD w1_monitor_in_use(const struct connection_in * in_selected) ; /* Device-specific functions */ GOOD_OR_BAD W1_monitor_detect(struct connection_in *in) { struct timeval tvslack = { 1, 0 } ; // 1 second SOC(in)->file_descriptor = FILE_DESCRIPTOR_BAD; SOC(in)->type = ct_none ; in->iroutines.detect = W1_monitor_detect; in->Adapter = adapter_w1_monitor; /* OWFS assigned value */ in->iroutines.reset = NO_RESET_ROUTINE; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = W1_monitor_close; in->iroutines.flags = ADAP_FLAG_sham; in->adapter_name = "W1 monitor"; in->busmode = bus_w1_monitor ; RETURN_BAD_IF_BAD( w1_monitor_in_use(in) ) ; // Initial setup Inbound_Control.w1_monitor = in ; // essentially a global pointer to the w1_monitor entry _MUTEX_INIT(in->master.w1_monitor.seq_mutex); _MUTEX_INIT(in->master.w1_monitor.read_mutex); timernow( &(in->master.w1_monitor.last_read) ); timeradd( &(in->master.w1_monitor.last_read), &tvslack, &(in->master.w1_monitor.last_read) ); in->master.w1_monitor.seq = SEQ_INIT ; in->master.w1_monitor.pid = 0 ; w1_bind(in) ; // sets in->file_descriptor if ( FILE_DESCRIPTOR_NOT_VALID( SOC(in)->file_descriptor ) ) { ERROR_DEBUG("Netlink problem -- are you root?"); Inbound_Control.w1_monitor = NO_CONNECTION ; return gbBAD ; } return W1_Browse() ; // creates thread that runs forever. } // is there already a W! monitor in the Inbound list? You only need one. static GOOD_OR_BAD w1_monitor_in_use(const struct connection_in * in_selected) { struct connection_in *in; for (in = Inbound_Control.head; in != NO_CONNECTION; in = in->next) { if ( in == in_selected ) { continue ; } if ( in->busmode != bus_w1_monitor ) { continue ; } return gbBAD ; } return gbGOOD; // not found in the current inbound list } static void W1_monitor_close(struct connection_in *in) { _MUTEX_DESTROY(in->master.w1_monitor.seq_mutex); _MUTEX_DESTROY(in->master.w1_monitor.read_mutex); } #else /* OW_W1 && OW_MT */ GOOD_OR_BAD W1_monitor_detect(struct connection_in *in) { (void) in ; LEVEL_DEFAULT("W1 (the linux kernel 1-wire system) is not supported"); return gbBAD ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_badadapter.c0000664000175000017500000000434111503546662016176 00000000000000/* $Id: ow_badadapter.c,v 1.39 2010/12/20 03:29:54 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" /* All the rest of the program sees is the BadAdapter_detect and the entry in iroutines */ static RESET_TYPE BadAdapter_reset(const struct parsedname *pn); static GOOD_OR_BAD BadAdapter_sendback_bits(const BYTE * data, BYTE * resp, size_t len, const struct parsedname *pn); static void BadAdapter_close(struct connection_in *in); /* Device-specific functions */ /* Note, the "Bad"adapter" ha not function, and returns "-ENOTSUP" (not supported) for most functions */ /* It does call lower level functions for higher ones, which of course is pointless since the lower ones don't work either */ GOOD_OR_BAD BadAdapter_detect(struct connection_in *in) { SOC(in)->type = ct_none ; SOC(in)->file_descriptor = FILE_DESCRIPTOR_BAD ; in->Adapter = adapter_Bad; /* OWFS assigned value */ in->iroutines.reset = BadAdapter_reset; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_bits = BadAdapter_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = BadAdapter_close; in->iroutines.flags = ADAP_FLAG_sham; in->adapter_name = "Bad Adapter"; SAFEFREE( SOC(in)->devicename ) ; SOC(in)->devicename = owstrdup("None") ; in->busmode = bus_bad ; return gbGOOD; } static RESET_TYPE BadAdapter_reset(const struct parsedname *pn) { (void) pn; return BUS_RESET_ERROR; } static GOOD_OR_BAD BadAdapter_sendback_bits(const BYTE * data, BYTE * resp, size_t len, const struct parsedname *pn) { (void) pn; (void) data; (void) resp; (void) len; return gbBAD; } static void BadAdapter_close(struct connection_in *in) { (void) in; } owfs-2.8p15/module/owlib/src/c/ow_external.c0000644000175000017500000000253711742352454015733 00000000000000/* $Id: ow_external.c,v 1.3 2012/04/14 19:51:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" #include "ow_external.h" static void External_setroutines(struct connection_in *in); static void External_setroutines(struct connection_in *in) { in->iroutines.detect = External_detect; in->iroutines.reset = NO_RESET_ROUTINE ; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE ; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE ; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = NO_CLOSE_ROUTINE; in->iroutines.flags = 0 ; in->bundling_length = 1; } GOOD_OR_BAD External_detect(struct connection_in *in) { External_setroutines(in); in->Adapter = adapter_external; in->adapter_name = "External"; return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_arg.c0000644000175000017500000002230611741156523014654 00000000000000/* $Id: ow_arg.c,v 1.21 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" enum arg_address { arg_addr_device, arg_addr_null, arg_addr_ip, arg_addr_colon, arg_addr_number, arg_addr_other } ; static enum arg_address ArgType( const char * arg ) { if ( arg == NULL ) { return arg_addr_null ; } else if ( strchr( arg, '/' ) ) { return arg_addr_device ; } else if ( strchr( arg, ':' ) ) { return arg_addr_colon ; } else if ( strspn( arg, "0123456789" ) == strlen(arg) ) { return arg_addr_number ; } else if ( strchr( arg, '.' ) && strchr( strchr( arg, '.' ), '.' ) && strchr( strchr( strchr( arg, '.' ), '.' ), '.' ) && strchr( strchr( strchr( strchr( arg, '.' ), '.' ), '.' ), '.' ) ) { return arg_addr_ip ; } return arg_addr_other ; } // Test whether address is a serial port, or a serial over telnet (ser2net) static GOOD_OR_BAD Serial_or_telnet( const char * arg, struct connection_in * in ) { switch( ArgType(arg) ) { case arg_addr_null: LEVEL_DEFAULT("Error with device. Specify a serial port, or a serial-over-telnet network address"); return gbBAD ; case arg_addr_device: SOC(in)->type = ct_serial ; // serial port break ; case arg_addr_number: // port case arg_addr_colon: case arg_addr_ip: case arg_addr_other: SOC(in)->type = ct_telnet ; // network break ; } return gbGOOD; } GOOD_OR_BAD ARG_Device(const char *arg) { struct stat sbuf; if (stat(arg, &sbuf)) { switch( ArgType(arg) ) { case arg_addr_number: // port case arg_addr_colon: case arg_addr_ip: case arg_addr_other: return ARG_Serial(arg) ; default: LEVEL_DEFAULT("Cannot access device %s", arg); return gbBAD; } } if (!S_ISCHR(sbuf.st_mode)) { LEVEL_DEFAULT("Not a \"character\" device %s (st_mode=%x)", arg, sbuf.st_mode); return gbBAD; } if (major(sbuf.st_rdev) == 99) { return ARG_Parallel(arg); } if (major(sbuf.st_rdev) == 89) { return ARG_I2C(arg); } return ARG_Serial(arg); } GOOD_OR_BAD ARG_EtherWeather(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_etherweather; return gbGOOD; } GOOD_OR_BAD ARG_External(const char *arg) { if ( Inbound_Control.external == NULL ) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = owstrdup("external") ; in->busmode = bus_external; Inbound_Control.external = in ; return gbGOOD; } } GOOD_OR_BAD ARG_Fake(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_fake; return gbGOOD; } GOOD_OR_BAD ARG_Generic(const char *arg) { if (arg && arg[0]) { switch (arg[0]) { case '/': return ARG_Device(arg); case 'u': case 'U': return ARG_USB(&arg[1]); default: return ARG_Net(arg); } } return gbBAD; } GOOD_OR_BAD ARG_HA5( const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } if ( arg == NULL ) { return gbBAD ; } SOC(in)->devicename = owstrdup(arg) ; in->busmode = bus_ha5; return Serial_or_telnet( arg, in ) ; } GOOD_OR_BAD ARG_HA7(const char *arg) { #if OW_HA7 if (arg != NULL) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = owstrdup(arg); in->busmode = bus_ha7net; return gbGOOD; } else { // Try multicast discovery //printf("Find HA7\n"); return FS_FindHA7(); } #else /* OW_HA7 */ LEVEL_DEFAULT("HA7 support (intentionally) not included in compilation. Reconfigure and recompile."); return gbBAD; #endif /* OW_HA7 */ } GOOD_OR_BAD ARG_HA7E(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_ha7e ; return Serial_or_telnet( arg, in ) ; } GOOD_OR_BAD ARG_ENET(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_enet ; return gbGOOD; } GOOD_OR_BAD ARG_I2C(const char *arg) { #if OW_I2C struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : owstrdup(":"); in->busmode = bus_i2c; return gbGOOD; #else /* OW_I2C */ LEVEL_DEFAULT("I2C (smbus DS2482-X00) support (intentionally) not included in compilation. Reconfigure and recompile."); return gbBAD; #endif /* OW_I2C */ } GOOD_OR_BAD ARG_Link(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_link ; // link return Serial_or_telnet( arg, in ) ; } GOOD_OR_BAD ARG_Mock(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_mock; return gbGOOD; } GOOD_OR_BAD ARG_W1_monitor(void) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = owstrdup("W1 bus monitor"); in->busmode = bus_w1_monitor; return gbGOOD; } GOOD_OR_BAD ARG_USB_monitor(const char *arg) { #if OW_USB struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg==NULL) ? NULL : owstrdup(arg); in->busmode = bus_usb_monitor; return gbGOOD; #else fprintf(stderr, "OWFS is compiled without USB support.\n"); return gbBAD; #endif } GOOD_OR_BAD ARG_Browse(void) { #if OW_ZERO struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = owstrdup("ZeroConf monitor"); in->busmode = bus_browse; return gbGOOD; #else fprintf(stderr, "OWFS is compiled without Zeroconf/Bonjour support.\n"); return gbBAD; #endif } GOOD_OR_BAD ARG_Net(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_server; return gbGOOD; } GOOD_OR_BAD ARG_Parallel(const char *arg) { #if OW_PARPORT struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_parallel; return gbGOOD; #else /* OW_PARPORT */ LEVEL_DEFAULT("Parallel port support (intentionally) not included in compilation. For DS1410E. That's ok, it doesn't work anyways."); return gbBAD; #endif /* OW_PARPORT */ } GOOD_OR_BAD ARG_Passive(char *adapter_type_name, const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; // special set name of adapter here in->adapter_name = adapter_type_name; in->busmode = bus_passive ; // DS9097 return Serial_or_telnet( arg, in ) ; } GOOD_OR_BAD ARG_Serial(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_serial ; // DS2480B return Serial_or_telnet( arg, in ) ; } GOOD_OR_BAD ARG_Server(const char *arg) { struct connection_out *out = NewOut(); if (out == NULL) { return gbBAD; } out->name = (arg!=NULL) ? owstrdup(arg) : NULL; return gbGOOD; } GOOD_OR_BAD ARG_Tester(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_tester; return gbGOOD; } // USB is a little more involved -- have to handle the "all" case and the specific number case GOOD_OR_BAD ARG_USB(const char *arg) { #if OW_USB struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } in->busmode = bus_usb; SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; return gbGOOD; #else /* OW_USB */ LEVEL_DEFAULT("USB support (intentionally) not included in compilation. Check LIBUSB, then reconfigure and recompile."); return gbBAD; #endif /* OW_USB */ } // Xport or telnet -- DS2480B over a remote serial server using telnet protocol. GOOD_OR_BAD ARG_Xport(const char *arg) { struct connection_in *in = NewIn(NO_CONNECTION); if (in == NO_CONNECTION) { return gbBAD; } SOC(in)->devicename = (arg!=NULL) ? owstrdup(arg) : NULL; in->busmode = bus_xport; SOC(in)->type = ct_telnet ; // network return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_parseoutput.c0000664000175000017500000002360711435347153016506 00000000000000/* $Id: ow_parseoutput.c,v 1.28 2010/08/26 02:16:11 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor $ID: $ */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ static SIZE_OR_ERROR OWQ_parse_output_integer(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_unsigned(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_float(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_date(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_yesno(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_ascii(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_array_with_commas(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_array_no_commas(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_ascii_array(struct one_wire_query *owq); static SIZE_OR_ERROR OWQ_parse_output_offset_and_size_z(const char *string, struct one_wire_query *owq) ; static SIZE_OR_ERROR OWQ_parse_output_offset_and_size(const char *string, size_t length, struct one_wire_query *owq) ; /* Change in strategy 6/2006: Now use CheckPresence as primary method of finding correct bus Can break down cases into: 1. bad ParsedName -- no read possible 2. structure -- read from 1st bus (local) 3. specified bus (picked up in ParsedName) -- use that 4. statistics, settings, Simultaneous, Thermostat -- use first or specified 5. real -- use caced, if error, delete cache entry and try twice more. */ /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ SIZE_OR_ERROR OWQ_parse_output(struct one_wire_query *owq) { // have to check if offset is beyond the filesize. if (OWQ_offset(owq)) { size_t file_length = 0; file_length = FileLength(PN(owq)); LEVEL_DEBUG("file_length=%lu offset=%lu size=%lu", (unsigned long) file_length, (unsigned long) OWQ_offset(owq), (unsigned long) OWQ_size(owq)); if ((unsigned long) OWQ_offset(owq) >= (unsigned long) file_length) { return 0; // This is data-length } } /* Special case, structure is always ascii */ if (OWQ_pn(owq).type == ePN_structure) { return OWQ_parse_output_ascii(owq); } switch (OWQ_pn(owq).extension) { case EXTENSION_BYTE: return OWQ_parse_output_unsigned(owq); case EXTENSION_ALL: switch (OWQ_pn(owq).selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: return OWQ_parse_output_ascii_array(owq); case ft_binary: return OWQ_parse_output_array_no_commas(owq); default: return OWQ_parse_output_array_with_commas(owq); } default: switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: return OWQ_parse_output_integer(owq); case ft_yesno: case ft_bitfield: return OWQ_parse_output_yesno(owq); case ft_unsigned: return OWQ_parse_output_unsigned(owq); case ft_pressure: case ft_temperature: case ft_tempgap: case ft_float: return OWQ_parse_output_float(owq); case ft_date: return OWQ_parse_output_date(owq); case ft_vascii: case ft_alias: case ft_ascii: case ft_binary: return OWQ_parse_output_ascii(owq); case ft_directory: case ft_subdir: case ft_unknown: return -ENOENT; } } return -EINVAL; // should never be reached if all the cases are truly covered } static SIZE_OR_ERROR OWQ_parse_output_integer(struct one_wire_query *owq) { /* should only need suglen+1, but uClibc's snprintf() seem to trash 'len' if not increased */ int len; char c[PROPERTY_LENGTH_INTEGER + 2]; UCLIBCLOCK; len = snprintf(c, PROPERTY_LENGTH_INTEGER + 1, "%*d", PROPERTY_LENGTH_INTEGER, OWQ_I(owq)); UCLIBCUNLOCK; if ((len < 0) || ((size_t) len > PROPERTY_LENGTH_INTEGER)) { return -EMSGSIZE; } return OWQ_parse_output_offset_and_size(c, PROPERTY_LENGTH_INTEGER, owq); } static SIZE_OR_ERROR OWQ_parse_output_unsigned(struct one_wire_query *owq) { /* should only need suglen+1, but uClibc's snprintf() seem to trash 'len' if not increased */ int len; char c[PROPERTY_LENGTH_UNSIGNED + 2]; UCLIBCLOCK; len = snprintf(c, PROPERTY_LENGTH_UNSIGNED + 1, "%*u", PROPERTY_LENGTH_UNSIGNED, OWQ_U(owq)); UCLIBCUNLOCK; if ((len < 0) || ((size_t) len > PROPERTY_LENGTH_UNSIGNED)) { return -EMSGSIZE; } return OWQ_parse_output_offset_and_size(c, PROPERTY_LENGTH_UNSIGNED, owq); } static SIZE_OR_ERROR OWQ_parse_output_float(struct one_wire_query *owq) { /* should only need suglen+1, but uClibc's snprintf() seem to trash 'len' if not increased */ int len; char c[PROPERTY_LENGTH_FLOAT + 2]; _FLOAT F; switch (OWQ_pn(owq).selected_filetype->format) { case ft_pressure: F = Pressure(OWQ_F(owq), PN(owq)); break; case ft_temperature: F = Temperature(OWQ_F(owq), PN(owq)); break; case ft_tempgap: F = TemperatureGap(OWQ_F(owq), PN(owq)); break; default: F = OWQ_F(owq); break; } UCLIBCLOCK; len = snprintf(c, PROPERTY_LENGTH_FLOAT + 1, "%*G", PROPERTY_LENGTH_FLOAT, F); UCLIBCUNLOCK; if ((len < 0) || ((size_t) len > PROPERTY_LENGTH_FLOAT)) { return -EMSGSIZE; } return OWQ_parse_output_offset_and_size(c, PROPERTY_LENGTH_FLOAT, owq); } static SIZE_OR_ERROR OWQ_parse_output_date(struct one_wire_query *owq) { char c[PROPERTY_LENGTH_DATE + 2]; if (OWQ_size(owq) < PROPERTY_LENGTH_DATE) { return -EMSGSIZE; } ctime_r(&OWQ_D(owq), c); return OWQ_parse_output_offset_and_size(c, PROPERTY_LENGTH_DATE, owq); } static SIZE_OR_ERROR OWQ_parse_output_yesno(struct one_wire_query *owq) { if (OWQ_size(owq) < PROPERTY_LENGTH_YESNO) { return -EMSGSIZE; } OWQ_buffer(owq)[0] = ((OWQ_Y(owq) & 0x1) == 0) ? '0' : '1'; return PROPERTY_LENGTH_YESNO; } ZERO_OR_ERROR OWQ_format_output_offset_and_size_z(const char *string, struct one_wire_query *owq) { SIZE_OR_ERROR ret = OWQ_parse_output_offset_and_size_z(string,owq) ; if ( ret > 0 ) { return 0 ; } return ret ; } ZERO_OR_ERROR OWQ_format_output_offset_and_size(const char *string, size_t length, struct one_wire_query *owq) { SIZE_OR_ERROR ret = OWQ_parse_output_offset_and_size(string,length,owq) ; if ( ret > 0 ) { return 0 ; } return ret ; } static SIZE_OR_ERROR OWQ_parse_output_offset_and_size_z(const char *string, struct one_wire_query *owq) { return OWQ_parse_output_offset_and_size(string, strlen(string), owq); } /* Put a string ionto the OWQ structure and return the length check lengths and offsets as part of the process */ static SIZE_OR_ERROR OWQ_parse_output_offset_and_size(const char *string, size_t length, struct one_wire_query *owq) { size_t copy_length = length; off_t offset = OWQ_offset(owq); Debug_Bytes("OWQ_parse_output_offset_and_size", (const BYTE *) string, length); /* offset is after the length of the string -- return 0 since some conditions a read after the end is done automatically */ if (offset > (off_t) length) { return 0; } /* correct length for offset (cannot be negative because of previous check) */ copy_length -= offset; /* correct length for buffer space */ if (copy_length > OWQ_size(owq)) { copy_length = OWQ_size(owq); } /* and copy */ memcpy(OWQ_buffer(owq), &string[offset], copy_length); // Warning, this will overwrite the I U or DATA value, // but that shouldn't matter since it's only called on ascii values // and all structure values OWQ_length(owq) = copy_length; return copy_length; } static SIZE_OR_ERROR OWQ_parse_output_ascii(struct one_wire_query *owq) { Debug_OWQ(owq); return OWQ_length(owq); } static SIZE_OR_ERROR OWQ_parse_output_array_with_commas(struct one_wire_query *owq) { struct one_wire_query owq_single; size_t extension; int len; size_t used_size = 0; size_t remaining_size = OWQ_size(owq); size_t elements = OWQ_pn(owq).selected_filetype->ag->elements; // loop though all array elements for (extension = 0; extension < elements; ++extension) { //printf("OWQ_parse_output_array_with_commas element=%d, size_used=%d, remaining=%d\n",(int)extension,(int)used_size,(int)remaining_size) ; // Prepare a copy of owq that only points to a single element memcpy(&owq_single, owq, sizeof(owq_single)); OWQ_pn(&owq_single).extension = extension; memcpy(&OWQ_val(&owq_single), &OWQ_array(owq)[extension], sizeof(union value_object)); // add the comma first (if not the first element and enough room) if (used_size > 0) { if (remaining_size == 0) { return -EFAULT; } OWQ_buffer(owq)[used_size] = ','; ++used_size; --remaining_size; } // Now process the single element OWQ_buffer(&owq_single) = &OWQ_buffer(owq)[used_size]; OWQ_size(&owq_single) = remaining_size; len = OWQ_parse_output(&owq_single); // any error aborts if (len < 0) { return len; } remaining_size -= len; used_size += len; } return used_size; } static SIZE_OR_ERROR OWQ_parse_output_ascii_array(struct one_wire_query *owq) { size_t extension; size_t elements = OWQ_pn(owq).selected_filetype->ag->elements; size_t total_length = 0; size_t current_offset = OWQ_array_length(owq, 0); for (extension = 0; extension < elements; ++extension) { total_length += OWQ_array_length(owq, extension); } for (extension = 1; extension < elements; ++extension) { memmove(&OWQ_buffer(owq)[current_offset + 1], &OWQ_buffer(owq)[current_offset], total_length - current_offset); OWQ_buffer(owq)[current_offset] = ','; ++total_length; current_offset += 1 + OWQ_array_length(owq, extension); } return total_length; } static SIZE_OR_ERROR OWQ_parse_output_array_no_commas(struct one_wire_query *owq) { size_t extension; size_t total_length = 0; size_t elements = OWQ_pn(owq).selected_filetype->ag->elements; for (extension = 0; extension < elements; ++extension) { total_length += OWQ_array_length(owq, extension); } return total_length; } owfs-2.8p15/module/owlib/src/c/ow_parseinput.c0000644000175000017500000003355711657112060016301 00000000000000/* $Id: ow_parseinput.c,v 1.23 2011/11/11 03:19:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #define DEFAULT_INPUT_BUFFER_LENGTH 128 /* ------- Prototypes ----------- */ static ZERO_OR_ERROR FS_input_yesno(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_integer(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_unsigned(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_float(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_date(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_ascii(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_array_with_commas(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_ascii_array(struct one_wire_query *owq); static ZERO_OR_ERROR FS_input_array_no_commas(struct one_wire_query *owq); static size_t FS_check_length(struct one_wire_query *owq); /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ /* Note on return values: */ /* Top level FS_write will return size if ok, else a negative number */ /* Each lower level function called will return 0 if ok, else non-zero */ /* Note on size and offset: */ /* Buffer length (and requested data) is size bytes */ /* writing should start after offset bytes in original data */ /* only binary, and ascii data support offset in single data points */ /* only binary supports offset in array data */ /* size and offset are vetted against specification data size and calls */ /* outside of this module will not have buffer overflows */ /* I.e. the rest of owlib can trust size and buffer to be legal */ /* Format of input, Depends on "filetype" type function format Handled as integer strol decimal integer integer array unsigned strou decimal integer unsigned array bitfield strou decimal integer unsigned array yesno strcmp "0" "1" "yes" "no" "on" "off" unsigned array float strod decimal floating point double array date strptime "Jan 01, 1901", etc date array ascii strcpy string without "," or null comma-separated-strings binary memcpy fixed length binary string binary "string" */ // Routines to take write data (ascii representation) and interpret it and place into the proper fields. ZERO_OR_ERROR OWQ_parse_input(struct one_wire_query *owq) { switch (OWQ_pn(owq).extension) { case EXTENSION_BYTE: return FS_input_unsigned(owq); case EXTENSION_ALL: switch (OWQ_pn(owq).selected_filetype->format) { case ft_ascii: case ft_vascii: case ft_alias: return FS_input_ascii_array(owq); case ft_binary: return FS_input_array_no_commas(owq); default: return FS_input_array_with_commas(owq); } default: switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: return FS_input_integer(owq); case ft_yesno: case ft_bitfield: return FS_input_yesno(owq); case ft_unsigned: return FS_input_unsigned(owq); case ft_pressure: case ft_temperature: case ft_tempgap: case ft_float: return FS_input_float(owq); case ft_date: return FS_input_date(owq); case ft_vascii: case ft_alias: case ft_ascii: case ft_binary: return FS_input_ascii(owq); case ft_directory: case ft_subdir: case ft_unknown: return -ENOENT; } } return -EINVAL; // should never be reached if all the cases are truly covered } /* return 0 if ok */ static ZERO_OR_ERROR FS_input_yesno(struct one_wire_query *owq) { char default_input_buffer[DEFAULT_INPUT_BUFFER_LENGTH + 1]; char *input_buffer = default_input_buffer; char *end; int I; ZERO_OR_ERROR ret; /* allocate more space if buffer is really long */ if (OWQ_size(owq) > DEFAULT_INPUT_BUFFER_LENGTH) { input_buffer = owmalloc(OWQ_size(owq) + 1); if (input_buffer == NULL) { RETURN_CODE_RETURN( 79 ) ; // unable to allocate memory } } memcpy(input_buffer, OWQ_buffer(owq), OWQ_size(owq)); input_buffer[OWQ_size(owq)] = '\0'; // make sure null-ended //printf("YESNO: %s\n",input_buffer); errno = 0; I = strtol(input_buffer, &end, 10); if ((errno == 0) && (end != input_buffer)) { // NUMBER? //printf("YESNO number = %d\n",I) ; OWQ_Y(owq) = (I != 0); ret = 0; } else { // WORD? char *non_blank; ret = -EFAULT; //default error until a non-blank found for (non_blank = input_buffer; non_blank[0]; ++non_blank) { if (non_blank[0] != ' ' && non_blank[0] != '\t') { ret = 0; // now assume good if (strncasecmp(non_blank, "y", 1) == 0) { OWQ_Y(owq) = 1; break; } if (strncasecmp(non_blank, "n", 1) == 0) { OWQ_Y(owq) = 0; break; } if (strncasecmp(non_blank, "on", 2) == 0) { OWQ_Y(owq) = 1; break; } if (strncasecmp(non_blank, "off", 3) == 0) { OWQ_Y(owq) = 0; break; } ret = -EINVAL; break; } } } /* free specially long buffer */ if (input_buffer != default_input_buffer) { owfree(input_buffer); } return ret; } /* parse a value for write from buffer to value_object */ /* return 0 if ok */ static ZERO_OR_ERROR FS_input_integer(struct one_wire_query *owq) { char default_input_buffer[DEFAULT_INPUT_BUFFER_LENGTH + 1]; char *input_buffer = default_input_buffer; char *end; /* allocate more space if buffer is really long */ if (OWQ_size(owq) > DEFAULT_INPUT_BUFFER_LENGTH) { input_buffer = owmalloc(OWQ_size(owq) + 1); if (input_buffer == NULL) { return -ENOMEM; } } memcpy(input_buffer, OWQ_buffer(owq), OWQ_size(owq)); input_buffer[OWQ_size(owq)] = '\0'; // make sure null-ended errno = 0; OWQ_I(owq) = strtol(input_buffer, &end, 10); /* free specially long buffer */ if (input_buffer != default_input_buffer) owfree(input_buffer); if (errno) { return -errno; // conversion error } if (end == input_buffer) { return -EINVAL; // nothing valid found for conversion } return 0; // good return } /* parse a value for write from buffer to value_object */ /* return 0 if ok */ static ZERO_OR_ERROR FS_input_unsigned(struct one_wire_query *owq) { char default_input_buffer[DEFAULT_INPUT_BUFFER_LENGTH + 1]; char *input_buffer = default_input_buffer; char *end; /* allocate more space if buffer is really long */ if (OWQ_size(owq) > DEFAULT_INPUT_BUFFER_LENGTH) { input_buffer = owmalloc(OWQ_size(owq) + 1); if (input_buffer == NULL) { return -ENOMEM; } } memcpy(input_buffer, OWQ_buffer(owq), OWQ_size(owq)); input_buffer[OWQ_size(owq)] = '\0'; // make sure null-ended errno = 0; OWQ_U(owq) = strtoul(input_buffer, &end, 10); /* free specially long buffer */ if (input_buffer != default_input_buffer) { owfree(input_buffer); } if (errno) { return -errno; // conversion error } if (end == input_buffer) { return -EINVAL; // nothing valid found for conversion } return 0; // good return } /* parse a value for write from buffer to value_object */ /* return 0 if ok */ static ZERO_OR_ERROR FS_input_float(struct one_wire_query *owq) { char default_input_buffer[DEFAULT_INPUT_BUFFER_LENGTH + 1]; char *input_buffer = default_input_buffer; char *end; _FLOAT F; /* allocate more space if buffer is really long */ if (OWQ_size(owq) > DEFAULT_INPUT_BUFFER_LENGTH) { input_buffer = owmalloc(OWQ_size(owq) + 1); if (input_buffer == NULL) { return -ENOMEM; } } memcpy(input_buffer, OWQ_buffer(owq), OWQ_size(owq)); input_buffer[OWQ_size(owq)] = '\0'; // make sure null-ended errno = 0; F = strtod(input_buffer, &end); /* free specially long buffer */ if (input_buffer != default_input_buffer) { owfree(input_buffer); } if (errno) { return -errno; // conversion error } if (end == input_buffer) { return -EINVAL; // nothing valid found for conversion } switch (OWQ_pn(owq).selected_filetype->format) { case ft_pressure: OWQ_F(owq) = fromPressure(F, PN(owq)); break; case ft_temperature: OWQ_F(owq) = fromTemperature(F, PN(owq)); break; case ft_tempgap: OWQ_F(owq) = fromTempGap(F, PN(owq)); break; default: OWQ_F(owq) = F; break; } return 0; // good return } /* return 0 if ok */ static ZERO_OR_ERROR FS_input_date(struct one_wire_query *owq) { char default_input_buffer[DEFAULT_INPUT_BUFFER_LENGTH + 1]; char *input_buffer = default_input_buffer; struct tm tm; ZERO_OR_ERROR ret = 0; // default ok /* allocate more space if buffer is really long */ if (OWQ_size(owq) > DEFAULT_INPUT_BUFFER_LENGTH) { input_buffer = owmalloc(OWQ_size(owq) + 1); if (input_buffer == NULL) { return -ENOMEM; } } memcpy(input_buffer, OWQ_buffer(owq), OWQ_size(owq)); input_buffer[OWQ_size(owq)] = '\0'; // make sure null-ended if (OWQ_size(owq) < 2 || input_buffer[0] == '\0' || input_buffer[0] == '\n') { OWQ_D(owq) = NOW_TIME; } else if ((strptime(input_buffer, "%T %a %b %d %Y", &tm) == NULL) // 12:27:02 Tuesday March 23 2007 && (strptime(input_buffer, "%b %d %Y %T", &tm) == NULL) // March 23 2007 12:27:03 && (strptime(input_buffer, "%a %b %d %Y %T", &tm) == NULL) // Tuesday March 23 2007 12:27:02 && (strptime(input_buffer, "%c", &tm) == NULL) && (strptime(input_buffer, "%D %T", &tm) == NULL)) { ret = -EINVAL; } else { OWQ_D(owq) = mktime(&tm); } /* free specially long buffer */ if (input_buffer != default_input_buffer) { owfree(input_buffer); } return ret; } static size_t FS_check_length(struct one_wire_query *owq) { /* need to check property length */ size_t size = OWQ_size(owq) ; size_t filelength = FileLength(PN(owq)) ; off_t offset = OWQ_offset(owq) ; // check overall length if ( filelength < size ) { size = filelength ; } // check overall offset if ( (size_t) offset > filelength ) { size = 0 ; // and check offset plus size } else if ( offset + size > filelength ) { // cannot be negative despite compiler warnings size = filelength - offset ; } return size ; } static int FS_input_ascii(struct one_wire_query *owq) { OWQ_length(owq) = OWQ_size(owq) = FS_check_length(owq) ; return 0; } /* returns 0 if ok */ /* creates a new allocated memory area IF no error */ static ZERO_OR_ERROR FS_input_array_with_commas(struct one_wire_query *owq) { int elements = OWQ_pn(owq).selected_filetype->ag->elements; int extension; char *end = OWQ_buffer(owq) + OWQ_size(owq); char *comma = NULL; // assignment to avoid compiler warning char *buffer_position; if (OWQ_offset(owq)!=0) { return -EINVAL; } for (extension = 0; extension < elements; ++extension) { struct one_wire_query * owq_single ; // find start of buffer span if (extension == 0) { buffer_position = OWQ_buffer(owq); } else { buffer_position = comma + 1; if (buffer_position >= end) { return -EINVAL; } } // find end of buffer span if (extension == elements - 1) { comma = end; } else { comma = memchr(buffer_position, ',', end - buffer_position); if (comma == NULL) { return -EINVAL; } } //Debug_Bytes("FS_input_array_with_commas -- to end",buffer_position,end-buffer_position) ; //Debug_Bytes("FS_input_array_with_commas -- to comma",buffer_position,comma-buffer_position) ; // set up single element owq_single = OWQ_create_separate( extension, owq ) ; if ( owq_single == NO_ONE_WIRE_QUERY ) { return -ENOMEM ; } OWQ_assign_read_buffer(buffer_position, comma - buffer_position, 0, owq_single) ; if (OWQ_parse_input(owq_single)) { OWQ_destroy(owq_single) ; return -EINVAL; } memcpy(&(OWQ_array(owq)[extension]), &OWQ_val(owq_single), sizeof(union value_object)); OWQ_destroy(owq_single) ; } return 0; } /* returns 0 if ok */ /* Basically pack the entries onto the buffer array and find the position with the cumulative length entries */ static ZERO_OR_ERROR FS_input_ascii_array(struct one_wire_query *owq) { int elements = OWQ_pn(owq).selected_filetype->ag->elements; int extension; char *end = OWQ_buffer(owq) + OWQ_size(owq); char *buffer_position = OWQ_buffer(owq); size_t suglen = OWQ_pn(owq).selected_filetype->suglen; if (OWQ_offset(owq)!=0) { return -EINVAL; } for (extension = 0; extension < elements; ++extension) { char *comma; size_t allowed_length = suglen ; size_t entry_length ; // find end of buffer span if (extension == elements - 1) { // last element entry_length = end - buffer_position ; if ( entry_length < suglen ) { allowed_length = entry_length ; } OWQ_array_length(owq, extension) = allowed_length ; return 0; } // pre-terminal element comma = memchr(buffer_position, ',', end - buffer_position); if (comma == NULL) { return -EINVAL; } entry_length = comma - buffer_position; if ( entry_length < suglen ) { allowed_length = entry_length ; } // Set the entry size OWQ_array_length(owq, extension) = allowed_length ; // move the rest of the buffer (after the comma) to the end of this entry memmove(buffer_position + allowed_length, comma + 1, end - comma - 1); // shorten the buffer length by the comma and discarded chars end -= entry_length - allowed_length - 1 ; // move the buffer start to the start of the next entry buffer_position += allowed_length ; } return -ERANGE; // never reach ! } /* returns 0 if ok */ /* creates a new allocated memory area IF no error */ static ZERO_OR_ERROR FS_input_array_no_commas(struct one_wire_query *owq) { int elements = OWQ_pn(owq).selected_filetype->ag->elements; int extension; int suglen = FileLength(PN(owq)) ; if ((OWQ_offset(owq) != 0) || ((int) OWQ_size(owq) != suglen * elements)) { return -EINVAL; } for (extension = 0; extension < elements; ++extension) { OWQ_array_length(owq, extension) = suglen; } return 0; } owfs-2.8p15/module/owlib/src/c/Makefile.in0000664000175000017500000013337411756250027015311 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ # $Id: Makefile.am,v 1.174 2012/04/11 01:24:35 alfille Exp $ 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@ target_triplet = @target@ subdir = module/owlib/src/c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libow_la_LIBADD = am__objects_1 = ow_dl.lo ow_dnssd.lo ow_arg.lo ow_baud.lo \ ow_bitfield.lo ow_byte.lo compat.lo getaddrinfo.lo getline.lo \ getopt.lo ow_none.lo ow_1820.lo ow_1821.lo ow_1921.lo \ ow_1923.lo ow_1954.lo ow_1963.lo ow_1977.lo ow_1991.lo \ ow_1993.lo ow_2401.lo ow_2404.lo ow_2405.lo ow_2406.lo \ ow_2408.lo ow_2409.lo ow_2413.lo ow_2415.lo ow_2423.lo \ ow_2430.lo ow_2433.lo ow_2436.lo ow_2438.lo ow_2450.lo \ ow_2502.lo ow_2505.lo ow_2760.lo ow_2804.lo ow_2890.lo \ ow_add_inflight.lo ow_alias.lo ow_alloc.lo ow_api.lo \ ow_avahi_announce.lo ow_avahi_browse.lo ow_avahi_link.lo \ ow_badadapter.lo ow_bae.lo ow_browse.lo ow_browse_resolve.lo \ ow_browse_monitor.lo ow_bus.lo ow_bus_bitdata.lo \ ow_bus_data.lo ow_buslock.lo ow_cache.lo ow_channel.lo \ ow_charblob.lo ow_com.lo ow_com_change.lo ow_com_close.lo \ ow_com_free.lo ow_com_open.lo ow_com_write.lo ow_com_read.lo \ ow_connect.lo ow_connect_out.lo ow_crc.lo ow_daemon.lo \ ow_date.lo ow_delay.lo ow_del_inflight.lo ow_devicelock.lo \ ow_dir.lo ow_dirblob.lo ow_ds2482.lo ow_ds9097.lo ow_ds1410.lo \ ow_ds9097U.lo ow_ds9490.lo ow_eds.lo ow_eeef.lo \ ow_eprom_write.lo ow_etherweather.lo ow_example_slave.lo \ ow_exit.lo ow_external.lo ow_find_external.lo ow_fs_address.lo \ ow_fs_alias.lo ow_fs_code.lo ow_fs_crc8.lo ow_fs_id.lo \ ow_fs_type.lo ow_ha5.lo ow_ha7.lo ow_ha7e.lo ow_fake.lo \ ow_fakeread.lo ow_filelength.lo ow_fstat.lo ow_generic_read.lo \ ow_get.lo ow_help.lo ow_interface.lo ow_iterate.lo ow_lcd.lo \ ow_lib_close.lo ow_lib_setup.lo ow_lib_stop.lo ow_link.lo \ ow_locator.lo ow_locks.lo ow_memblob.lo ow_memory.lo \ ow_multicast.lo ow_name.lo ow_net_client.lo ow_net_server.lo \ ow_offset.lo ow_opt.lo ow_parse_address.lo \ ow_parse_external.lo ow_parseinput.lo ow_parsename.lo \ ow_parseobject.lo ow_parseoutput.lo ow_parseshallow.lo \ ow_parse_sn.lo ow_pid.lo ow_powerbyte.lo ow_powerbit.lo \ ow_presence.lo ow_pressure.lo ow_printparse.lo \ ow_programpulse.lo ow_read.lo ow_read_external.lo \ ow_read_telnet.lo ow_reconnect.lo ow_remote_alias.lo \ ow_reset.lo ow_return_code.lo ow_rwlock.lo ow_stats.lo \ ow_search.lo ow_serial_free.lo ow_serial_open.lo ow_server.lo \ ow_server_message.lo ow_server_enet.lo ow_select.lo \ ow_set_telnet.lo ow_settings.lo ow_sibling.lo \ ow_sibling_binary.lo ow_sibling_float.lo ow_sibling_uint.lo \ ow_sibling_yesno.lo ow_sig_handlers.lo ow_simultaneous.lo \ ow_slurp.lo ow_stateinfo.lo ow_system.lo ow_tcp_free.lo \ ow_tcp_open.lo ow_tcp_read.lo ow_telnet_write.lo ow_temp.lo \ ow_testerread.lo ow_thermocouple.lo ow_traffic.lo \ ow_transaction.lo ow_tree.lo ow_udp_read.lo ow_usb_msg.lo \ ow_usb_cycle.lo ow_usb_monitor.lo ow_util.lo ow_verify.lo \ ow_visibility.lo ow_w1.lo ow_w1_addremove.lo ow_w1_bind.lo \ ow_w1_browse.lo ow_w1_dispatch.lo ow_w1_list.lo \ ow_w1_monitor.lo ow_w1_parse.lo ow_w1_print.lo ow_w1_scan.lo \ ow_w1_select.lo ow_w1_send.lo ow_write.lo ow_write_external.lo \ ow_zero.lo owlib.lo error.lo globals.lo am_libow_la_OBJECTS = $(am__objects_1) libow_la_OBJECTS = $(am_libow_la_OBJECTS) libow_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libow_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include depcomp = $(SHELL) $(top_srcdir)/src/scripts/install/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libow_la_SOURCES) DIST_SOURCES = $(libow_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ OWLIB_SOURCE = ow_dl.c \ ow_dnssd.c \ ow_arg.c \ ow_baud.c \ ow_bitfield.c \ ow_byte.c \ compat.c \ getaddrinfo.c \ getline.c \ getopt.c \ ow_none.c \ ow_1820.c \ ow_1821.c \ ow_1921.c \ ow_1923.c \ ow_1954.c \ ow_1963.c \ ow_1977.c \ ow_1991.c \ ow_1993.c \ ow_2401.c \ ow_2404.c \ ow_2405.c \ ow_2406.c \ ow_2408.c \ ow_2409.c \ ow_2413.c \ ow_2415.c \ ow_2423.c \ ow_2430.c \ ow_2433.c \ ow_2436.c \ ow_2438.c \ ow_2450.c \ ow_2502.c \ ow_2505.c \ ow_2760.c \ ow_2804.c \ ow_2890.c \ ow_add_inflight.c \ ow_alias.c \ ow_alloc.c \ ow_api.c \ ow_avahi_announce.c\ ow_avahi_browse.c \ ow_avahi_link.c \ ow_badadapter.c \ ow_bae.c \ ow_browse.c \ ow_browse_resolve.c\ ow_browse_monitor.c\ ow_bus.c \ ow_bus_bitdata.c \ ow_bus_data.c \ ow_buslock.c \ ow_cache.c \ ow_channel.c \ ow_charblob.c \ ow_com.c \ ow_com_change.c \ ow_com_close.c \ ow_com_free.c \ ow_com_open.c \ ow_com_write.c \ ow_com_read.c \ ow_connect.c \ ow_connect_out.c \ ow_crc.c \ ow_daemon.c \ ow_date.c \ ow_delay.c \ ow_del_inflight.c \ ow_devicelock.c \ ow_dir.c \ ow_dirblob.c \ ow_ds2482.c \ ow_ds9097.c \ ow_ds1410.c \ ow_ds9097U.c \ ow_ds9490.c \ ow_eds.c \ ow_eeef.c \ ow_eprom_write.c \ ow_etherweather.c \ ow_example_slave.c \ ow_exit.c \ ow_external.c \ ow_find_external.c \ ow_fs_address.c \ ow_fs_alias.c \ ow_fs_code.c \ ow_fs_crc8.c \ ow_fs_id.c \ ow_fs_type.c \ ow_ha5.c \ ow_ha7.c \ ow_ha7e.c \ ow_fake.c \ ow_fakeread.c \ ow_filelength.c \ ow_fstat.c \ ow_generic_read.c \ ow_get.c \ ow_help.c \ ow_interface.c \ ow_iterate.c \ ow_lcd.c \ ow_lib_close.c \ ow_lib_setup.c \ ow_lib_stop.c \ ow_link.c \ ow_locator.c \ ow_locks.c \ ow_memblob.c \ ow_memory.c \ ow_multicast.c \ ow_name.c \ ow_net_client.c \ ow_net_server.c \ ow_offset.c \ ow_opt.c \ ow_parse_address.c \ ow_parse_external.c\ ow_parseinput.c \ ow_parsename.c \ ow_parseobject.c \ ow_parseoutput.c \ ow_parseshallow.c \ ow_parse_sn.c \ ow_pid.c \ ow_powerbyte.c \ ow_powerbit.c \ ow_presence.c \ ow_pressure.c \ ow_printparse.c \ ow_programpulse.c \ ow_read.c \ ow_read_external.c \ ow_read_telnet.c \ ow_reconnect.c \ ow_remote_alias.c \ ow_reset.c \ ow_return_code.c \ ow_rwlock.c \ ow_stats.c \ ow_search.c \ ow_serial_free.c \ ow_serial_open.c \ ow_server.c \ ow_server_message.c\ ow_server_enet.c \ ow_select.c \ ow_set_telnet.c \ ow_settings.c \ ow_sibling.c \ ow_sibling_binary.c\ ow_sibling_float.c \ ow_sibling_uint.c \ ow_sibling_yesno.c \ ow_sig_handlers.c \ ow_simultaneous.c \ ow_slurp.c \ ow_stateinfo.c \ ow_system.c \ ow_tcp_free.c \ ow_tcp_open.c \ ow_tcp_read.c \ ow_telnet_write.c \ ow_temp.c \ ow_testerread.c \ ow_thermocouple.c \ ow_traffic.c \ ow_transaction.c \ ow_tree.c \ ow_udp_read.c \ ow_usb_msg.c \ ow_usb_cycle.c \ ow_usb_monitor.c \ ow_util.c \ ow_verify.c \ ow_visibility.c \ ow_w1.c \ ow_w1_addremove.c \ ow_w1_bind.c \ ow_w1_browse.c \ ow_w1_dispatch.c \ ow_w1_list.c \ ow_w1_monitor.c \ ow_w1_parse.c \ ow_w1_print.c \ ow_w1_scan.c \ ow_w1_select.c \ ow_w1_send.c \ ow_write.c \ ow_write_external.c\ ow_zero.c \ owlib.c \ error.c \ globals.c lib_LTLIBRARIES = libow.la libow_la_SOURCES = ${OWLIB_SOURCE} @HAVE_CYGWIN_FALSE@libow_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} -shared -shrext .so ${LIBUSB_LIBS} ${LD_EXTRALIBS} @HAVE_CYGWIN_TRUE@libow_la_LDFLAGS = ${PTHREAD_LIBS} -shared -no-undefined ${LIBUSB_LIBS} ${LD_EXTRALIBS} # Maybe need this for MacOS X #if HAVE_DARWIN #LDADDS = -framework IOKit -framework CoreFoundation #endif #libow_la_LDFLAGS = -shared -shrext .so \ # -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ # -release $(LT_RELEASE) \ # -export-dynamic \ # $(LDADDS) AM_CFLAGS = -I../include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} \ ${PIC_FLAGS} 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 module/owlib/src/c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owlib/src/c/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 libow.la: $(libow_la_OBJECTS) $(libow_la_DEPENDENCIES) $(EXTRA_libow_la_DEPENDENCIES) $(libow_la_LINK) -rpath $(libdir) $(libow_la_OBJECTS) $(libow_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getline.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1820.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1821.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1921.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1923.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1954.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1963.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1977.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1991.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_1993.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2401.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2404.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2405.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2406.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2408.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2409.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2413.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2415.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2423.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2430.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2433.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2436.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2438.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2450.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2502.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2505.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2760.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2804.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_2890.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_add_inflight.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_alias.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_arg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_avahi_announce.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_avahi_browse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_avahi_link.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_badadapter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_bae.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_baud.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_bitfield.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_browse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_browse_monitor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_browse_resolve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_bus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_bus_bitdata.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_bus_data.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_buslock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_byte.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_channel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_charblob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_change.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_close.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_free.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_com_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_connect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_connect_out.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_crc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_daemon.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_date.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_del_inflight.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_delay.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_devicelock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dir.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dirblob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_dnssd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ds1410.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ds2482.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ds9097.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ds9097U.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ds9490.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_eds.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_eeef.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_eprom_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_etherweather.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_example_slave.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_exit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_external.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fake.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fakeread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_filelength.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_find_external.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_address.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_alias.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_code.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_crc8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_id.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fs_type.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_fstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_generic_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_get.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ha5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ha7.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_ha7e.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_help.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_iterate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_lcd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_lib_close.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_lib_setup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_lib_stop.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_link.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_locator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_locks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_memblob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_multicast.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_name.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_net_client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_net_server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_none.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_offset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_opt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parse_address.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parse_external.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parse_sn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parseinput.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parsename.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parseobject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parseoutput.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_parseshallow.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_pid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_powerbit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_powerbyte.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_presence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_pressure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_printparse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_programpulse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_read_external.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_read_telnet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_reconnect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_remote_alias.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_reset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_return_code.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_rwlock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_search.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_select.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_serial_free.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_serial_open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_server_enet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_server_message.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_set_telnet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sibling.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sibling_binary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sibling_float.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sibling_uint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sibling_yesno.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_sig_handlers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_simultaneous.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_slurp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_stateinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_system.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tcp_free.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tcp_open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tcp_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_telnet_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_temp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_testerread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_thermocouple.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_traffic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_transaction.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_udp_read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_usb_cycle.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_usb_monitor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_usb_msg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_verify.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_visibility.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_addremove.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_bind.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_browse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_dispatch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_monitor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_print.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_scan.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_select.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_w1_send.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_write_external.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ow_zero.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/owlib.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @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 $@ $< 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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: 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-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-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-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-libLTLIBRARIES clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owlib/src/c/ow_remote_alias.c0000664000175000017500000001072111631537134016546 00000000000000/* $Id: ow_remote_alias.c,v 1.8 2011/09/07 00:44:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ------------ */ static struct connection_in * NextServer( struct connection_in * in ) ; static INDEX_OR_ERROR ServerAlias( BYTE * sn, struct connection_in * in, struct parsedname * pn ) ; /* ------- Functions ------------ */ static struct connection_in * NextServer( struct connection_in * in ) { do { if ( in == NO_CONNECTION ) { return NO_CONNECTION ; } if ( BusIsServer(in) ) { return in ; } in = in->next ; } while (1) ; } static INDEX_OR_ERROR ServerAlias( BYTE * sn, struct connection_in * in, struct parsedname * pn ) { struct parsedname s_pn_copy; struct parsedname * pn_copy = &s_pn_copy ; INDEX_OR_ERROR bus_nr ; memcpy(pn_copy, pn, sizeof(struct parsedname)); // shallow copy pn_copy->selected_connection = in; bus_nr = ServerPresence( pn_copy) ; memcpy( sn, pn_copy->sn, SERIAL_NUMBER_SIZE ); return bus_nr ; } #if OW_MT struct remotealias_struct { struct connection_in *in; struct parsedname *pn; BYTE sn[SERIAL_NUMBER_SIZE] ; INDEX_OR_ERROR bus_nr; }; static void * RemoteAlias_callback(void * v) { pthread_t thread; int threadbad = 1; struct remotealias_struct * ras = (struct remotealias_struct *) v ; struct remotealias_struct next_ras ; // set up for next server connection next_ras.in = NextServer(ras->in->next) ; next_ras.pn = ras->pn ; next_ras.bus_nr = INDEX_BAD ; memset( next_ras.sn, 0, SERIAL_NUMBER_SIZE) ; // launch thread for next server connection threadbad = (next_ras.in == NO_CONNECTION) || pthread_create(&thread, DEFAULT_THREAD_ATTR, RemoteAlias_callback, (void *) (&next_ras)); // Result for this server connection (while next one is processing) ras->bus_nr = ServerAlias( ras->sn, ras->in, ras->pn ) ; if (threadbad == 0) { /* was a thread created? */ if (pthread_join(thread, NULL)==0) { // Set answer to the next bus if it's found // else use current answer if ( INDEX_VALID(next_ras.bus_nr) ) { ras->bus_nr = next_ras.bus_nr ; memcpy( ras->sn, next_ras.sn, SERIAL_NUMBER_SIZE ) ; } } } return VOID_RETURN ; } INDEX_OR_ERROR RemoteAlias(struct parsedname *pn) { struct remotealias_struct ras ; ras.in = NextServer(Inbound_Control.head) ; ras.pn = pn ; ras.bus_nr = INDEX_BAD ; memset( ras.sn, 0, SERIAL_NUMBER_SIZE) ; if ( ras.in != NO_CONNECTION ) { RemoteAlias_callback( (void *) (&ras) ) ; } if ( INDEX_VALID( ras.bus_nr ) ) { memcpy( pn->sn, ras.sn, SERIAL_NUMBER_SIZE ) ; } LEVEL_DEBUG("Remote alias for %s bus=%d "SNformat,pn->path_to_server,ras.bus_nr,SNvar(ras.sn)); return ras.bus_nr; } #else /* OW_MT */ INDEX_OR_ERROR RemoteAlias(struct parsedname *pn) { struct connection_in * in ; for ( in=NextServer(Inbound_Control.head) ; in ; in=NextServer(in->next) ) { BYTE sn[SERIAL_NUMBER_SIZE] ; INDEX_OR_ERROR bus_nr = ServerAlias( sn, in, pn ) ; if ( INDEX_VALID(bus_nr) ) { memcpy( pn->sn, sn, SERIAL_NUMBER_SIZE ) ; LEVEL_DEBUG("Remote alias for %s bus=%d "SNformat,pn->path_to_server,bus_nr,SNvar(sn)); return bus_nr ; } } return INDEX_BAD; // no success } #endif /* OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_com_change.c0000664000175000017500000000443411605364540016171 00000000000000/* $Id: ow_com_change.c,v 1.3 2011/07/07 17:14:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif GOOD_OR_BAD COM_change( struct connection_in *connection) { if ( connection == NO_CONNECTION ) { return gbBAD ; } // is connection thought to be open? RETURN_BAD_IF_BAD( COM_test(connection) ) ; switch ( SOC(connection)->type ) { case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented!!!"); return gbBAD ; case ct_telnet: // set to change settings at next write if ( SOC(connection)->dev.telnet.telnet_negotiated == completed_negotiation ) { SOC(connection)->dev.telnet.telnet_negotiated = needs_negotiation ; } return gbGOOD ; case ct_tcp: case ct_netlink: LEVEL_DEBUG("Cannot change baud rate on %s",SAFESTRING(SOC(connection)->devicename)) ; return gbGOOD ; case ct_serial: return serial_change( connection ) ; case ct_unknown: case ct_none: default: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return gbBAD ; } } void COM_set_standard( struct connection_in *connection) { SOC(connection) -> baud = B9600 ; SOC(connection) -> vmin = 0; // minimum chars SOC(connection) -> vtime = 3; // decisec wait SOC(connection) -> parity = parity_none; // parity SOC(connection) -> stop = stop_1; // stop bits SOC(connection) -> bits = 8; // bits/byte SOC(connection) -> state = cs_virgin ; SOC(connection) -> dev.telnet.telnet_negotiated = needs_negotiation ; connection->master.enet.tcp.CRLF_size = 2 ; switch (SOC(connection)->type) { case ct_telnet: SOC(connection)->timeout.tv_sec = Globals.timeout_network ; SOC(connection)->timeout.tv_usec = 0 ; break ; case ct_serial: default: SOC(connection)->timeout.tv_sec = Globals.timeout_serial ; SOC(connection)->timeout.tv_usec = 0 ; break ; } SOC(connection) -> flow = flow_first; // flow control } owfs-2.8p15/module/owlib/src/c/ow_ds9490.c0000644000175000017500000010455511754612217015047 00000000000000/* $Id: ow_ds9490.c,v 1.231 2012/05/16 02:44:31 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* DS9490R-W USB 1-Wire master USB parameters: Vendor ID: 04FA ProductID: 2490 Dallas controller DS2490 */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" #if OW_USB /* conditional inclusion of USB */ #include "ow_usb_msg.h" #include "ow_usb_cycle.h" /* Extensive FreeBSD workarounds by Robert Nilsson */ /* Peter Radcliffe updated support for FreeBSD >= 8 */ #ifdef __FreeBSD__ // Add a few definitions we need #undef HAVE_USB_INTERRUPT_READ // This call in libusb is unneeded for FreeBSD (and it's broken) #if __FreeBSD__ < 8 #include #include #define USB_CLEAR_HALT BSD_usb_clear_halt #endif /* __FreeBSD__ < 8 */ #endif /* __FreeBSD__ */ #ifndef USB_CLEAR_HALT #define USB_CLEAR_HALT usb_clear_halt #endif /* USB_CLEAR_HALT */ /* All the rest of the code sees is the DS9490_detect routine and the iroutine structure */ static RESET_TYPE DS9490_reset(const struct parsedname *pn); static void BUS_ERROR_fix(const struct parsedname *pn); static GOOD_OR_BAD DS9490_detect_single_adapter(int usb_nr, struct connection_in *in); static GOOD_OR_BAD DS9490_detect_all_adapters(struct connection_in * in_first); static GOOD_OR_BAD DS9490_detect_specific_adapter(int bus_nr, int dev_nr, struct connection_in * in) ; static GOOD_OR_BAD DS9490_reconnect(const struct parsedname *pn); static GOOD_OR_BAD DS9490_redetect_low(struct connection_in * in); static GOOD_OR_BAD DS9490_redetect_match(struct connection_in * in); static GOOD_OR_BAD DS9490_redetect_specific_adapter( struct connection_in * in) ; static void DS9490_setroutines(struct connection_in *in); static GOOD_OR_BAD DS9490_setup_adapter(struct connection_in * in) ; static enum search_status DS9490_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD DS9490_sendback_data(const BYTE * data, BYTE * resp, size_t len, const struct parsedname *pn); static GOOD_OR_BAD DS9490_HaltPulse(const struct parsedname *pn); static GOOD_OR_BAD DS9490_PowerByte(BYTE byte, BYTE * resp, UINT delay, const struct parsedname *pn); static GOOD_OR_BAD DS9490_ProgramPulse(const struct parsedname *pn); static GOOD_OR_BAD DS9490_overdrive(const struct parsedname *pn); static void SetupDiscrepancy(const struct device_search *ds, BYTE * discrepancy); static int FindDiscrepancy(BYTE * last_sn, BYTE * discrepancy_sn); static enum search_status DS9490_directory(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD DS9490_SetSpeed(const struct parsedname *pn); static void DS9490_SetFlexParameters(struct connection_in *in) ; static GOOD_OR_BAD DS9490_open_and_name(struct usb_list *ul, struct connection_in *in); static void DS9490_connection_init( struct connection_in * in ) ; /* Device-specific routines */ static void DS9490_setroutines(struct connection_in *in) { in->iroutines.detect = DS9490_detect; in->iroutines.reset = DS9490_reset; in->iroutines.next_both = DS9490_next_both; in->iroutines.PowerByte = DS9490_PowerByte; in->iroutines.ProgramPulse = DS9490_ProgramPulse; in->iroutines.sendback_data = DS9490_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = DS9490_reconnect; in->iroutines.close = DS9490_close; in->iroutines.flags = ADAP_FLAG_default; in->bundling_length = USB_FIFO_SIZE; } #define DS2490_BULK_BUFFER_SIZE 64 //#define DS2490_DIR_GULP_ELEMENTS ((DS2490_BULK_BUFFER_SIZE/SERIAL_NUMBER_SIZE) - 1) #define DS2490_DIR_GULP_ELEMENTS (1) #define MOD_PULSE_EN 0x0000 #define MOD_SPEED_CHANGE_EN 0x0001 #define MOD_1WIRE_SPEED 0x0002 #define MOD_STRONG_PU_DURATION 0x0003 #define MOD_PULLDOWN_SLEWRATE 0x0004 #define MOD_PROG_PULSE_DURATION 0x0005 #define MOD_WRITE1_LOWTIME 0x0006 #define MOD_DSOW0_TREC 0x0007 // // Value field COMM Command options // // COMM Bits (bitwise or into COMM commands to build full value byte pairs) // Byte 1 #define COMM_TYPE 0x0008 #define COMM_SE 0x0008 #define COMM_D 0x0008 #define COMM_Z 0x0008 #define COMM_CH 0x0008 #define COMM_SM 0x0008 #define COMM_R 0x0008 #define COMM_IM 0x0001 // Byte 2 #define COMM_PS 0x4000 #define COMM_PST 0x4000 #define COMM_CIB 0x4000 #define COMM_RTS 0x4000 #define COMM_DT 0x2000 #define COMM_SPU 0x1000 #define COMM_F 0x0800 #define COMM_NTF 0x0400 #define COMM_ICP 0x0200 #define COMM_RST 0x0100 // Read Straight command, special bits #define COMM_READ_STRAIGHT_NTF 0x0008 #define COMM_READ_STRAIGHT_ICP 0x0004 #define COMM_READ_STRAIGHT_RST 0x0002 #define COMM_READ_STRAIGHT_IM 0x0001 // // Value field COMM Command options (0-F plus assorted bits) // #define COMM_ERROR_ESCAPE 0x0601 #define COMM_SET_DURATION 0x0012 #define COMM_BIT_IO 0x0020 #define COMM_PULSE 0x0030 #define COMM_1_WIRE_RESET 0x0042 #define COMM_BYTE_IO 0x0052 #define COMM_MATCH_ACCESS 0x0064 #define COMM_BLOCK_IO 0x0074 #define COMM_READ_STRAIGHT 0x0080 #define COMM_DO_RELEASE 0x6092 #define COMM_SET_PATH 0x00A2 #define COMM_WRITE_SRAM_PAGE 0x00B2 #define COMM_WRITE_EPROM 0x00C4 #define COMM_READ_CRC_PROT_PAGE 0x00D4 #define COMM_READ_REDIRECT_PAGE_CRC 0x21E4 #define COMM_SEARCH_ACCESS 0x00F4 // Mode Command Code Constants // Enable Pulse Constants #define ENABLEPULSE_PRGE 0x01 // programming pulse #define ENABLEPULSE_SPUE 0x02 // strong pull-up // Define our combinations: #define ENABLE_PROGRAM_ONLY (ENABLEPULSE_PRGE) #define ENABLE_PROGRAM_AND_PULSE (ENABLEPULSE_PRGE | ENABLEPULSE_SPUE) // 1Wire Bus Speed Setting Constants #define ONEWIREBUSSPEED_REGULAR 0x00 #define ONEWIREBUSSPEED_FLEXIBLE 0x01 #define ONEWIREBUSSPEED_OVERDRIVE 0x02 #define PARMSET_Slew15Vus 0x0 #define PARMSET_Slew2p20Vus 0x1 #define PARMSET_Slew1p65Vus 0x2 #define PARMSET_Slew1p37Vus 0x3 #define PARMSET_Slew1p10Vus 0x4 #define PARMSET_Slew0p83Vus 0x5 #define PARMSET_Slew0p70Vus 0x6 #define PARMSET_Slew0p55Vus 0x7 #define PARMSET_W1L_08us 0x0 #define PARMSET_W1L_09us 0x1 #define PARMSET_W1L_10us 0x2 #define PARMSET_W1L_11us 0x3 #define PARMSET_W1L_12us 0x4 #define PARMSET_W1L_13us 0x5 #define PARMSET_W1L_14us 0x6 #define PARMSET_W1L_15us 0x7 #define PARMSET_DS0_W0R_3us 0x0 #define PARMSET_DS0_W0R_4us 0x1 #define PARMSET_DS0_W0R_5us 0x2 #define PARMSET_DS0_W0R_6us 0x3 #define PARMSET_DS0_W0R_7us 0x4 #define PARMSET_DS0_W0R_8us 0x5 #define PARMSET_DS0_W0R_9us 0x6 #define PARMSET_DS0_W0R_10us 0x7 /* From datasheet http://datasheets.maxim-ic.com/en/ds/DS2490.pdf page 15 */ /* 480 usec = 8usec * 60 and 60(decimal) = 0x3C */ /* 480 usec is the recommended program pulse duration in the DS2406 DS2502 DS2505 datasheets */ #define PROGRAM_PULSE_DURATION_CODE 0x3C /* ------------------------------------------------------------ */ /* --- USB detection routines ----------------------------------*/ /* Main routine for detecting (and setting up) the DS2490 1-wire USB chip */ GOOD_OR_BAD DS9490_detect(struct connection_in *in) { struct address_pair ap ; GOOD_OR_BAD gbResult = gbBAD; /* uses "name" before it's cleared by connection_init */ Parse_Address( SOC(in)->devicename, &ap ) ; DS9490_connection_init( in ) ; switch ( ap.entries ) { case 0: // Minimal specification, so use first USB device gbResult = DS9490_detect_single_adapter( 1, in) ; break ; case 1: switch( ap.first.type ) { case address_all: LEVEL_DEBUG("Look for all USB adapters"); gbResult = DS9490_detect_all_adapters(in) ; break ; case address_numeric: LEVEL_DEBUG("Look for USB adapter number %d",ap.first.number); gbResult = DS9490_detect_single_adapter( ap.first.number, in) ; break ; case address_alpha: if ( strncasecmp(ap.first.alpha,"scan",4) == 0 ) { SAFEFREE(SOC(in)->devicename) ; LEVEL_DEBUG("Add USB scanning capability"); gbResult = USB_monitor_detect(in) ; break ; } // fall through default: LEVEL_DEFAULT("Unclear what <%s> means in USB specification, will use first adapter.",ap.first.alpha) ; gbResult = DS9490_detect_single_adapter( 1, in) ; break ; } break ; case 2: if ( ap.first.type != address_numeric || ap.second.type != address_numeric ) { LEVEL_DEFAULT("USB address <%s:%s> not in number:number format",ap.first.alpha,ap.second.alpha) ; } else { gbResult = DS9490_detect_specific_adapter( ap.first.number, ap.second.number, in ) ; } break ; } Free_Address( &ap ) ; return gbResult; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_detect_single_adapter(int usb_nr, struct connection_in * in) { struct usb_list ul; USB_first(&ul); if ( usb_nr == 1 ) { // return the first free RETURN_BAD_IF_BAD( USB_next( &ul ) ) ; } else { // return the nth RETURN_BAD_IF_BAD( USB_next_until_n( &ul, usb_nr ) ) ; } RETURN_BAD_IF_BAD( DS9490_open_and_name(&ul, in)) ; if ( BAD(DS9490_ID_this_master(in)) ) { DS9490_close(in) ; return gbBAD; } return gbGOOD ; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_detect_specific_adapter(int bus_nr, int dev_nr, struct connection_in * in) { struct usb_list ul; // Mark this connection as taking only this address pair. Important for reconnections. in->master.usb.specific_usb_address = 1 ; USB_first(&ul); while ( GOOD(USB_next(&ul)) ) { if ( ul.usb_bus_number != bus_nr || ul.usb_dev_number != dev_nr ) { LEVEL_CONNECT("USB DS9490 %d:%d passed over. (Looking for %d:%d)", ul.usb_bus_number, ul.usb_dev_number, bus_nr, dev_nr ); continue ; } return DS9490_open_and_name(&ul, in) ; } LEVEL_CONNECT("No matching USB DS9490 bus master found"); return gbBAD; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_detect_all_adapters(struct connection_in * in_first) { struct usb_list ul; struct connection_in * in = in_first ; USB_first(&ul); while ( GOOD(USB_next(&ul)) ) { if ( BAD(DS9490_open_and_name(&ul, in)) ) { LEVEL_DEBUG("Cannot open USB device %.d:%.d", ul.usb_bus_number, ul.usb_dev_number ); continue ; } else if ( BAD(DS9490_ID_this_master(in)) ) { DS9490_close(in) ; LEVEL_DEBUG("Cannot access USB device %.d:%.d", ul.usb_bus_number, ul.usb_dev_number ); continue; } else{ in = NewIn(in_first) ; if ( in == NO_CONNECTION ) { return gbGOOD ; } // set up the new connection for the next adapter DS9490_connection_init(in) ; } } if ( in == in_first ) { LEVEL_CONNECT("No USB DS9490 bus masters used"); return gbBAD; } // Remove the extra connection RemoveIn(in); return gbGOOD ; } static void DS9490_connection_init( struct connection_in * in ) { if ( in == NO_CONNECTION ) { return ; } SAFEFREE( SOC(in)->devicename ) ; SOC(in)->devicename = owstrdup(badUSBname); // initialized DS9490_setroutines(in); // set up close, reconnect, reset, ... in->busmode = bus_usb; in->flex = 1 ; // Michael Markstaller suggests this in->master.usb.usb = NULL ; // no handle yet in->master.usb.usb_bus_number = in->master.usb.usb_dev_number = -1 ; memset( in->master.usb.ds1420_address, 0, SERIAL_NUMBER_SIZE ) ; DS9490_setroutines(in); in->Adapter = adapter_DS9490; /* OWFS assigned value */ in->adapter_name = "DS9490"; } /* ------------------------------------------------------------ */ /* --- USB redetect routines -----------------------------------*/ /* When the errors stop the USB device from functioning -- close and reopen. * If it fails, re-scan the USB bus and search for the old adapter */ static GOOD_OR_BAD DS9490_reconnect(const struct parsedname *pn) { GOOD_OR_BAD ret; struct connection_in * in = pn->selected_connection ; if ( in->master.usb.specific_usb_address ) { // special case where a usb bus:dev pair was given // only connect to the same spot return DS9490_redetect_specific_adapter( in ) ; } /* Have to protect usb_find_busses() and usb_find_devices() with * a lock since libusb could crash if 2 threads call it at the same time. * It's not called until DS9490_redetect_low(), but I lock here just * to be sure DS9490_close() and DS9490_open() get one try first. */ LIBUSBLOCK; DS9490_close( in ) ; ret = DS9490_redetect_low(in) ; LIBUSBUNLOCK; if ( GOOD(ret) ) { LEVEL_DEFAULT("Found USB DS9490 bus master after USB rescan as [%s]", SAFESTRING(SOC(in)->devicename)); } return ret; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_redetect_low(struct connection_in * in) { struct usb_list ul; USB_first(&ul); while ( GOOD(USB_next(&ul)) ) { // try to open the DS9490 if ( BAD(DS9490_open_and_name(&ul, in)) ) { LEVEL_CONNECT("Cannot open USB bus master, Find next..."); continue; } RETURN_GOOD_IF_GOOD( DS9490_redetect_match( in ) ) ; DS9490_close(in); } //LEVEL_CONNECT("No available USB DS9490 bus master found"); return gbBAD; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_redetect_specific_adapter( struct connection_in * in) { struct address_pair ap ; GOOD_OR_BAD gbResult ; Parse_Address( SOC(in)->devicename, &ap ) ; if ( ap.first.type != address_numeric || ap.second.type != address_numeric ) { LEVEL_DEBUG("Cannot understand the specific usb address pair to reconnect <%s>",SOC(in)->devicename) ; gbResult = gbBAD ; } else { char * name_copy = owstrdup( SOC(in)->devicename ) ; // since DS9490_close clears this value and we may need to restore on error /* Have to protect usb_find_busses() and usb_find_devices() with * a lock since libusb could crash if 2 threads call it at the same time. * It's not called until DS9490_redetect_low(), but I lock here just * to be sure DS9490_close() and DS9490_open() get one try first. */ LIBUSBLOCK; DS9490_close( in ) ; gbResult = DS9490_detect_specific_adapter( ap.first.number, ap.second.number, in) ; LIBUSBUNLOCK; if ( BAD(gbResult) ) { SAFEFREE( SOC(in)->devicename ) ; SOC(in)->devicename = name_copy ; // so no need to free here } else { owfree( name_copy ) ; } } Free_Address( &ap ) ; return gbResult ; } /* Open a DS9490 -- low level code (to allow for repeats) */ static GOOD_OR_BAD DS9490_redetect_match( struct connection_in * in) { struct dirblob db ; BYTE sn[SERIAL_NUMBER_SIZE] ; int device_number ; LEVEL_DEBUG("Attempting reconnect on %s",SAFESTRING(SOC(in)->devicename)); // Special case -- originally untagged adapter if ( in->master.usb.ds1420_address[0] == '\0' ) { LEVEL_CONNECT("Since originally untagged bus master, we will use first available slot."); return gbGOOD ; } // Generate a root directory RETURN_BAD_IF_BAD( DS9490_root_dir( &db, in ) ) ; // This adapter has no tags, so not the one we want if ( DirblobElements( &db) == 0 ) { DirblobClear( &db ) ; LEVEL_DATA("Empty directory on [%s] (Doesn't match initial scan).", SAFESTRING(SOC(in)->devicename)); return gbBAD ; } // Scan directory for a match to the original tag device_number = 0 ; while ( DirblobGet( device_number, sn, &db ) == 0 ) { if (memcmp(sn, in->master.usb.ds1420_address, SERIAL_NUMBER_SIZE) == 0) { // same tag device? LEVEL_DATA("Matching device [%s].", SAFESTRING(SOC(in)->devicename)); DirblobClear( &db ) ; return gbGOOD ; } ++device_number ; } // Couldn't find correct ds1420 chip on this adapter LEVEL_CONNECT("Couldn't find correct ds1420 chip on this bus master [%s] (want: " SNformat ")", SAFESTRING(SOC(in)->devicename), SNvar(in->master.usb.ds1420_address)); DirblobClear( &db ) ; return gbBAD; } /* ------------------------------------------------------------ */ /* --- USB reset routines --------------------------------------*/ /* Reset adapter and detect devices on the bus */ /* BUS locked at high level */ /* return 1=short, 0 good <0 error */ static RESET_TYPE DS9490_reset(const struct parsedname *pn) { int i; BYTE buffer[ DS9490_getstatus_BUFFER_LENGTH ]; int USpeed; struct connection_in * in = pn->selected_connection ; int readlen = 0 ; LEVEL_DEBUG("DS9490 RESET. changed %d, flex: %d", in->changed_bus_settings, in->flex) ; if (in->master.usb.usb == NULL || in->master.usb.dev == NULL) { // From Michael Markstaller: LEVEL_DEBUG("Attempting RESET on null bus") ; //FIXME! what doees it mean? no action/reconnect is even tried-> shouldn't we just drop this BM and let uscan rediscover it? DS9490 must always have an ID chip.. // Actually no, the home-brewed DS2490-based masters that people have built have no ID chip BUS_ERROR_fix(pn) ; return BUS_RESET_ERROR; } // Do we need to change settings? if (in->changed_bus_settings > 0) { // Prevent recursive loops on reset DS9490_SetSpeed(pn); // reset paramters in->changed_bus_settings = 0 ; } memset(buffer, 0, 32); // Bus timing if ( in->overdrive ) { USpeed = ONEWIREBUSSPEED_OVERDRIVE ; } else if ( in->flex ) { USpeed = ONEWIREBUSSPEED_FLEXIBLE ; } else { USpeed = ONEWIREBUSSPEED_REGULAR ; } // Send reset //FIXME: from Michael Markstaller: changed hard to flexible speed as it gets wrong somewhere, only want flexible if ( BAD( USB_Control_Msg(COMM_CMD, COMM_1_WIRE_RESET | COMM_F | COMM_IM | COMM_SE, USpeed, pn)) ) { // if ( BAD( USB_Control_Msg(COMM_CMD, COMM_1_WIRE_RESET | COMM_F | COMM_IM | COMM_SE, ONEWIREBUSSPEED_FLEXIBLE, pn)) ) { LEVEL_DATA("Reset command rejected"); BUS_ERROR_fix(pn) ; return BUS_RESET_ERROR; // fatal error... probably closed usb-handle } // Extra delay? if (in->ds2404_found && (in->overdrive == 0)) { // extra delay for alarming DS1994/DS2404 compliance UT_delay(5); } // Read response switch( DS9490_getstatus(buffer, &readlen, pn) ) { case BUS_RESET_SHORT: /* Short detected, but otherwise no bigger problem */ LEVEL_DEBUG("DS9490_Reset: SHORT"); return BUS_RESET_SHORT ; case BUS_RESET_OK: LEVEL_DEBUG("DS9490_Reset: OK"); break ; case BUS_RESET_ERROR: default: LEVEL_DEBUG("DS9490_Reset: ERROR"); BUS_ERROR_fix(pn) ; return BUS_RESET_ERROR; } //USBpowered = (buffer[8]&STATUSFLAGS_PMOD) == STATUSFLAGS_PMOD ; in->AnyDevices = anydevices_yes ; for (i = 16; i < readlen; i++) { BYTE val = buffer[i]; LEVEL_DEBUG("Reset: Status bytes[%d]: %X", i, val); if (val != ONEWIREDEVICEDETECT) { // check for NRS bit (0x01) if (val & COMMCMDERRORRESULT_NRS) { // empty bus detected, no presence pulse detected in->AnyDevices = anydevices_no; LEVEL_DATA("no presense pulse detected"); } } } return BUS_RESET_OK; } static void BUS_ERROR_fix(const struct parsedname *pn) { LEVEL_DEBUG("DS9490_Reset: ERROR -- will attempt a fix"); /* FIXME: FIXED. In ow_usb_msg.c an USB-reset was was issued: * USB_Control_Msg(CONTROL_CMD, CTL_RESET_DEVICE, 0x0000, pn) ; * So we need to setup the Adapter again * Though here is probably the wrong place, duplicated code from _setup_adaptor */ // enable both program and strong pulses if ( BAD( USB_Control_Msg(MODE_CMD, MOD_PULSE_EN, ENABLE_PROGRAM_AND_PULSE, pn)) ) { LEVEL_DATA("EnableProgram error"); } // enable speed changes if ( BAD( USB_Control_Msg(MODE_CMD, MOD_SPEED_CHANGE_EN, 1, pn)) ) { LEVEL_DATA("RESET_Error: SpeedEnable error"); } // set the strong pullup duration to infinite if ( BAD( USB_Control_Msg(COMM_CMD, COMM_SET_DURATION | COMM_IM, 0x0000, pn)) ) { LEVEL_DATA("StrongPullup error"); } // Don't set speed right now, it calls reset for infinite recursion. Just set for next pass ++ pn->selected_connection->changed_bus_settings ; } /* ------------------------------------------------------------ */ /* --- USB Directory functions --------------------------------*/ static enum search_status DS9490_next_both(struct device_search *ds, const struct parsedname *pn) { int dir_gulp_elements = (pn->ds2409_depth==0) ? DS2490_DIR_GULP_ELEMENTS : 1 ; // LOOK FOR NEXT ELEMENT ++ds->index; LEVEL_DEBUG("Index %d", ds->index); if (ds->index % dir_gulp_elements == 0) { if (ds->LastDevice) { return search_done; } switch ( DS9490_directory(ds, pn) ) { case search_done: return search_done; case search_error: return search_error; case search_good: break; } } switch ( DirblobGet(ds->index % dir_gulp_elements, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat, SNvar(ds->sn)); return search_good; case -ENODEV: default: LEVEL_DEBUG("SN finished"); return search_done; } } // Read up to 7 (DS2490_DIR_GULP_ELEMENTS) at a time, and place into // a dirblob. Called from DS9490_next_both every 7 devices to fill. static enum search_status DS9490_directory(struct device_search *ds, const struct parsedname *pn) { BYTE status_buffer[ DS9490_getstatus_BUFFER_LENGTH ]; BYTE EP2_data[SERIAL_NUMBER_SIZE] ; //USB endpoint 3 buffer union { BYTE b[DS2490_BULK_BUFFER_SIZE] ; BYTE sn[DS2490_BULK_BUFFER_SIZE/SERIAL_NUMBER_SIZE][SERIAL_NUMBER_SIZE]; } EP3 ; //USB endpoint 3 buffer SIZE_OR_ERROR ret; int bytes_back; int devices_found; int device_index; int dir_gulp_elements = (pn->ds2409_depth==0) ? DS2490_DIR_GULP_ELEMENTS : 1 ; int readlen = 0 ; DirblobClear(&(ds->gulp)); if ( BAD( BUS_select(pn) ) ) { LEVEL_DEBUG("Selection problem before a directory listing") ; return search_error ; } if ( pn->selected_connection->AnyDevices == anydevices_no ) { // empty bus detected, no presence pulse detected return search_done ; } SetupDiscrepancy(ds, EP2_data); // set the search start location ret = DS9490_write(EP2_data, SERIAL_NUMBER_SIZE, pn) ; if ( ret < SERIAL_NUMBER_SIZE ) { LEVEL_DATA("bulk write problem = %d", ret); return search_error; } // Send the search request if ( BAD( USB_Control_Msg(COMM_CMD, COMM_SEARCH_ACCESS | COMM_IM | COMM_SM | COMM_F | COMM_RTS, (dir_gulp_elements << 8) | (ds->search), pn) ) ) { LEVEL_DATA("control error"); return search_error; } // read the search status if ( DS9490_getstatus(status_buffer, &readlen, pn) != BUS_RESET_OK ) { return search_error; } // test the buffer size waiting for us bytes_back = status_buffer[13]; LEVEL_DEBUG("Got %d bytes from USB search", bytes_back); if (bytes_back == 0) { /* Nothing found on the bus. Have to return something != search_good to avoid * getting stuck in loop in FS_realdir() and FS_alarmdir() * which ends when ret!=search_good */ LEVEL_DATA("ReadBufferstatus == 0"); return search_done; } else if ( bytes_back % SERIAL_NUMBER_SIZE != 0 ) { LEVEL_DATA("ReadBufferstatus size %d not a multiple of %d", bytes_back,SERIAL_NUMBER_SIZE); return search_error; } else if ( bytes_back > (dir_gulp_elements + 1) * SERIAL_NUMBER_SIZE ) { LEVEL_DATA("ReadBufferstatus size %d too large", bytes_back); return search_error; } devices_found = bytes_back / SERIAL_NUMBER_SIZE; if (devices_found > dir_gulp_elements) { devices_found = dir_gulp_elements; } // read in the buffer that holds the devices found if ((ret = DS9490_read(EP3.b, bytes_back, pn)) <= 0) { LEVEL_DATA("bulk read problem ret=%d", ret); return search_error; } // analyze each device found for (device_index = 0; device_index < devices_found; ++device_index) { /* test for CRC error */ LEVEL_DEBUG("gulp. Adding element %d:" SNformat, device_index, SNvar(EP3.sn[device_index])); if (CRC8(EP3.sn[device_index], SERIAL_NUMBER_SIZE) != 0 || EP3.sn[device_index][0] == 0) { LEVEL_DATA("CRC error"); return search_error; } } // all ok, so add the devices for (device_index = 0; device_index < devices_found; ++device_index) { DirblobAdd(EP3.sn[device_index], &(ds->gulp)); } ds->LastDiscrepancy = FindDiscrepancy(EP3.sn[devices_found-1], EP3.sn[devices_found]); ds->LastDevice = (bytes_back == devices_found * SERIAL_NUMBER_SIZE); // no more to read return search_good; } static void SetupDiscrepancy(const struct device_search *ds, BYTE * discrepancy) { int i; /** Play LastDescrepancy games with bitstream */ memcpy(discrepancy, ds->sn, SERIAL_NUMBER_SIZE); /* set buffer to zeros */ if (ds->LastDiscrepancy > -1) { UT_setbit(discrepancy, ds->LastDiscrepancy, 1); } /* This could be more efficiently done than bit-setting, but probably wouldn't make a difference */ for (i = ds->LastDiscrepancy + 1; i < 64; i++) { UT_setbit(discrepancy, i, 0); } } static int FindDiscrepancy(BYTE * last_sn, BYTE * discrepancy_sn) { int i; for (i = 63; i >= 0; i--) { if ((UT_getbit(discrepancy_sn, i) != 0) && (UT_getbit(last_sn, i) == 0)) { return i; } } return 0; } /* ------------------------------------------------------------ */ /* --- USB Open and Close --------------------------------------*/ // Open usb device, static GOOD_OR_BAD DS9490_open_and_name(struct usb_list *ul, struct connection_in *in) { if (in->master.usb.usb) { LEVEL_DEFAULT("DS9490 %s was NOT closed?", SOC(in)->devicename); return gbBAD ; } SAFEFREE(SOC(in)->devicename) ; SOC(in)->devicename = DS9490_device_name(ul); if (SOC(in)->devicename == NULL) { return gbBAD; } if ( BAD( DS9490_open( ul, in ) ) ) { STAT_ADD1_BUS(e_bus_open_errors, in); return gbBAD ; } else if ( BAD( DS9490_setup_adapter(in)) ) { LEVEL_DEFAULT("Error setting up USB DS9490 bus master at %s.", SOC(in)->devicename); DS9490_close( in ) ; return gbBAD ; } DS9490_SetFlexParameters(in); return gbGOOD ; } /* ------------------------------------------------------------ */ /* --- USB read and write --------------------------------------*/ static GOOD_OR_BAD DS9490_sendback_data(const BYTE * data, BYTE * resp, size_t len, const struct parsedname *pn) { size_t location = 0 ; while ( location < len ) { BYTE buffer[ DS9490_getstatus_BUFFER_LENGTH ]; int readlen ; size_t block = len - location ; if ( block > USB_FIFO_EACH ) { block = USB_FIFO_EACH ; } if ( DS9490_write( &data[location], block, pn) < (int) block) { LEVEL_DATA("USBsendback bulk write problem"); return gbBAD; } // COMM_BLOCK_IO | COMM_IM | COMM_F == 0x0075 readlen = block ; if (( BAD( USB_Control_Msg(COMM_CMD, COMM_BLOCK_IO | COMM_IM | COMM_F, block, pn)) ) || ( DS9490_getstatus(buffer, &readlen, pn) != BUS_RESET_OK ) // wait for len bytes ) { LEVEL_DATA("USBsendback control error"); STAT_ADD1_BUS(e_bus_errors, pn->selected_connection); return gbBAD; } if ( DS9490_read( &resp[location], block, pn) < 0) { LEVEL_DATA("USBsendback bulk read error"); return gbBAD; } location += block ; } return gbGOOD; } /* ------------------------------------------------------------ */ /* --- USB Power byte for temperature conversion ---------------*/ // Send 8 bits of communication to the 1-Wire Net and read the // 8 bits back from the 1-Wire Net. // The parameter 'byte' least significant 8 bits are used. After the // 8 bits are sent change the level of the 1-Wire net. // Delay delay msec and return to normal static GOOD_OR_BAD DS9490_PowerByte(BYTE byte, BYTE * resp, UINT delay, const struct parsedname *pn) { LEVEL_DATA("DS9490_PowerByte start"); /* This is more likely to be the correct way to handle powerbytes */ if ( BAD( USB_Control_Msg(COMM_CMD, COMM_BYTE_IO | COMM_IM | COMM_SPU, byte & 0xFF, pn)) ) { DS9490_HaltPulse(pn); return gbBAD ; } else if ( DS9490_read(resp, 1, pn) < 0) { /* Read back the result (may be the same as "byte") */ DS9490_HaltPulse(pn); return gbBAD ; } /* Delay with strong pullup */ LEVEL_DEBUG("DS9490_PowerByte DELAY:%d", delay); UT_delay(delay); DS9490_HaltPulse(pn); return gbGOOD ; } /* ------------------------------------------------------------ */ /* --- USB Program Pulse ---------------------------------------*/ static GOOD_OR_BAD DS9490_ProgramPulse(const struct parsedname *pn) { GOOD_OR_BAD ret; // set pullup to strong5 or program // set the strong pullup duration to infinite ret = USB_Control_Msg(COMM_CMD, COMM_PULSE | COMM_TYPE | COMM_IM, 0, pn); if ( GOOD(ret) ) { UT_delay_us(520); // 520 usec (480 usec would be enough) } if ( BAD(DS9490_HaltPulse(pn)) ) { LEVEL_DEBUG("Couldn't reset the program pulse level back to normal"); return gbBAD; } return ret ; } static GOOD_OR_BAD DS9490_HaltPulse(const struct parsedname *pn) { BYTE buffer[ DS9490_getstatus_BUFFER_LENGTH ]; struct timeval tv; struct timeval tvtarget; struct timeval tvlimit = { 0, 300000 } ; // 300 millisec from PDKit /ib/other/libUSB/libusbds2490.c if ( timernow( &tv ) < 0) { return gbBAD; } timeradd( &tv, &tvlimit, &tvtarget ) ; do { int readlen = -1 ; if ( BAD(USB_Control_Msg(CONTROL_CMD, CTL_HALT_EXE_IDLE, 0, pn)) ) { break; } if ( BAD(USB_Control_Msg(CONTROL_CMD, CTL_RESUME_EXE, 0, pn)) ) { break; } /* Can't wait for STATUSFLAGS_IDLE... just get first availalbe status flag */ if ( DS9490_getstatus(buffer, &readlen, pn) != BUS_RESET_OK ) { break; } // check the SPU flag if (!(buffer[8] & STATUSFLAGS_SPUA)) { return gbGOOD; } if ( timernow( &tv ) < 0) { return gbBAD; } } while ( timercmp( &tv, &tvtarget, >) ) ; LEVEL_DATA("DS9490_HaltPulse timeout"); return gbBAD; } /* ------------------------------------------------------------ */ /* --- USB Various Parameters ----------------------------------*/ static GOOD_OR_BAD DS9490_SetSpeed(const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; int ret = 0; // in case timeout value changed (via settings) -- sec -> msec in->master.usb.timeout = 1000 * Globals.timeout_usb; // Failed overdrive, switch to slow if (in->changed_bus_settings | CHANGED_USB_SPEED) { in->changed_bus_settings ^= CHANGED_USB_SPEED ; if (in->overdrive) { if ( BAD(DS9490_overdrive(pn)) ) { ++ ret; in->overdrive = 0 ; } else { LEVEL_DATA("set overdrive speed"); } } else if ( in->flex ) { if ( BAD(USB_Control_Msg(MODE_CMD, MOD_1WIRE_SPEED, ONEWIREBUSSPEED_FLEXIBLE, pn)) ) { ++ ret; } else { LEVEL_DATA("set flexible speed"); } } else { if ( BAD(USB_Control_Msg(MODE_CMD, MOD_1WIRE_SPEED, ONEWIREBUSSPEED_REGULAR, pn)) ) { ++ ret; } else { LEVEL_DATA("set regular speed"); } } } if (in->changed_bus_settings | CHANGED_USB_SLEW) { in->changed_bus_settings ^= CHANGED_USB_SLEW ; /* Slew Rate */ if ( BAD(USB_Control_Msg(MODE_CMD, MOD_PULLDOWN_SLEWRATE, in->master.usb.pulldownslewrate, pn)) ) { LEVEL_DATA("MOD_PULLDOWN_SLEWRATE error"); ++ret; } } if (in->changed_bus_settings | CHANGED_USB_LOW) { in->changed_bus_settings ^= CHANGED_USB_LOW ; /* Low Time */ if ( BAD(USB_Control_Msg(MODE_CMD, MOD_WRITE1_LOWTIME, in->master.usb.writeonelowtime, pn)) ) { LEVEL_DATA("MOD_WRITE1_LOWTIME error"); ++ret; } } if (in->changed_bus_settings | CHANGED_USB_OFFSET) { in->changed_bus_settings ^= CHANGED_USB_OFFSET ; /* DS0 Low */ if ( BAD(USB_Control_Msg(MODE_CMD, MOD_DSOW0_TREC, in->master.usb.datasampleoffset, pn)) ) { LEVEL_DATA("MOD_DS0W0 error"); ++ret; } } return ret>0 ? gbBAD : gbGOOD; } // Switch to overdrive speed -- 3 tries static GOOD_OR_BAD DS9490_overdrive(const struct parsedname *pn) { BYTE sp = _1W_OVERDRIVE_SKIP_ROM; BYTE resp; int i; // we need to change speed to overdrive for (i = 0; i < 3; i++) { LEVEL_DATA("set overdrive speed. Attempt %d",i); if ( BAD( gbRESET(BUS_reset(pn)) ) ) { continue; } if ( BAD( DS9490_sendback_data(&sp, &resp, 1, pn) ) || (_1W_OVERDRIVE_SKIP_ROM != resp) ) { LEVEL_DEBUG("error setting overdrive %.2X/0x%02X", _1W_OVERDRIVE_SKIP_ROM, resp); continue; } if ( GOOD( USB_Control_Msg(MODE_CMD, MOD_1WIRE_SPEED, ONEWIREBUSSPEED_OVERDRIVE, pn)) ) { LEVEL_DEBUG("speed is now set to overdrive"); return gbGOOD; } } LEVEL_DEBUG("Error setting overdrive after 3 retries"); return gbBAD; } static GOOD_OR_BAD DS9490_setup_adapter(struct connection_in * in) { struct parsedname s_pn; struct parsedname * pn = &s_pn ; BYTE buffer[ DS9490_getstatus_BUFFER_LENGTH ]; int readlen = 0 ; FS_ParsedName_Placeholder(pn); // minimal parsename -- no destroy needed pn->selected_connection = in; // reset the device (not the 1-wire bus) if ( BAD(USB_Control_Msg(CONTROL_CMD, CTL_RESET_DEVICE, 0x0000, pn))) { LEVEL_DATA("ResetDevice error"); return gbBAD; } // set the strong pullup duration to infinite if ( BAD( USB_Control_Msg(COMM_CMD, COMM_SET_DURATION | COMM_IM, 0x0000, pn)) ) { LEVEL_DATA("StrongPullup error"); return gbBAD; } // set the 12V pullup duration to 512us if ( BAD( USB_Control_Msg(COMM_CMD, COMM_SET_DURATION | COMM_IM | COMM_TYPE, PROGRAM_PULSE_DURATION_CODE, pn)) ) { LEVEL_DATA("12VPullup error"); return gbBAD; } // enable both program and strong pulses if ( BAD( USB_Control_Msg(MODE_CMD, MOD_PULSE_EN, ENABLE_PROGRAM_AND_PULSE, pn)) ) { LEVEL_DATA("EnableProgram error"); return gbBAD; } // enable speed changes if ( BAD( USB_Control_Msg(MODE_CMD, MOD_SPEED_CHANGE_EN, 1, pn)) ) { LEVEL_DATA("SpeedEnable error"); return gbBAD; } if ( DS9490_getstatus(buffer, &readlen, pn) != BUS_RESET_OK ) { LEVEL_DATA("getstatus failed error"); return gbBAD; } return gbGOOD; } static void DS9490_SetFlexParameters(struct connection_in *in) { /* in regular and overdrive speed, slew rate is 15V/us. It's only * suitable for short 1-wire busses. Use flexible speed instead. */ // default values for bus-timing when using --altUSB if (Globals.altUSB) { in->master.usb.pulldownslewrate = PARMSET_Slew1p37Vus; in->master.usb.writeonelowtime = PARMSET_W1L_10us; in->master.usb.datasampleoffset = PARMSET_DS0_W0R_8us; } else { /* This seem to be the default value when reseting the ds2490 chip */ // Change by Michael Markstaller from datasheet in->master.usb.pulldownslewrate = PARMSET_Slew1p10Vus; // in->master.usb.pulldownslewrate = PARMSET_Slew0p83Vus; in->master.usb.writeonelowtime = PARMSET_W1L_12us; in->master.usb.datasampleoffset = PARMSET_DS0_W0R_7us; } in->changed_bus_settings |= CHANGED_USB_SLEW | CHANGED_USB_LOW | CHANGED_USB_OFFSET ; } #endif /* OW_USB */ owfs-2.8p15/module/owlib/src/c/ow_fakeread.c0000664000175000017500000001007411447004227015642 00000000000000/* $Id: ow_fakeread.c,v 1.31 2010/09/24 02:10:31 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor $ID: $ */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ static ZERO_OR_ERROR FS_read_fake_single(struct one_wire_query *owq); static ZERO_OR_ERROR FS_read_fake_array(struct one_wire_query *owq); /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ #define Random (((_FLOAT)rand())/RAND_MAX) #define Random_y (rand()&0x01) #define Random_t (Random*100) #define Random_d (NOW_TIME*(1-.1*Random)) #define Random_i (rand()&0xFF) #define Random_u (rand()&0xFF) #define Random_b (rand()&0xFF) #define Random_a ('a'+(rand() % (26))) #define Random_f (100.*Random) ZERO_OR_ERROR FS_read_fake(struct one_wire_query *owq) { switch (OWQ_pn(owq).extension) { case EXTENSION_ALL: if (OWQ_offset(owq)) { return 0; } if (OWQ_size(owq) < FullFileLength(PN(owq))) { return -ERANGE; } return FS_read_fake_array(owq); case EXTENSION_BYTE: /* bitfield */ default: return FS_read_fake_single(owq); } } static ZERO_OR_ERROR FS_read_fake_single(struct one_wire_query *owq) { enum { type_a, type_b } format_type = type_a; // assume ascii switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: OWQ_I(owq) = Random_i; break; case ft_yesno: OWQ_Y(owq) = Random_y; break; case ft_bitfield: if (OWQ_pn(owq).extension == EXTENSION_BYTE) { OWQ_U(owq) = Random_u; } else { OWQ_Y(owq) = Random_y; } break; case ft_unsigned: OWQ_U(owq) = Random_u; break; case ft_temperature: { _FLOAT low = OWQ_pn(owq).selected_connection->master.fake.templow ; _FLOAT high = OWQ_pn(owq).selected_connection->master.fake.temphigh ; OWQ_F(owq) = low + (high-low)*Random_f/100.; } break; case ft_tempgap: case ft_pressure: case ft_float: OWQ_F(owq) = Random_f; break; case ft_date: OWQ_D(owq) = Random_d; break; case ft_binary: format_type = type_b; // binary // fall through case ft_vascii: case ft_alias: case ft_ascii: { size_t i; size_t length = FileLength(PN(owq)); ASCII random_chars[length]; for (i = 0; i < length; ++i) { random_chars[i] = (format_type == type_a) ? Random_a : Random_b; } return OWQ_format_output_offset_and_size(random_chars, length, owq); } case ft_directory: case ft_subdir: case ft_unknown: return -ENOENT; } return 0; // put data as string into buffer and return length } /* Read each array element independently, but return as one long string */ /* called when pn->extension==EXTENSION_ALL and pn->selected_filetype->ag->combined==ag_separate */ static ZERO_OR_ERROR FS_read_fake_array(struct one_wire_query *owq) { size_t elements = OWQ_pn(owq).selected_filetype->ag->elements; size_t extension; size_t entry_length = FileLength(PN(owq)); for (extension = 0; extension < elements; ++extension) { struct one_wire_query * owq_single = OWQ_create_separate( extension, owq ) ; if ( owq_single == NO_ONE_WIRE_QUERY ) { return -ENOMEM ; } switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: case ft_yesno: case ft_bitfield: case ft_unsigned: case ft_pressure: case ft_temperature: case ft_tempgap: case ft_float: case ft_date: break; case ft_vascii: case ft_alias: case ft_ascii: case ft_binary: OWQ_assign_read_buffer(&OWQ_buffer(owq)[extension * entry_length],entry_length,0,owq_single) ; break; case ft_directory: case ft_subdir: case ft_unknown: OWQ_destroy(owq_single) ; return -ENOENT; } if (FS_read_fake_single(owq_single)) { OWQ_destroy(owq_single) ; return -EINVAL; } memcpy(&OWQ_array(owq)[extension], &OWQ_val(owq_single), sizeof(union value_object)); OWQ_destroy(owq_single) ; } return 0; } owfs-2.8p15/module/owlib/src/c/ow_etherweather.c0000664000175000017500000001724111632033654016574 00000000000000/* $Id: ow_etherweather.c,v 1.45 2011/09/08 03:34:04 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* Written by Jacob Potter 2007 for the "EtherWeather": It started out as a school-related project, then grew into a hobby/for-fun thing, and now I'm polishing it off to be able to sell. The main components are an AVR microcontroller and Ethernet chip; I wrote all the interface and application code (using the uIP TCP/IP stack). I'm planning to keep the firmware closed, but the communication protocols and support code will all be open. The system listens on a TCP socket and acts as a low-level bus master (reset/bit/byte, strong pullup, and search acceleration), so it should be able to talk to any device supported by the code talking to it. Besides waiting for connections from PC-side software such as OWFS, it can also periodically connect to a remote system over the Internet to receive commands, and I've written some code to handle that as well. At the moment, I've built a few prototypes and am waiting for the next round of components and boards to come in. The majority of the software (firmware w/DHCP, bootloader, OWFS patch, and service daemon/Web interface) is working, although not polished off yet. The board is 2" x 3", runs off of 7-9v DC, and should cost around $50 (assembled/programmed, but without case and power supply). */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #define EtherWeather_COMMAND_RESET 'R' #define EtherWeather_COMMAND_ACCEL 'A' #define EtherWeather_COMMAND_BYTES 'B' #define EtherWeather_COMMAND_BITS 'b' #define EtherWeather_COMMAND_POWER 'P' static RESET_TYPE EtherWeather_reset(const struct parsedname *pn) ; static int EtherWeather_command(struct connection_in *in, char command, int datalen, const BYTE * idata, BYTE * odata) ; static void EtherWeather_close(struct connection_in *in); static GOOD_OR_BAD EtherWeather_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn); static enum search_status EtherWeather_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD EtherWeather_sendback_bits(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn); static GOOD_OR_BAD EtherWeather_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn); static void EtherWeather_setroutines(struct connection_in *in); static int EtherWeather_command(struct connection_in *in, char command, int datalen, const BYTE * idata, BYTE * odata) { BYTE *packet; // The packet's length field includes the command byte. packet = owmalloc(datalen + 2); packet[0] = datalen + 1; packet[1] = command; memcpy( &packet[2], idata, datalen); SOC(in)->timeout.tv_sec = 0 ; SOC(in)->timeout.tv_usec = 200000 ; if ( BAD(COM_write( packet, datalen+2, in) ) ) { ERROR_CONNECT("Trouble writing data to EtherWeather: %s", SAFESTRING(SOC(in)->devicename)); STAT_ADD1_BUS(e_bus_write_errors, in); owfree(packet) ; return -EIO ; } // Allow extra time for powered bytes if (command == 'P') { SOC(in)->timeout.tv_sec += 2 ; } // Read the response header if ( BAD(COM_read( packet, 2, in )) ) { LEVEL_CONNECT("header read error"); owfree(packet); return -EIO; } // Make sure it was echoed properly if (packet[0] != (datalen + 1) || packet[1] != command) { LEVEL_CONNECT("invalid header"); owfree(packet); return -EIO; } // Then read any data if (datalen > 0) { if ( BAD(COM_read( odata, datalen, in )) ) { LEVEL_CONNECT("data read error"); owfree(packet); return -EIO; } } owfree(packet); return 0; } static GOOD_OR_BAD EtherWeather_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { if (EtherWeather_command(pn->selected_connection, EtherWeather_COMMAND_BYTES, size, data, resp)) { return gbBAD; } return gbGOOD; } static GOOD_OR_BAD EtherWeather_sendback_bits(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { if (EtherWeather_command(pn->selected_connection, EtherWeather_COMMAND_BITS, size, data, resp)) { return gbBAD; } return gbGOOD; } static enum search_status EtherWeather_next_both(struct device_search *ds, const struct parsedname *pn) { BYTE sendbuf[9]; // if the last call was not the last one if (ds->LastDevice) { return search_done; } if ( BAD( BUS_select(pn) ) ) { return search_error ; } memcpy(sendbuf, ds->sn, SERIAL_NUMBER_SIZE); if (ds->LastDiscrepancy == -1) { sendbuf[8] = 0x40; } else { sendbuf[8] = ds->LastDiscrepancy; } if (ds->search == 0xEC) { sendbuf[8] |= 0x80; } if (EtherWeather_command(pn->selected_connection, EtherWeather_COMMAND_ACCEL, 9, sendbuf, sendbuf)) { return search_error; } if (sendbuf[8] == 0xFF) { /* No devices */ return search_done; } memcpy(ds->sn, sendbuf, 8); if (CRC8(ds->sn, 8) || (ds->sn[0] == 0)) { /* Bus error */ return search_error; } /* 0xFE indicates no discrepancies */ ds->LastDiscrepancy = sendbuf[8]; if (ds->LastDiscrepancy == 0xFE) { ds->LastDiscrepancy = -1; } ds->LastDevice = (sendbuf[8] == 0xFE); LEVEL_DEBUG("SN found: " SNformat, SNvar(ds->sn)); return search_good; } static GOOD_OR_BAD EtherWeather_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn) { BYTE pbbuf[2]; /* PowerByte command specifies delay in 500ms ticks, not milliseconds */ pbbuf[0] = (delay + 499) / 500; pbbuf[1] = byte; LEVEL_DEBUG("SPU: %d %d", pbbuf[0], pbbuf[1]); if (EtherWeather_command(pn->selected_connection, EtherWeather_COMMAND_POWER, 2, pbbuf, pbbuf)) { return gbBAD; } *resp = pbbuf[1]; return gbGOOD; } static void EtherWeather_close(struct connection_in *in) { // the standard COM-free cleans up the connection (void) in ; } static RESET_TYPE EtherWeather_reset(const struct parsedname *pn) { if (EtherWeather_command(pn->selected_connection, EtherWeather_COMMAND_RESET, 0, NULL, NULL)) { return BUS_RESET_ERROR; } return BUS_RESET_OK; } static void EtherWeather_setroutines(struct connection_in *in) { in->iroutines.detect = EtherWeather_detect; in->iroutines.reset = EtherWeather_reset; in->iroutines.next_both = EtherWeather_next_both; in->iroutines.PowerByte = EtherWeather_PowerByte; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = EtherWeather_sendback_data; in->iroutines.sendback_bits = EtherWeather_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = EtherWeather_close; in->iroutines.flags = ADAP_FLAG_overdrive | ADAP_FLAG_dirgulp | ADAP_FLAG_no2409path | ADAP_FLAG_no2404delay ; } GOOD_OR_BAD EtherWeather_detect(struct connection_in *in) { struct parsedname pn; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed pn.selected_connection = in; LEVEL_CONNECT("Connecting to EtherWeather"); /* Set up low-level routines */ EtherWeather_setroutines(in); if (SOC(in)->devicename == NULL) { return gbBAD; } SOC(in)->type = ct_tcp ; RETURN_BAD_IF_BAD( COM_open(in) ) ; /* TODO: probe version, and confirm that it's actually an EtherWeather */ LEVEL_CONNECT("Connected to EtherWeather at %s", SOC(in)->devicename); in->Adapter = adapter_EtherWeather; in->adapter_name = "EtherWeather"; in->busmode = bus_etherweather; return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_2436.c0000644000175000017500000002344711740076517014513 00000000000000/* $Id: ow_2436.c,v 1.60 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2436.h" /* ------- Prototypes ----------- */ /* DS2436 Battery */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_temp); READ_FUNCTION(FS_volts); WRITE_FUNCTION(FS_increment); WRITE_FUNCTION(FS_reset); READ_FUNCTION(FS_counter) ; #define _1W_2436_PAGESIZE 32 /* ------- Structures ----------- */ static struct aggregate A2436 = { 3, ag_numbers, ag_separate, }; static struct filetype DS2436[] = { F_STANDARD, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", _1W_2436_PAGESIZE, &A2436, ft_binary, fc_stable, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"volts", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"counter", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"counter/increment", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_uncached, NO_READ_FUNCTION, FS_increment, VISIBLE, NO_FILETYPE_DATA, }, {"counter/reset", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_uncached, NO_READ_FUNCTION, FS_reset, VISIBLE, NO_FILETYPE_DATA, }, {"counter/cycles", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_counter, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(1B, DS2436, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_READ_SCRATCHPAD 0x11 #define _1W_WRITE_SCRATCHPAD 0x17 #define _1W_COPY_SP1_TO_NV1 0x22 #define _1W_COPY_SP2_TO_NV2 0x25 #define _1W_COPY_SP3_TO_NV3 0x28 #define _1W_COPY_NV1_TO_SP1 0x71 #define _1W_COPY_NV2_TO_SP2 0x77 #define _1W_COPY_NV3_TO_SP3 0x7A #define _1W_LOCK_NV1 0x43 #define _1W_UNLOCK_NV1 0x44 #define _1W_CONVERT_T 0xD2 #define _1W_CONVERT_V 0xB4 #define _1W_READ_REGISTERS 0xB2 #define _1W_INCREMENT_CYCLE 0xB5 #define _1W_RESET_CYCLE_COUNTER 0xB8 #define _ADDRESS_TEMPERATURE 0x60 #define _ADDRESS_VOLTAGE 0x77 #define _ADDRESS_CYCLES 0x82 /* ------- Functions ------------ */ /* DS2436 */ static GOOD_OR_BAD OW_r_page(BYTE * p, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_page(const BYTE * p, size_t size, off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_temp(_FLOAT * T, const struct parsedname *pn); static GOOD_OR_BAD OW_volts(_FLOAT * V, const struct parsedname *pn); static GOOD_OR_BAD OW_nv1_lock( const struct parsedname *pn); static GOOD_OR_BAD OW_nv1_unlock( const struct parsedname *pn); static GOOD_OR_BAD OW_reset( const struct parsedname *pn); static GOOD_OR_BAD OW_increment( const struct parsedname *pn); static GOOD_OR_BAD OW_cycles( UINT * C, const struct parsedname *pn); /* 2436 A/D */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E(OW_r_page((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq) + (pn->extension)*_1W_2436_PAGESIZE, pn)) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); ZERO_OR_ERROR z_or_e ; // Special case for NV1 (page 0) -- need to unlock if ( pn->extension == 0 ) { RETURN_ERROR_IF_BAD( OW_nv1_unlock( pn ) ) ; } z_or_e = OW_w_page((BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq) + (pn->extension)*_1W_2436_PAGESIZE, pn) ; // Special case for NV1 (page 0) -- need to relock if ( pn->extension == 0 ) { OW_nv1_lock( pn ) ; } return z_or_e ; } static ZERO_OR_ERROR FS_temp(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_temp(&OWQ_F(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_volts(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_volts(&OWQ_F(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_reset(struct one_wire_query *owq) { if ( OWQ_Y(owq) == 0 ) { return 0 ; } FS_del_sibling( "counter/cycles", owq ) ; return GB_to_Z_OR_E (OW_reset( PN(owq) )) ; } static ZERO_OR_ERROR FS_increment(struct one_wire_query *owq) { if ( OWQ_Y(owq) == 0 ) { return 0 ; } FS_del_sibling( "counter/cycles", owq ) ; return GB_to_Z_OR_E (OW_increment( PN(owq) )) ; } static ZERO_OR_ERROR FS_counter(struct one_wire_query *owq) { return GB_to_Z_OR_E ( OW_cycles( &OWQ_U(owq), PN(owq) ) ) ; } /* DS2436 simple battery */ /* only called for a single page, and that page is 0,1,2 only*/ static GOOD_OR_BAD OW_r_page(BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { int page = offset / _1W_2436_PAGESIZE; // integer round-down ok BYTE scratchin[] = { _1W_READ_SCRATCHPAD, offset, }; static BYTE copyin[] = { _1W_COPY_NV1_TO_SP1, _1W_COPY_NV2_TO_SP2, _1W_COPY_NV3_TO_SP3, }; BYTE *copy = ©in[page]; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE1(copy), TRXN_DELAY(10), TRXN_END, }; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE2(scratchin), TRXN_READ(data, size), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; return BUS_transaction(tscratch, pn) ; } /* only called for a single page, and that page is 0,1,2 only*/ static GOOD_OR_BAD OW_w_page(const BYTE * data, size_t size, off_t offset, const struct parsedname *pn) { int page = offset / _1W_2436_PAGESIZE; // integer round-down ok BYTE scratchin[] = { _1W_READ_SCRATCHPAD, offset, }; BYTE scratchout[] = { _1W_WRITE_SCRATCHPAD, offset, }; BYTE p[_1W_2436_PAGESIZE]; static BYTE copyout[] = { _1W_COPY_SP1_TO_NV1, _1W_COPY_SP2_TO_NV2, _1W_COPY_SP3_TO_NV3, }; BYTE *copy = ©out[page]; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE2(scratchout), TRXN_WRITE(data, size), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE2(scratchin), TRXN_READ(p, size), TRXN_COMPARE(data, p, size), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE1(copy), TRXN_DELAY(10), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(twrite, pn)) ; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; return BUS_transaction(tcopy, pn) ; } static GOOD_OR_BAD OW_temp(_FLOAT * T, const struct parsedname *pn) { BYTE d2[] = { _1W_CONVERT_T, }; BYTE b2[] = { _1W_READ_REGISTERS, _ADDRESS_TEMPERATURE, }; BYTE t[2]; struct transaction_log tconvert[] = { TRXN_START, TRXN_WRITE1(d2), TRXN_DELAY(10), TRXN_END, }; struct transaction_log tdata[] = { TRXN_START, TRXN_WRITE2(b2), TRXN_READ3(t), TRXN_END, }; // initiate conversion RETURN_BAD_IF_BAD(BUS_transaction(tconvert, pn)) ; /* Get data */ RETURN_BAD_IF_BAD(BUS_transaction(tdata, pn)) ; // success //printf("Temp bytes %0.2X %0.2X\n",t[0],t[1]); //printf("temp int=%d\n",((int)((int8_t)t[1]))); //T[0] = ((int)((int8_t)t[1])) + .00390625*t[0] ; T[0] = UT_int16(t) / 256.; return gbGOOD; } static GOOD_OR_BAD OW_volts(_FLOAT * V, const struct parsedname *pn) { BYTE b4[] = { _1W_CONVERT_V, }; BYTE b2[] = { _1W_READ_REGISTERS, _ADDRESS_VOLTAGE, }; BYTE v[2]; struct transaction_log tconvert[] = { TRXN_START, TRXN_WRITE1(b4), TRXN_DELAY(10), TRXN_END, }; struct transaction_log tdata[] = { TRXN_START, TRXN_WRITE2(b2), TRXN_READ2(v), TRXN_END, }; // initiate conversion RETURN_BAD_IF_BAD(BUS_transaction(tconvert, pn)) ; /* Get data */ RETURN_BAD_IF_BAD( BUS_transaction(tdata, pn)) ; // success //V[0] = .01 * (_FLOAT)( ( ((uint32_t)v[1]) <<8 )|v[0] ) ; V[0] = .01 * (_FLOAT) (UT_uint16(v)); return gbGOOD; } static GOOD_OR_BAD OW_nv1_lock( const struct parsedname *pn) { BYTE p[] = { _1W_LOCK_NV1, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_DELAY(5), TRXN_END, }; return BUS_transaction( t, pn ) ; } static GOOD_OR_BAD OW_nv1_unlock( const struct parsedname *pn) { BYTE p[] = { _1W_UNLOCK_NV1, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_DELAY(5), TRXN_END, }; return BUS_transaction( t, pn ) ; } static GOOD_OR_BAD OW_reset( const struct parsedname *pn) { BYTE p[] = { _1W_RESET_CYCLE_COUNTER, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_END, }; return BUS_transaction( t, pn ) ; } static GOOD_OR_BAD OW_increment( const struct parsedname *pn) { BYTE p[] = { _1W_INCREMENT_CYCLE, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_DELAY(10), TRXN_END, }; return BUS_transaction( t, pn ) ; } static GOOD_OR_BAD OW_cycles( UINT * C, const struct parsedname *pn) { BYTE c[2] ; RETURN_BAD_IF_BAD( OW_r_page( c, 2, _ADDRESS_CYCLES, pn ) ) ; C[0] = UT_uint16(c) ; return 0 ; } owfs-2.8p15/module/owlib/src/c/ow_w1_parse.c0000644000175000017500000001760111673210412015616 00000000000000/* $Id: ow_w1_parse.c,v 1.47 2011/12/17 22:00:42 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is a modestly modified version of w1d by Evgeniy Polyakov */ /* * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" static void Netlink_Parse_Show( struct netlink_parse * nlp ) ; static GOOD_OR_BAD Get_and_Parse_Pipe( FILE_DESCRIPTOR_OR_ERROR file_descriptor, struct netlink_parse * nlp ) ; GOOD_OR_BAD Netlink_Parse_Buffer( struct netlink_parse * nlp ) { /* NLM Netlink header */ struct nlmsghdr * nlm = nlp->nlm ; // test message if ( ! NLMSG_OK(nlm,nlm->nlmsg_len) ) { LEVEL_DEBUG("Netlink message truncated"); // non-peek return gbBAD ; } // test pid if ( nlm->nlmsg_pid != 0 ) { LEVEL_DEBUG("Netlink (w1) Not from kernel"); // non-peek return gbBAD ; } // test type if ( nlm->nlmsg_type != NLMSG_DONE ) { LEVEL_DEBUG("Netlink (w1) Bad message type"); return gbBAD ; } // test length if ( nlm->nlmsg_len < W1_NLM_LENGTH + W1_CN_LENGTH + W1_W1M_LENGTH ) { LEVEL_DEBUG("Netlink (w1) Bad message length (%d)",nlm->nlmsg_len ); return gbBAD ; } /* CONNECTOR MESSAGE */ nlp->cn = (struct cn_msg *) NLMSG_DATA(nlm) ; // sequence numbers if ( nlm->nlmsg_seq != nlp->cn->seq ) { LEVEL_DEBUG("Netlink (w1) sequence numbers internally inconsistent nlm_seq=%u|%u cn_seq=%u|%u", NL_BUS(nlm->nlmsg_seq), NL_SEQ(nlm->nlmsg_seq),NL_BUS(nlp->cn->seq),NL_SEQ(nlp->cn->seq)); return gbBAD ; } /* W1_NETLINK_MESSAGE */ nlp->w1m = (struct w1_netlink_msg *) nlp->cn->data ; //printf("w1m=%p nlm=%p \n" , nlp->w1m, nlm ) ; /* W1_NETLINK_COMMAND -- optional depending on w1_netlink_message type */ switch (nlp->w1m->type) { case W1_SLAVE_ADD: case W1_SLAVE_REMOVE: case W1_MASTER_ADD: case W1_MASTER_REMOVE: case W1_LIST_MASTERS: nlp->w1c = NULL ; nlp->data = nlp->w1m->data ; nlp->data_size = nlp->w1m->len ; break ; case W1_MASTER_CMD: case W1_SLAVE_CMD: nlp->w1c = (struct w1_netlink_cmd *) nlp->w1m->data ; nlp->data = nlp->w1c->data ; nlp->data_size = nlp->w1c->len ; } if ( nlp->data_size == 0 ) { nlp->data = NULL ; } return gbGOOD ; } GOOD_OR_BAD Netlink_Parse_Get( struct netlink_parse * nlp ) { struct nlmsghdr peek_nlm ; // first peek at message to get length and details LEVEL_DEBUG("Wait to peek at message"); int recv_len = recv( SOC(Inbound_Control.w1_monitor)->file_descriptor, &peek_nlm, W1_NLM_LENGTH, MSG_PEEK ); // Set time of last read _MUTEX_LOCK(Inbound_Control.w1_monitor->master.w1_monitor.read_mutex) ; timernow( &(Inbound_Control.w1_monitor->master.w1_monitor.last_read) ); _MUTEX_UNLOCK(Inbound_Control.w1_monitor->master.w1_monitor.read_mutex) ; LEVEL_DEBUG("Pre-parse header: %u bytes len=%u type=%u seq=%u|%u pid=%u",recv_len,peek_nlm.nlmsg_len,peek_nlm.nlmsg_type,NL_BUS(peek_nlm.nlmsg_seq),NL_SEQ(peek_nlm.nlmsg_seq),peek_nlm.nlmsg_pid); if (recv_len < 0) { ERROR_DEBUG("Netlink (w1) recv header error"); return gbBAD ; } // allocate space nlp->nlm = owmalloc( peek_nlm.nlmsg_len ) ; if ( nlp->nlm == NULL ) { LEVEL_DEBUG("Netlink (w1) Cannot allocate %d byte buffer for data",peek_nlm.nlmsg_len) ; return gbBAD ; } // read whole packet recv_len = recv( SOC(Inbound_Control.w1_monitor)->file_descriptor, &(nlp->nlm[0]), peek_nlm.nlmsg_len, 0 ); if (recv_len == -1) { ERROR_DEBUG("Netlink (w1) recv body error"); return gbBAD ; } if ( GOOD( Netlink_Parse_Buffer( nlp )) ) { LEVEL_DEBUG("Netlink read -----------------"); Netlink_Parse_Show( nlp ) ; return gbGOOD ; } return gbBAD ; } /* Reads a packet from a pipe that was originally a netlink packet */ /* allocate buffer but free unless able to read and parse nlm fully */ static GOOD_OR_BAD Get_and_Parse_Pipe( FILE_DESCRIPTOR_OR_ERROR file_descriptor, struct netlink_parse * nlp ) { struct nlmsghdr peek_nlm ; struct nlmsghdr * nlm ; size_t payload_length ; // first read start of message to get length and details if ( read( file_descriptor, &peek_nlm, W1_NLM_LENGTH ) != W1_NLM_LENGTH ) { ERROR_DEBUG("Pipe (w1) read header error"); return gbBAD ; } LEVEL_DEBUG("Pipe header: len=%u type=%u seq=%u|%u pid=%u ",peek_nlm.nlmsg_len,peek_nlm.nlmsg_type,NL_BUS(peek_nlm.nlmsg_seq),NL_SEQ(peek_nlm.nlmsg_seq),peek_nlm.nlmsg_pid); // allocate space nlm = owmalloc( peek_nlm.nlmsg_len ) ; nlp->nlm = nlm ; if ( nlm == NULL ) { LEVEL_DEBUG("Netlink (w1) Cannot allocate %d byte buffer for data", peek_nlm.nlmsg_len ) ; return gbBAD ; } memcpy( nlm, &peek_nlm, W1_NLM_LENGTH ) ; // copy header // read rest of packet payload_length = peek_nlm.nlmsg_len - W1_NLM_LENGTH ; if ( read( file_descriptor, NLMSG_DATA(nlm), payload_length ) != (ssize_t) payload_length ) { owfree(nlm) ; nlp->nlm = NULL ; ERROR_DEBUG("Pipe (w1) read payload error"); return gbBAD ; } if ( BAD( Netlink_Parse_Buffer( nlp )) ) { LEVEL_DEBUG("Buffer parsing error"); owfree(nlm) ; nlp->nlm = NULL ; return gbBAD ; } // Good, the receiving routine should owfree buffer LEVEL_DEBUG("Pipe read --------------------"); Netlink_Parse_Show( nlp ) ; return gbGOOD ; } static void Netlink_Parse_Show( struct netlink_parse * nlp ) { Netlink_Print( nlp->nlm, nlp->cn, nlp->w1m, nlp->w1c, nlp->data, nlp->data_size ) ; } enum Netlink_Read_Status W1_Process_Response( void (* nrs_callback)( struct netlink_parse * nlp, void * v, const struct parsedname * pn), SEQ_OR_ERROR seq, void * v, const struct parsedname * pn ) { struct connection_in * in = pn->selected_connection ; FILE_DESCRIPTOR_OR_ERROR file_descriptor ; int bus ; if ( seq == SEQ_BAD ) { return nrs_bad_send ; } if ( in == NO_CONNECTION ) { // Send to main netlink rather than a particular bus file_descriptor = FILE_DESCRIPTOR_BAD ; bus = 0 ; } else { // Bus-specifc file_descriptor = in->master.w1.netlink_pipe[fd_pipe_read] ; bus = in->master.w1.id ; } while ( GOOD( W1PipeSelect_timeout(file_descriptor)) ) { struct netlink_parse nlp ; nlp.nlm = NULL ; LEVEL_DEBUG("Loop waiting for netlink piped message"); if ( BAD( Get_and_Parse_Pipe( file_descriptor, &nlp )) ) { LEVEL_DEBUG("Error reading pipe for w1_bus_master%d",bus); // Don't need to free since nlm not set if BAD return nrs_error ; } if ( NL_SEQ(nlp.nlm->nlmsg_seq) != (unsigned int) seq ) { LEVEL_DEBUG("Netlink sequence number out of order"); owfree(nlp.nlm) ; continue ; } if ( nlp.w1m->status != 0) { owfree(nlp.nlm) ; return nrs_nodev ; } if ( nrs_callback == NULL ) { // status message owfree(nlp.nlm) ; return nrs_complete ; } LEVEL_DEBUG("About to call nrs_callback"); nrs_callback( &nlp, v, pn ) ; LEVEL_DEBUG("Called nrs_callback"); owfree(nlp.nlm) ; if ( nlp.cn->ack != 0 ) { if ( nlp.w1m->type == W1_LIST_MASTERS ) { continue ; // look for more data } if ( nlp.w1c && (nlp.w1c->cmd==W1_CMD_SEARCH || nlp.w1c->cmd==W1_CMD_ALARM_SEARCH) ) { continue ; // look for more data } } nrs_callback = NULL ; // now look for status message } return nrs_timeout ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_stats.c0000644000175000017500000004462011740076517015247 00000000000000/* $Id: ow_stats.c,v 1.79 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Stats are a pseudo-device -- they are a file-system entry and handled as such, but have a different caching type to distiguish their handling */ #include #include "owfs_config.h" #include "ow_stats.h" #include "ow_counters.h" /* ----------------- */ /* ---- Globalss ---- */ /* ----------------- */ UINT cache_flips = 0; UINT cache_adds = 0; struct average old_avg = { 0L, 0L, 0L, 0L, }; struct average new_avg = { 0L, 0L, 0L, 0L, }; struct average store_avg = { 0L, 0L, 0L, 0L, }; struct cache_stats cache_ext = { 0L, 0L, 0L, 0L, 0L, }; struct cache_stats cache_int = { 0L, 0L, 0L, 0L, 0L, }; struct cache_stats cache_dir = { 0L, 0L, 0L, 0L, 0L, }; struct cache_stats cache_pst = { 0L, 0L, 0L, 0L, 0L, }; struct cache_stats cache_dev = { 0L, 0L, 0L, 0L, 0L, }; UINT read_calls = 0; UINT read_cache = 0; UINT read_bytes = 0; UINT read_cachebytes = 0; UINT read_array = 0; UINT read_tries[3] = { 0, 0, 0, }; UINT read_success = 0; struct average read_avg = { 0L, 0L, 0L, 0L, }; UINT write_calls = 0; UINT write_bytes = 0; UINT write_array = 0; UINT write_tries[3] = { 0, 0, 0, }; UINT write_success = 0; struct average write_avg = { 0L, 0L, 0L, 0L, }; struct directory dir_main = { 0L, 0L, }; struct directory dir_dev = { 0L, 0L, }; UINT dir_depth = 0; struct average dir_avg = { 0L, 0L, 0L, 0L, }; /* max delay between a write and when reading first char */ struct timeval max_delay = { 0, 0, }; // ow_locks.c UINT total_bus_locks = 0; UINT total_bus_unlocks = 0; // ow_crc.c UINT CRC8_tries = 0; UINT CRC8_errors = 0; UINT CRC16_tries = 0; UINT CRC16_errors = 0; // ow_net.c UINT NET_accept_errors = 0; UINT NET_connection_errors = 0; UINT NET_read_errors = 0; // ow_bus.c UINT BUS_send_data_errors = 0; UINT BUS_send_data_memcmp_errors = 0; UINT BUS_readin_data_errors = 0; UINT BUS_detect_errors = 0; UINT BUS_level_errors = 0; UINT BUS_next_errors = 0; UINT BUS_next_alarm_errors = 0; UINT BUS_bit_errors = 0; UINT BUS_byte_errors = 0; UINT BUS_echo_errors = 0; UINT BUS_tcsetattr_errors = 0; UINT BUS_status_errors = 0; // ow_ds9097U.c UINT DS2480_read_fd_isset = 0; UINT DS2480_read_null = 0; UINT DS2480_read_read = 0; UINT DS2480_level_docheck_errors = 0; struct average all_avg = { 0L, 0L, 0L, 0L, }; /* ------- Prototypes ----------- */ /* Statistics reporting */ READ_FUNCTION(FS_stat); READ_FUNCTION(FS_time); READ_FUNCTION(FS_return_code); /* -------- Structures ---------- */ static struct filetype stats_cache[] = { {"flips", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_flips}, }, {"additions", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_adds}, }, {"primary", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"primary/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&new_avg.current}, }, {"primary/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&new_avg.sum}, }, {"primary/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&new_avg.count}, }, {"primary/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&new_avg.max}, }, {"secondary", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"secondary/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&old_avg.current}, }, {"secondary/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&old_avg.sum}, }, {"secondary/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&old_avg.count}, }, {"secondary/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&old_avg.max}, }, {"persistent", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"persistent/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&store_avg.current,}, }, {"persistent/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&store_avg.sum}, }, {"persistent/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&store_avg.count}, }, {"persistent/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&store_avg.max}, }, {"external", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"external/tries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_ext.tries}, }, {"external/hits", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_ext.hits}, }, {"external/added", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_ext.adds,}, }, {"external/expired", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_ext.expires,}, }, {"external/deleted", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_ext.deletes,}, }, {"internal", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"internal/tries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_int.tries}, }, {"internal/hits", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_int.hits}, }, {"internal/added", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_int.adds,}, }, {"internal/expired", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_int.expires,}, }, {"internal/deleted", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_int.deletes,}, }, {"directory", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"directory/tries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dir.tries}, }, {"directory/hits", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dir.hits}, }, {"directory/added", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dir.adds}, }, {"directory/expired", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dir.expires,}, }, {"directory/deleted", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dir.deletes,}, }, {"device", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device/tries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dev.tries}, }, {"device/hits", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dev.hits}, }, {"device/added", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dev.adds}, }, {"device/expired", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dev.expires,}, }, {"device/deleted", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&cache_dev.deletes,}, }, }; struct device d_stats_cache = { "cache", "cache", 0, COUNT_OF_FILETYPES(stats_cache), stats_cache, NO_GENERIC_READ, NO_GENERIC_WRITE }; // Note, the store hit rate and deletions are not shown -- too much information! static struct aggregate Aread = { 3, ag_numbers, ag_separate, }; static struct filetype stats_read[] = { {"calls", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_calls}, }, {"cachesuccess", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_cache}, }, {"cachebytes", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_cachebytes}, }, {"success", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_success}, }, {"bytes", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_bytes}, }, {"tries", PROPERTY_LENGTH_UNSIGNED, &Aread, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_tries}, }, }; struct device d_stats_read = { "read", "read", 0, COUNT_OF_FILETYPES(stats_read), stats_read, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype stats_write[] = { {"calls", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_calls}, }, {"success", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_success}, }, {"bytes", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_bytes}, }, {"tries", PROPERTY_LENGTH_UNSIGNED, &Aread, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_tries}, }, }; struct device d_stats_write = { "write", "write", 0, COUNT_OF_FILETYPES(stats_write), stats_write, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype stats_directory[] = { {"maxdepth", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_depth}, }, {"bus", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"bus/calls", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_main.calls}, }, {"bus/entries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_main.entries}, }, {"device", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"device/calls", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_dev.calls}, }, {"device/entries", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_dev.entries}, }, } ; struct device d_stats_directory = { "directory", "directory", 0, COUNT_OF_FILETYPES(stats_directory), stats_directory, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype stats_thread[] = { {"directory", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"directory/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_avg.current}, }, {"directory/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_avg.sum}, }, {"directory/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_avg.count}, }, {"directory/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&dir_avg.max}, }, {"overall", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"overall/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&all_avg.current}, }, {"overall/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&all_avg.sum}, }, {"overall/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&all_avg.count}, }, {"overall/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&all_avg.max}, }, {"read", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"read/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_avg.current}, }, {"read/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_avg.sum}, }, {"read/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_avg.count}, }, {"read/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&read_avg.max}, }, {"write", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"write/now", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_avg.current,}, }, {"write/sum", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_avg.sum}, }, {"write/num", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_avg.count}, }, {"write/max", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v:&write_avg.max}, }, }; struct device d_stats_thread = { "threads", "threads", 0, COUNT_OF_FILETYPES(stats_thread), stats_thread, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct aggregate Areturn_code = { N_RETURN_CODES, ag_numbers, ag_separate, }; static struct filetype stats_return_code[] = { {"responses", PROPERTY_LENGTH_UNSIGNED, &Areturn_code, ft_unsigned, fc_statistic, FS_return_code, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; struct device d_stats_return_code = { "return_codes", "return_codes", 0, COUNT_OF_FILETYPES(stats_return_code), stats_return_code, NO_GENERIC_READ, NO_GENERIC_WRITE }; #define FS_stat_ROW(var) {"" #var "",PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE , ft_unsigned, fc_statistic, FS_stat, NO_WRITE_FUNCTION, VISIBLE, {v: & var,}, } static struct filetype stats_errors[] = { {"max_delay", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_statistic, FS_time, NO_WRITE_FUNCTION, VISIBLE, {v:&max_delay}, }, // ow_net.c FS_stat_ROW(NET_accept_errors), FS_stat_ROW(NET_read_errors), FS_stat_ROW(NET_connection_errors), // ow_bus.c FS_stat_ROW(BUS_readin_data_errors), FS_stat_ROW(BUS_detect_errors), FS_stat_ROW(BUS_level_errors), FS_stat_ROW(BUS_next_errors), FS_stat_ROW(BUS_next_alarm_errors), FS_stat_ROW(BUS_bit_errors), FS_stat_ROW(BUS_byte_errors), FS_stat_ROW(BUS_echo_errors), FS_stat_ROW(BUS_tcsetattr_errors), FS_stat_ROW(BUS_status_errors), // ow_ds9097U.c FS_stat_ROW(DS2480_read_fd_isset), FS_stat_ROW(DS2480_read_null), FS_stat_ROW(DS2480_read_read), FS_stat_ROW(DS2480_level_docheck_errors), FS_stat_ROW(CRC8_errors), FS_stat_ROW(CRC8_tries), FS_stat_ROW(CRC16_errors), FS_stat_ROW(CRC16_tries), } ; struct device d_stats_errors = { "errors", "errors", 0, COUNT_OF_FILETYPES(stats_errors), stats_errors, NO_GENERIC_READ, NO_GENERIC_WRITE }; /* ------- Functions ------------ */ static ZERO_OR_ERROR FS_stat(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int dindex = pn->extension; if (dindex < 0) { dindex = 0; } if (pn->selected_filetype == NO_FILETYPE) { return -ENOENT; } if (pn->selected_filetype->data.v == NULL) { return -ENOENT; } STATLOCK; OWQ_U(owq) = ((UINT *) pn->selected_filetype->data.v)[dindex]; STATUNLOCK; return 0; } static ZERO_OR_ERROR FS_time(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int dindex = pn->extension; struct timeval *tv; if (dindex < 0) { dindex = 0; } if (pn->selected_filetype == NO_FILETYPE) { return -ENOENT; } tv = (struct timeval *) pn->selected_filetype->data.v; if (tv == NULL) { return -ENOENT; } STATLOCK; OWQ_F(owq) = TVfloat( &(tv[dindex]) ) ; STATUNLOCK; return 0; } static ZERO_OR_ERROR FS_return_code( struct one_wire_query * owq) { OWQ_U(owq) = return_code_calls[PN(owq)->extension] ; return 0 ; } owfs-2.8p15/module/owlib/src/c/ow_2404.c0000644000175000017500000002714511740076517014505 00000000000000/* $Id: ow_2404.c,v 1.62 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2404.h" /* ------- Prototypes ----------- */ /* DS1902 ibutton memory */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_alarm); READ_FUNCTION(FS_r_set_alarm); WRITE_FUNCTION(FS_w_set_alarm); READ_FUNCTION(FS_r_counter4); WRITE_FUNCTION(FS_w_counter4); READ_FUNCTION(FS_r_counter5); WRITE_FUNCTION(FS_w_counter5); READ_FUNCTION(FS_r_flag); WRITE_FUNCTION(FS_w_flag); /* ------- Structures ----------- */ static struct aggregate A2404 = { 16, ag_numbers, ag_separate, }; static struct filetype DS2404[] = { F_STANDARD, {"memory", 512, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2404, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_alarm, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_set_alarm, FS_w_set_alarm, VISIBLE, NO_FILETYPE_DATA, }, {"running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x10}, }, {"auto", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x20}, }, {"start", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x40}, }, {"delay", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x80}, }, {"date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"udate"}, }, {"udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter5, FS_w_counter5, VISIBLE, {s:0x202}, }, {"cycle", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter4, FS_w_counter4, VISIBLE, {s:0x20C}, }, {"interval", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"interval/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"interval/udate"}, }, {"interval/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter5, FS_w_counter5, VISIBLE, {s:0x207}, }, {"trigger", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"trigger/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"trigger/udate"}, }, {"trigger/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter5, FS_w_counter5, VISIBLE, {s:0x210}, }, {"trigger/interval_date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"trigger/interval_udate"}, }, {"trigger/interval_udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter5, FS_w_counter5, VISIBLE, {s:0x215}, }, {"trigger/cycle", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter4, FS_w_counter4, VISIBLE, {s:0x21A}, }, {"readonly", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"readonly/memory", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x08}, }, {"readonly/cycle", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x04}, }, {"readonly/interval", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x02}, }, {"readonly/clock", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_flag, FS_w_flag, VISIBLE, {c:0x01}, }, }; DeviceEntryExtended(04, DS2404, DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_READ_MEMORY 0xF0 /* ------- Functions ------------ */ /* DS2404 */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_ulong(uint64_t * L, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_ulong(uint64_t * L, size_t size, off_t offset, struct parsedname *pn); static void OW_reset(struct parsedname *pn) ; static UINT Avals[] = { 0, 1, 10, 11, 100, 101, 110, 111, }; /* 2404 */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { /* read is consecutive, unchecked. No paging */ ZERO_OR_ERROR read_status = COMMON_read_memory_F0(owq, 0, 0) ; OW_reset(PN(owq)) ; // DS2404 needs this to release for 3-wire communication return read_status ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; ZERO_OR_ERROR error_code = COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem) ; /* paged write */ if (error_code != 0) { error_code = -EFAULT ; } OW_reset(PN(owq)) ; // DS2404 needs this to release for 3-wire communication return error_code ; } /* set clock */ static ZERO_OR_ERROR FS_w_counter5(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); uint64_t L = ((uint64_t) OWQ_U(owq)) << 8; return OW_w_ulong(&L, 5, pn->selected_filetype->data.s, pn)?-EINVAL:0; } /* set clock */ static ZERO_OR_ERROR FS_w_counter4(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); uint64_t L = ((uint64_t) OWQ_U(owq)); return OW_w_ulong(&L, 4, pn->selected_filetype->data.s, pn)?-EINVAL:0; } /* read clock */ static ZERO_OR_ERROR FS_r_counter5(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); uint64_t L; if (OW_r_ulong(&L, 5, pn->selected_filetype->data.s, pn)) { return -EINVAL; } OWQ_U(owq) = L >> 8; return 0; } /* read clock */ static ZERO_OR_ERROR FS_r_counter4(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); uint64_t L; if (OW_r_ulong(&L, 4, pn->selected_filetype->data.s, pn)) { return -EINVAL; } OWQ_U(owq) = L; return 0; } /* alarm */ static ZERO_OR_ERROR FS_w_set_alarm(struct one_wire_query *owq) { BYTE c; switch (OWQ_U(owq)) { case 0: c = 0 << 3; break; case 1: c = 1 << 3; break; case 10: c = 2 << 3; break; case 11: c = 3 << 3; break; case 100: c = 4 << 3; break; case 101: c = 5 << 3; break; case 110: c = 6 << 3; break; case 111: c = 7 << 3; break; default: return -ERANGE; } if (OW_w_mem(&c, 1, 0x200, PN(owq))) { return -EINVAL; } return 0; } static ZERO_OR_ERROR FS_r_alarm(struct one_wire_query *owq) { BYTE c; OWQ_allocate_struct_and_pointer(owq_alarm); OWQ_create_temporary(owq_alarm, (char *) &c, 1, 0x0200, PN(owq)); if (COMMON_read_memory_F0(owq_alarm, 0, 0)) { return -EINVAL; } OWQ_U(owq) = Avals[c & 0x07]; return 0; } static ZERO_OR_ERROR FS_r_set_alarm(struct one_wire_query *owq) { BYTE c; OWQ_allocate_struct_and_pointer(owq_alarm); OWQ_create_temporary(owq_alarm, (char *) &c, 1, 0x0200, PN(owq)); if (COMMON_read_memory_F0(owq_alarm, 0, 0)) { return -EINVAL; } OWQ_U(owq) = Avals[(c >> 3) & 0x07]; return 0; } /* write flag */ static ZERO_OR_ERROR FS_w_flag(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE cr; BYTE fl = pn->selected_filetype->data.c; OWQ_allocate_struct_and_pointer(owq_flag); OWQ_create_temporary(owq_flag, (char *) &cr, 1, 0x0201, pn); if (COMMON_read_memory_F0(owq_flag, 0, 0)) { return -EINVAL; } if (OWQ_Y(owq)) { if (cr & fl) { return 0; } } else { if ((cr & fl) == 0) { return 0; } } cr ^= fl; /* flip the bit */ if (OW_w_mem(&cr, 1, 0x0201, pn)) { return -EINVAL; } return 0; } /* read flag */ static ZERO_OR_ERROR FS_r_flag(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE cr; BYTE fl = pn->selected_filetype->data.c; OWQ_allocate_struct_and_pointer(owq_flag); OWQ_create_temporary(owq_flag, (char *) &cr, 1, 0x0201, pn); if (COMMON_read_memory_F0(owq_flag, 0, 0)) { return -EINVAL; } OWQ_Y(owq) = (cr & fl) ? 1 : 0; return 0; } /* PAged access -- pre-screened */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[4 + 32] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(p), TRXN_WRITE(data, size), TRXN_END, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE1(p), TRXN_READ(&p[1], 3 + size), TRXN_COMPARE(data, &p[4], size), TRXN_END, }; struct transaction_log tsram[] = { TRXN_START, TRXN_WRITE(p, 4), TRXN_DELAY(32), TRXN_END, }; /* Copy to scratchpad */ RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; /* Re-read scratchpad and compare */ p[0] = _1W_READ_SCRATCHPAD; RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; /* Copy Scratchpad to SRAM */ p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(tsram, pn) ; } /* read 4 or 5 byte number */ static GOOD_OR_BAD OW_r_ulong(uint64_t * L, size_t size, off_t offset, struct parsedname *pn) { BYTE data[5] = { 0x00, 0x00, 0x00, 0x00, 0x00, }; OWQ_allocate_struct_and_pointer(owq_ulong); OWQ_create_temporary(owq_ulong, (char *) data, size, offset, pn); if (size > 5) { return gbBAD; } if (COMMON_read_memory_F0(owq_ulong, 0, 0)) { return gbBAD; } L[0] = ((uint64_t) data[0]) + (((uint64_t) data[1]) << 8) + (((uint64_t) data[2]) << 16) + (((uint64_t) data[3]) << 24) + (((uint64_t) data[4]) << 32); return gbGOOD; } /* write 4 or 5 byte number */ static GOOD_OR_BAD OW_w_ulong(uint64_t * L, size_t size, off_t offset, struct parsedname *pn) { BYTE data[5] = { 0x00, 0x00, 0x00, 0x00, 0x00, }; if (size > 5) { return -ERANGE; } data[0] = BYTE_MASK(L[0]); data[1] = BYTE_MASK(L[0] >> 8); data[2] = BYTE_MASK(L[0] >> 16); data[3] = BYTE_MASK(L[0] >> 24); data[4] = BYTE_MASK(L[0] >> 32); if (OW_w_mem(data, size, offset, pn)) { return gbBAD; } return gbGOOD; } static void OW_reset(struct parsedname *pn) { struct transaction_log t[] = { TRXN_RESET, }; BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_pid.c0000664000175000017500000000213511327344454014661 00000000000000/* $Id: ow_pid.c,v 1.9 2010/01/25 16:39:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_pid.h" /* Globalss */ int pid_created = 0; /* flag flag when file actually created */ char *pid_file = NULL; /* filename where PID number stored */ void PIDstart(void) { /* store the PID */ pid_t pid_num = getpid(); if (pid_file) { FILE *pid = fopen(pid_file, "w+"); if (pid == NULL) { ERROR_CONNECT("Cannot open PID file: %s", pid_file); owfree(pid_file); pid_file = NULL; } else { fprintf(pid, "%lu", (unsigned long int) pid_num); fclose(pid); pid_created = 1; } } } /* All ow library closeup */ void PIDstop(void) { if (pid_created && pid_file) { if (unlink(pid_file)) { ERROR_CONNECT("Cannot remove PID file: %s", pid_file); } owfree(pid_file); pid_file = NULL; } } owfs-2.8p15/module/owlib/src/c/ow_sibling_binary.c0000664000175000017500000000475411446543274017114 00000000000000/* $Id: ow_sibling_binary.c,v 1.5 2010/09/23 03:17:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" ZERO_OR_ERROR FS_r_sibling_binary(char * data, size_t * size, const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; SIZE_OR_ERROR sib_status ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } if ( GOOD( OWQ_allocate_read_buffer(owq_sibling)) ) { OWQ_offset(owq_sibling) = 0 ; sib_status = FS_read_local(owq_sibling) ; if ( (sib_status >= 0) && (OWQ_length(owq_sibling) <= size[0]) ) { memset(data, 0, size[0] ) ; size[0] = OWQ_length(owq_sibling) ; memcpy( data, OWQ_buffer(owq_sibling), size[0] ) ; sib_status = 0 ; } else { sib_status = -ENOMEM ; } } else { sib_status = -ENOMEM ; } OWQ_destroy(owq_sibling) ; return sib_status ; } ZERO_OR_ERROR FS_w_sibling_binary(char * data, size_t size, off_t offset, const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; SIZE_OR_ERROR write_error ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } OWQ_assign_write_buffer(data, size, offset, owq_sibling) ; write_error = FS_write_local(owq_sibling) ; OWQ_destroy(owq_sibling) ; return write_error ; } owfs-2.8p15/module/owlib/src/c/ow_byte.c0000664000175000017500000000250011447211130015027 00000000000000/* $Id: ow_byte.c,v 1.3 2010/09/24 21:04:24 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" struct one_wire_query * ALLtoBYTE(struct one_wire_query *owq_all) { struct one_wire_query * owq_byte = OWQ_create_separate( EXTENSION_BYTE, owq_all ); size_t elements = PN(owq_all)->selected_filetype->ag->elements ; size_t extension ; if ( owq_byte == NO_ONE_WIRE_QUERY ) { return NO_ONE_WIRE_QUERY ; } for ( extension = 0 ; extension < elements ; ++extension ) { UT_setbit( (BYTE *) &OWQ_U(owq_byte), extension, OWQ_array_Y(owq_all,extension) ) ; } return owq_byte ; } struct one_wire_query * BYTEtoALL(struct one_wire_query *owq_byte) { struct one_wire_query * owq_all = OWQ_create_aggregate( owq_byte ); size_t elements = PN(owq_all)->selected_filetype->ag->elements ; size_t extension ; if ( owq_all == NO_ONE_WIRE_QUERY ) { return NO_ONE_WIRE_QUERY ; } for ( extension = 0 ; extension < elements ; ++extension ) { OWQ_array_Y(owq_all,extension) = UT_getbit( (BYTE *) &OWQ_U(owq_byte), extension ) ; } return owq_all ; } owfs-2.8p15/module/owlib/src/c/ow_name.c0000644000175000017500000000364311667561164015036 00000000000000/* $Id: ow_name.c,v 1.31 2011/12/07 03:50:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_devices.h" char *ePN_name[] = { "", "", "statistics", "system", "settings", "structure", "interface", 0, }; /* device display format */ void FS_devicename(char *buffer, const size_t length, const BYTE * sn, const struct parsedname *pn) { UCLIBCLOCK; switch (DeviceFormat(pn)) { case fi: snprintf(buffer, length, "%02X%02X%02X%02X%02X%02X%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6]); break; case fdidc: snprintf(buffer, length, "%02X.%02X%02X%02X%02X%02X%02X.%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6], sn[7]); break; case fdic: snprintf(buffer, length, "%02X.%02X%02X%02X%02X%02X%02X%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6], sn[7]); break; case fidc: snprintf(buffer, length, "%02X%02X%02X%02X%02X%02X%02X.%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6], sn[7]); break; case fic: snprintf(buffer, length, "%02X%02X%02X%02X%02X%02X%02X%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6], sn[7]); break; case fdi: default: snprintf(buffer, length, "%02X.%02X%02X%02X%02X%02X%02X", sn[0], sn[1], sn[2], sn[3], sn[4], sn[5], sn[6]); break; } UCLIBCUNLOCK; } /* Return the last part of the file name specified by pn */ /* This can be a device, directory, subdiirectory, if property file */ /* Prints this directory element (not the whole path) */ /* Suggest that size = OW_FULLNAME_MAX */ const char *FS_DirName(const struct parsedname *pn) { char *slash; if (pn == NULL) { return ""; } slash = strrchr(pn->path, '/'); if (slash == NULL) { return ""; } return slash + 1; } owfs-2.8p15/module/owlib/src/c/ow_get.c0000664000175000017500000000541311357161360014662 00000000000000/* $Id: ow_get.c,v 1.2 2010/04/07 19:54:24 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_interate.c */ /* routines to split reads and writes if longer than page */ #include #include "owfs_config.h" #include "ow.h" /* Get a value, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ /* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ static void getdircallback( void * v, const struct parsedname * const pn_entry ) { struct charblob * cb = v ; const char * buf = FS_DirName(pn_entry) ; CharblobAdd( buf, strlen(buf), cb ) ; if ( IsDir(pn_entry) ) { CharblobAddChar( '/', cb ) ; } } static void getdir( struct charblob * cb, struct one_wire_query * owq ) { if ( FS_dir( getdircallback, cb, PN(owq) ) != 0 ) { CharblobClear( cb ) ; } else if ( CharblobLength(cb) == 0 ) { CharblobAddChar( '\0', cb) ; } } static char * copy_buffer( char * data, int size ) { char * data_copy = NULL ; // default if ( size < 1 ) { return NULL ; } data_copy = malloc( size+1 ) ; if ( data_copy == NULL ) { return NULL ; } memcpy( data_copy, data, size ) ; data_copy[size] = '\0' ; return data_copy ; } SIZE_OR_ERROR FS_get(const char *path, char **return_buffer, size_t * buffer_length) { SIZE_OR_ERROR size = 0 ; /* current buffer string length */ OWQ_allocate_struct_and_pointer( owq ) ; /* Check the parameters */ if (return_buffer == NULL) { // No buffer for read result. return -EINVAL; } if (path == NULL) { path = "/"; } *return_buffer = NULL; // default return string on error if ( BAD( OWQ_create(path, owq) ) ) { /* Can we parse the input string */ return -ENOENT; } if ( IsDir( PN(owq) ) ) { /* A directory of some kind */ struct charblob cb ; CharblobInit(&cb) ; getdir( &cb, owq ) ; size = CharblobLength(&cb) ; *return_buffer = copy_buffer( CharblobData(&cb), size ) ; CharblobClear( &cb ) ; } else { /* A regular file -- so read */ if ( GOOD(OWQ_allocate_read_buffer(owq)) ) { // make the space in the buffer size = FS_read_postparse(owq) ; *return_buffer = copy_buffer( OWQ_buffer(owq), size ) ; } } // the buffer is allocated by getdir or getval OWQ_destroy(owq); /* Check the parameters */ if (*return_buffer == NULL) { // no data. return -EINVAL; } if ( buffer_length != NULL ) { *buffer_length = size ; } return size ; } owfs-2.8p15/module/owlib/src/c/ow_read_telnet.c0000664000175000017500000002001111633275105016360 00000000000000/* $Id: ow_read_telnet.c,v 1.20 2011/09/12 03:19:33 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "telnet.h" /* Telnet handling concepts from Jerry Scharf: You should request the number of bytes you expect. When you scan it, start looking for FF FA codes. If that shows up, see if the F0 is in the read buffer. If so, move the char pointer back to where the FF point was and ask for the rest of the string (expected - FF...F0 bytes.) If the F0 isn't in the read buffer, start reading byte by byte into a separate variable looking for F0. Once you find that, then do the move the pointer and read the rest piece as above. Finally, don't forget to scan the rest of the strings for more FF FA blocks. It's most sloppy when the FF is the last character of the initial read buffer... You can also scan and remove the patterns FF F1 - FF F9 as these are 2 byte commands that the transmitter can send at any time. It is also possible that you could see FF FB xx - FF FE xx 3 byte codes, but this would be in response to FF FA codes that you would send, so that seems unlikely. Handling these would be just the same as the FF FA codes above. */ /* Read from a telnet device */ GOOD_OR_BAD telnet_read(BYTE * buf, const size_t size, struct connection_in *in) { // temporary buffer (add some extra space) BYTE readin_buf[size+2] ; // state machine for telnet escape chars // handles TELNET protocol, specifically RFC854 // http://www.ietf.org/rfc/rfc854.txt enum { telnet_regular, telnet_iac, telnet_sb, telnet_sb_opt, telnet_sb_val, telnet_sb_iac, telnet_will, telnet_wont, telnet_do, telnet_dont, } telnet_read_state = telnet_regular ; size_t actual_readin = 0 ; size_t current_index = 0 ; size_t still_needed = size ; // test inputs if ( size == 0 ) { return gbGOOD ; } if ( in == NO_CONNECTION ) { return gbBAD ; } if ( FILE_DESCRIPTOR_NOT_VALID(SOC(in)->file_descriptor) ) { return gbBAD ; } // loop and look for escape sequances while ( still_needed > 0 ) { // see if the state requires a longer read than currently scheduled size_t minimum_chars = still_needed ; switch( telnet_read_state ) { case telnet_sb: minimum_chars += 4 ; break ; case telnet_sb_opt: minimum_chars += 3 ; break ; case telnet_sb_val: minimum_chars += 2 ; break ; case telnet_iac: case telnet_sb_iac: case telnet_will: case telnet_wont: case telnet_do: case telnet_dont: minimum_chars += 1 ; break ; case telnet_regular: break ; } if ( current_index >= actual_readin ) { // need to read more -- just read what we think we need -- escape chars may require repeat if ( tcp_read( SOC(in)->file_descriptor, readin_buf, minimum_chars, &(SOC(in)->timeout), &actual_readin) < 0 ) { LEVEL_DEBUG("tcp seems closed") ; Test_and_Close( &(SOC(in)->file_descriptor) ) ; return gbBAD ; } if (actual_readin < minimum_chars) { LEVEL_CONNECT("Telnet (ethernet) error"); Test_and_Close( &(SOC(in)->file_descriptor) ) ; return gbBAD; } current_index = 0 ; } switch ( telnet_read_state ) { case telnet_regular : if ( readin_buf[current_index] == TELNET_IAC ) { #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: IAC"); #endif /* OW_SHOW_TRAFFIC */ // starting escape sequence // following bytes will better characterize telnet_read_state = telnet_iac ; } else { // normal processing // move byte to response and decrement needed bytes // stay in current state buf[size - still_needed] = readin_buf[current_index] ; -- still_needed ; } break ; case telnet_iac: //printf("TELNET: IAC %d\n",readin_buf[current_index]); switch ( readin_buf[current_index] ) { case TELNET_EOF: case TELNET_SUSP: case TELNET_ABORT: case TELNET_EOR: case TELNET_SE: case TELNET_NOP: case TELNET_DM: case TELNET_BREAK: case TELNET_IP: case TELNET_AO: case TELNET_AYT: case TELNET_EC: case TELNET_EL: case TELNET_GA: // 2 byte sequence // just read 2nd character #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End 2-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; case TELNET_SB: // multibyte squence // start scanning for 0xF0 telnet_read_state = telnet_sb ; break ; case TELNET_WILL: // 3 byte sequence // just read 2nd char telnet_read_state = telnet_will ; break ; case TELNET_WONT: // 3 byte sequence // just read 2nd char telnet_read_state = telnet_wont ; break ; case TELNET_DO: // 3 byte sequence // just read 2nd char telnet_read_state = telnet_do ; break ; case TELNET_DONT: // 3 byte sequence // just read 2nd char telnet_read_state = telnet_dont ; break ; case TELNET_IAC: // escape the FF character // make this a single regular FF char buf[size - still_needed] = 0xFF ; -- still_needed ; #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: FF escape sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; default: LEVEL_DEBUG("Unexpected telnet sequence"); return gbBAD ; } break ; case telnet_sb: switch ( readin_buf[current_index] ) { case TELNET_IAC: LEVEL_DEBUG("Unexpected telnet sequence"); return gbBAD ; default: //printf("TELNET: IAC SB opt=%d\n",readin_buf[current_index]); // stay in this mode telnet_read_state = telnet_sb_opt ; break ; } break ; case telnet_sb_opt: switch ( readin_buf[current_index] ) { case TELNET_IAC: LEVEL_DEBUG("Unexpected telnet sequence"); return gbBAD ; default: //printf("TELNET: IAC SB sub_opt=%d\n",readin_buf[current_index]); // stay in this mode telnet_read_state = telnet_sb_val ; break ; } break ; case telnet_sb_val: switch ( readin_buf[current_index] ) { case TELNET_IAC: // stay in this mode telnet_read_state = telnet_sb_iac ; break ; default: //printf("TELNET: IAC SB val=%d\n",readin_buf[current_index]); // stay in this mode break ; } break ; case telnet_sb_iac: switch ( readin_buf[current_index] ) { case TELNET_SE: //printf("TELNET: IAC SE\n"); #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End multi-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; default: LEVEL_DEBUG("Unexpected telnet sequence"); return gbBAD ; } break ; case telnet_will: //printf("TELNET: IAC WILL %d\n",readin_buf[current_index]); // 3 byte sequence // now reading 3rd char #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End 3-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; case telnet_wont: //printf("TELNET: IAC WONT %d\n",readin_buf[current_index]); // 3 byte sequence // now reading 3rd char #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End 3-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; case telnet_do: //printf("TELNET: IAC DO %d\n",readin_buf[current_index]); // 3 byte sequence // now reading 3rd char #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End 3-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; case telnet_dont: // 3 byte sequence // now reading 3rd char #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: End 3-byte sequence"); #endif /* OW_SHOW_TRAFFIC */ telnet_read_state = telnet_regular ; break ; } ++ current_index ; } return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_ha7.c0000664000175000017500000003106611632033654014565 00000000000000/* $Id: ow_ha7.c,v 1.74 2011/09/08 03:34:04 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" #if OW_HA7 struct toHA7 { ASCII *command; ASCII lock[10]; ASCII conditional[1]; ASCII address[16]; const BYTE *data; size_t length; }; //static void byteprint( const BYTE * b, int size ) ; static GOOD_OR_BAD HA7_write(const ASCII * msg, size_t size, struct connection_in *in); static void toHA7init(struct toHA7 *ha7); static void setHA7address(struct toHA7 *ha7, const BYTE * sn); static GOOD_OR_BAD HA7_toHA7( const struct toHA7 *ha7, struct connection_in *in); static GOOD_OR_BAD HA7_read( struct memblob *mb, struct connection_in * in ); static RESET_TYPE HA7_reset(const struct parsedname *pn); static enum search_status HA7_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD HA7_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD HA7_select_and_sendback(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD HA7_sendback_block(const BYTE * data, BYTE * resp, const size_t size, int also_address, const struct parsedname *pn); static GOOD_OR_BAD HA7_select(const struct parsedname *pn); static void HA7_setroutines(struct connection_in *in); static void HA7_close(struct connection_in *in); static GOOD_OR_BAD HA7_directory( struct device_search *ds, const struct parsedname *pn); static void HA7_setroutines(struct connection_in *in) { in->iroutines.detect = HA7_detect; in->iroutines.reset = HA7_reset; in->iroutines.next_both = HA7_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.select_and_sendback = HA7_select_and_sendback; in->iroutines.sendback_data = HA7_sendback_data; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = HA7_select; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = HA7_close; in->iroutines.flags = ADAP_FLAG_dirgulp | ADAP_FLAG_bundle | ADAP_FLAG_dir_auto_reset | ADAP_FLAG_no2404delay ; in->bundling_length = HA7_FIFO_SIZE; // arbitrary number } GOOD_OR_BAD HA7_detect(struct connection_in *in) { struct parsedname pn; struct toHA7 ha7; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed pn.selected_connection = in; /* Set up low-level routines */ HA7_setroutines(in); in->master.ha7.locked = 0; if (SOC(in)->devicename == NULL) { return gbBAD; } SOC(in)->type = ct_tcp ; SOC(in)->timeout.tv_sec = Globals.timeout_ha7 ; SOC(in)->timeout.tv_usec = 0 ; RETURN_BAD_IF_BAD( COM_open(in) ) ; in->Adapter = adapter_HA7NET; toHA7init(&ha7); ha7.command = "ReleaseLock"; if (GOOD( HA7_toHA7( &ha7, in)) ) { struct memblob mb; if ( GOOD( HA7_read( &mb, in )) ) { in->adapter_name = "HA7Net"; in->busmode = bus_ha7net; in->AnyDevices = anydevices_yes; MemblobClear(&mb); return gbGOOD; } } COM_close(in) ; return gbBAD; } static RESET_TYPE HA7_reset(const struct parsedname *pn) { struct memblob mb; RESET_TYPE ret = BUS_RESET_OK; struct toHA7 ha7; struct connection_in * in = pn->selected_connection ; toHA7init(&ha7); ha7.command = "Reset"; if ( BAD(HA7_toHA7( &ha7, in)) ) { LEVEL_DEBUG("Trouble sending reset command"); ret = BUS_RESET_ERROR; } else if ( BAD(HA7_read( &mb, in )) ) { LEVEL_DEBUG("Trouble with reset command response"); ret = BUS_RESET_ERROR; } MemblobClear(&mb); return ret; } static GOOD_OR_BAD HA7_directory( struct device_search *ds, const struct parsedname *pn) { GOOD_OR_BAD ret = gbGOOD; struct toHA7 ha7; struct memblob mb; struct connection_in * in = pn->selected_connection ; DirblobClear(&(ds->gulp)); toHA7init(&ha7); ha7.command = "Search"; if ( ds->search == _1W_CONDITIONAL_SEARCH_ROM) { ha7.conditional[0] = '1'; } if ( BAD(HA7_toHA7( &ha7, in)) ) { ret = gbBAD; } else if ( BAD(HA7_read( &mb, in )) ) { STAT_ADD1_BUS(e_bus_read_errors, in); ret = gbBAD; } else { BYTE sn[SERIAL_NUMBER_SIZE]; ASCII *p = (ASCII *) MemblobData(&mb); while ((p = strstr(p, "gulp)); } MemblobClear(&mb); } return ret; } static enum search_status HA7_next_both(struct device_search *ds, const struct parsedname *pn) { if (ds->LastDevice) { return search_done; } if (++(ds->index) == 0) { if ( BAD(HA7_directory( ds, pn )) ) { return search_error; } } switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } #define HA7_READ_BUFFER_LENGTH 2000 static GOOD_OR_BAD HA7_read( struct memblob *mb, struct connection_in * in ) { ASCII readin_area[HA7_READ_BUFFER_LENGTH + 1]; ASCII *start; size_t read_size; MemblobInit(mb, HA7_READ_BUFFER_LENGTH); SOC(in)->timeout.tv_sec = 2 ; SOC(in)->timeout.tv_usec = 0 ; // Read first block of data from HA7 read_size = COM_read_with_timeout( (BYTE*) readin_area, HA7_READ_BUFFER_LENGTH, in) ; if ( read_size <= 0 ) { LEVEL_CONNECT("Read error"); return gbBAD; } // make sure null terminated (allocated extra byte in readin_area to always have room) readin_area[read_size] = '\0'; // Look for happy response if (strncmp("HTTP/1.1 200 OK", readin_area, 15)) { //Bad HTTP return code ASCII *p = strchr(&readin_area[15], '\n'); if (p == NULL) { p = &readin_area[15 + 32]; } LEVEL_DATA("response problem:%.*s", p - readin_area - 15, &readin_area[15]); return gbBAD; } // Look for "" if ((start = strstr(readin_area, "")) == NULL) { LEVEL_DATA("response: No HTTP body to parse"); MemblobClear(mb); return gbBAD; } // HTML body found, dump header if (MemblobAdd((BYTE *) start, read_size - (start - readin_area), mb)) { MemblobClear(mb); return gbBAD; } // loop through reading in HA7_READ_BUFFER_LENGTH blocks while (read_size == HA7_READ_BUFFER_LENGTH) { // full read, so presume more waiting read_size = COM_read_with_timeout( (BYTE*) readin_area, HA7_READ_BUFFER_LENGTH, in) ; if (read_size <= 0) { LEVEL_DATA("Couldn't get rest of HA7 data (err=%d)", read_size); MemblobClear(mb); return gbBAD; } else if (MemblobAdd((BYTE *) readin_area, read_size, mb)) { MemblobClear(mb); return gbBAD; } } // Add trailing null if (MemblobAdd((BYTE *) "", 1, mb)) { MemblobClear(mb); return gbBAD; } LEVEL_DEBUG("Successful read of data"); //printf("READ FROM HA7:\n%s\n",MemblobData(mb)); return gbGOOD; } static GOOD_OR_BAD HA7_write( const ASCII * msg, size_t length, struct connection_in *in ) { return COM_write( (const BYTE *) msg, length, in) ; } static GOOD_OR_BAD HA7_toHA7( const struct toHA7 *ha7, struct connection_in *in) { int first = 1; int probable_length; char *full_command; LEVEL_DEBUG ("To HA7 command=%s address=%.16s conditional=%.1s lock=%.10s", SAFESTRING(ha7->command), SAFESTRING(ha7->address), SAFESTRING(ha7->conditional), SAFESTRING(ha7->lock)); if (ha7->command == NULL) { return gbBAD; } probable_length = 11 + strlen(ha7->command) + 5 + ((ha7->address[0]) ? 1 + 8 + 16 : 0) + ((ha7->conditional[0]) ? 1 + 12 + 1 : 0) + ((ha7->data) ? 1 + 5 + ha7->length * 2 : 0) + ((ha7->lock[0]) ? 1 + 7 + 10 : 0) + 11 + 1; full_command = owmalloc(probable_length); if (full_command == NULL) { return gbBAD; } memset(full_command, 0, probable_length); strcpy(full_command, "GET /1Wire/"); strcat(full_command, ha7->command); strcat(full_command, ".html"); if (ha7->address[0]) { strcat(full_command, first ? "?" : "&"); strcat(full_command, "Address="); strcat(full_command, ha7->address); first = 0; } if (ha7->conditional[0]) { strcat(full_command, first ? "?" : "&"); strcat(full_command, "Conditional="); strcat(full_command, ha7->conditional); first = 0; } if (ha7->data) { strcat(full_command, first ? "?" : "&"); strcat(full_command, "Data="); bytes2string(&full_command[strlen(full_command)], ha7->data, ha7->length); } if (ha7->lock[0]) { strcat(full_command, first ? "?" : "&"); strcat(full_command, "LockID="); strcat(full_command, ha7->lock); first = 0; } strcat(full_command, " HTTP/1.0\n\n"); LEVEL_DEBUG("To HA7 %s", full_command); if ( BAD( COM_open(in) ) ) { // force reopen owfree(full_command); return gbBAD ; } if ( BAD( HA7_write( full_command, probable_length, in) ) ) { owfree(full_command); return gbBAD ; } owfree(full_command); return gbGOOD; } // Reset, select, and read/write data /* return 0=good sendout_data, readin */ static GOOD_OR_BAD HA7_select_and_sendback(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { size_t location = 0; int also_address = 1; while (location < size) { size_t block = size - location; if (block > 32) { block = 32; } // Don't add address (that's the "0") RETURN_BAD_IF_BAD(HA7_sendback_block(&data[location], &resp[location], block, also_address, pn)) ; location += block; also_address = 0; //for subsequent blocks } return gbGOOD ; } // Send data and return response block /* return 0=good sendout_data, readin */ #define HA7_CONSERVATIVE_LENGTH 32 static GOOD_OR_BAD HA7_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { size_t location = 0; while (location < size) { size_t block = size - location; if (block > HA7_CONSERVATIVE_LENGTH) { block = HA7_CONSERVATIVE_LENGTH; } // Don't add address (that's the "0") RETURN_BAD_IF_BAD(HA7_sendback_block(&data[location], &resp[location], block, 0, pn)) ; location += block; } return gbGOOD; } // HA7 only allows WriteBlock of 32 bytes // This routine assumes that larger writes have already been broken up static GOOD_OR_BAD HA7_sendback_block(const BYTE * data, BYTE * resp, const size_t size, int also_address, const struct parsedname *pn) { struct memblob mb; struct toHA7 ha7; GOOD_OR_BAD ret = gbBAD; struct connection_in * in = pn->selected_connection ; toHA7init(&ha7); ha7.command = "WriteBlock"; ha7.data = data; ha7.length = size; if (also_address) { setHA7address(&ha7, pn->sn); } if ( GOOD( HA7_toHA7( &ha7, in)) ) { if ( GOOD( HA7_read( &mb, in )) ) { ASCII *p = (ASCII *) MemblobData(&mb); if ((p = strstr(p, "= size << 1) { string2bytes(p, resp, size); ret = gbGOOD; } } MemblobClear(&mb); } else { STAT_ADD1_BUS(e_bus_read_errors, in); } } return gbGOOD; } static void setHA7address(struct toHA7 *ha7, const BYTE * sn) { num2string(&(ha7->address[0]), sn[7]); num2string(&(ha7->address[2]), sn[6]); num2string(&(ha7->address[4]), sn[5]); num2string(&(ha7->address[6]), sn[4]); num2string(&(ha7->address[8]), sn[3]); num2string(&(ha7->address[10]), sn[2]); num2string(&(ha7->address[12]), sn[1]); num2string(&(ha7->address[14]), sn[0]); } static GOOD_OR_BAD HA7_select(const struct parsedname *pn) { GOOD_OR_BAD ret = gbBAD; struct connection_in * in = pn->selected_connection ; if (pn->selected_device) { struct toHA7 ha7; toHA7init(&ha7); ha7.command = "AddressDevice"; setHA7address(&ha7, pn->sn); if ( GOOD( HA7_toHA7( &ha7, in)) ) { struct memblob mb; if ( GOOD( HA7_read( &mb, in )) ) { MemblobClear(&mb); ret = gbGOOD; } } } else { return HA7_reset(pn)==BUS_RESET_OK ? gbGOOD : gbBAD ; } return ret; } static void HA7_close(struct connection_in *in) { // that standard COM_free cleans up the connection (void) in ; } static void toHA7init(struct toHA7 *ha7) { memset(ha7, 0, sizeof(struct toHA7)); } #endif /* OW_HA7 */ owfs-2.8p15/module/owlib/src/c/ow_parsename.c0000644000175000017500000006443111742352454016065 00000000000000/* $Id: ow_parsename.c,v 1.219 2012/04/14 19:51:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_devices.h" #include "ow_counters.h" #include "ow_external.h" static ZERO_OR_ERROR BranchAdd(struct parsedname *pn); enum parse_pass { parse_pass_pre_remote, parse_pass_post_remote, }; struct parsedname_pointers { char pathcpy[PATH_MAX+1]; char *pathnow; char *pathnext; char *pathlast; }; static enum parse_enum set_type( enum ePN_type epntype, struct parsedname * pn ) ; static enum parse_enum Parse_Unspecified(char *pathnow, enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_Branch(char *pathnow, enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_Real(char *pathnow, enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_NonReal(char *pathnow, struct parsedname *pn); static enum parse_enum Parse_RealDevice(char *filename, enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_Property(char *filename, struct parsedname *pn); static enum parse_enum Parse_RealDeviceSN(enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_NonRealDevice(char *filename, struct parsedname *pn); static enum parse_enum Parse_External_Device( char *filename, struct parsedname *pn) ; static enum parse_enum Parse_Bus(char *pathnow, struct parsedname *pn); static enum parse_enum Parse_Alias(char *filename, enum parse_pass remote_status, struct parsedname *pn); static enum parse_enum Parse_Alias_Known( char *filename, enum parse_pass remote_status, struct parsedname *pn); static void ReplaceAliasInPath( char * filename, struct parsedname * pn); static ZERO_OR_ERROR FS_ParsedName_anywhere(const char *path, enum parse_pass remote_status, struct parsedname *pn); static ZERO_OR_ERROR FS_ParsedName_setup(struct parsedname_pointers *pp, const char *path, struct parsedname *pn); static char * find_segment_in_path( char * segment, char * path ) ; #define BRANCH_INCR (9) /* ---------------------------------------------- */ /* Filename (path) parsing functions */ /* ---------------------------------------------- */ void FS_ParsedName_destroy(struct parsedname *pn) { if (!pn) { return; } LEVEL_DEBUG("%s", SAFESTRING(pn->path)); CONNIN_RUNLOCK ; SAFEFREE(pn->sparse_name); SAFEFREE(pn->bp) ; } // Path is either NULL (in which case a minimal structure is created that doesn't need Destroy -- used for Bus Master setups) // Or Path is a full "filename" type string of form: 10.1243Ab000 or uncached/bus.0/statistics etc. // The Path passed in isn't altered, but 2 copies are made -- one with the full path, the other (to_server) has the first bus.n removed. // An initial / is added to the path, and the full length has to be less than MAX_PATH (2048) // For efficiency, the two path copies are allocated in the same call, and so can be removed together. /* Parse a path to check it's validity and attach to the propery data structures */ ZERO_OR_ERROR FS_ParsedName(const char *path, struct parsedname *pn) { return FS_ParsedName_anywhere(path, parse_pass_pre_remote, pn); } /* Parse a path from a remote source back -- so don't check presence */ ZERO_OR_ERROR FS_ParsedName_BackFromRemote(const char *path, struct parsedname *pn) { return FS_ParsedName_anywhere(path, parse_pass_post_remote, pn); } /* Parse off starting "mode" directory (uncached, alarm...) */ static ZERO_OR_ERROR FS_ParsedName_anywhere(const char *path, enum parse_pass remote_status, struct parsedname *pn) { struct parsedname_pointers s_pp; struct parsedname_pointers *pp = &s_pp; ZERO_OR_ERROR parse_error_status = 0; enum parse_enum pe = parse_first; // To make the debug output useful it's cleared here. // Even on normal glibc, errno isn't cleared on good system calls errno = 0; LEVEL_CALL("path=[%s]", SAFESTRING(path)); RETURN_CODE_ERROR_RETURN( FS_ParsedName_setup(pp, path, pn) ); if (path == NO_PATH) { RETURN_CODE_RETURN( 0 ) ; // success (by default) } while (1) { // Check for extreme conditions (done, error) switch (pe) { case parse_done: // the only exit! //LEVEL_DEBUG("PARSENAME parse_done") ; //printf("PARSENAME end parse_error_status=%d\n",parse_error_status) ; if (parse_error_status) { FS_ParsedName_destroy(pn); return parse_error_status ; } if ( pp->pathnext != NULL ) { // extra text -- make this an error RETURN_CODE_SET_SCALAR( parse_error_status, 77 ) ; // extra text in path pe = parse_done; continue; } //printf("%s: Parse %s before corrections: %.4X -- state = %d\n",(back_from_remote)?"BACK":"FORE",pn->path,pn->state,pn->type) ; // Play with remote levels switch ( pn->type ) { case ePN_interface: if ( SpecifiedVeryRemoteBus(pn) ) { // veryremote -> remote pn->state &= ~ePS_busveryremote ; } else if ( SpecifiedRemoteBus(pn) ) { // remote -> local pn->state &= ~ePS_busremote ; pn->state |= ePS_buslocal ; } break ; case ePN_root: // root buses are considered "real" pn->type = ePN_real; // default state break ; default: // everything else gets promoted so directories aren't added on if ( SpecifiedRemoteBus(pn) ) { // very remote pn->state |= ePS_busveryremote; } break ; } //printf("%s: Parse %s after corrections: %.4X -- state = %d\n\n",(back_from_remote)?"BACK":"FORE",pn->path,pn->state,pn->type) ; return 0; case parse_error: RETURN_CODE_SET_SCALAR( parse_error_status, 27 ) ; // bad path syntax pe = parse_done; continue; default: break; } // break out next name in path, make sure pp->pathnext isn't NULL. (SIGSEGV in uClibc) pp->pathnow = (pp->pathnext != NULL) ? strsep(&(pp->pathnext), "/") : NULL; //LEVEL_DEBUG("PARSENAME pathnow=[%s] rest=[%s]",pp->pathnow,pp->pathnext) ; if (pp->pathnow == NULL || pp->pathnow[0] == '\0') { pe = parse_done; continue; } // rest of state machine on parsename switch (pe) { case parse_first: //LEVEL_DEBUG("PARSENAME parse_first") ; pe = Parse_Unspecified(pp->pathnow, remote_status, pn); break; case parse_real: //LEVEL_DEBUG("PARSENAME parse_real") ; pe = Parse_Real(pp->pathnow, remote_status, pn); break; case parse_branch: //LEVEL_DEBUG("PARSENAME parse_branch") ; pe = Parse_Branch(pp->pathnow, remote_status, pn); break; case parse_nonreal: //LEVEL_DEBUG("PARSENAME parse_nonreal\n") ; pe = Parse_NonReal(pp->pathnow, pn); break; case parse_prop: //LEVEL_DEBUG("PARSENAME parse_prop") ; pn->dirlength = pp->pathnow - pp->pathcpy + 1 ; //LEVEL_DEBUG("Dirlength=%d <%*s>",pn->dirlength,pn->dirlength,pn->path) ; //printf("dirlength = %d which makes the path <%s> <%.*s>\n",pn->dirlength,pn->path,pn->dirlength,pn->path); pp->pathlast = pp->pathnow; /* Save for concatination if subdirectory later wanted */ pe = Parse_Property(pp->pathnow, pn); break; case parse_subprop: //LEVEL_DEBUG("PARSENAME parse_subprop") ; pp->pathnow[-1] = '/'; pe = Parse_Property(pp->pathlast, pn); break; default: pe = parse_error; // unknown state break; } //printf("PARSENAME pe=%d\n",pe) ; } } /* Initial memory allocation and pn setup */ static ZERO_OR_ERROR FS_ParsedName_setup(struct parsedname_pointers *pp, const char *path, struct parsedname *pn) { if (pn == NO_PARSEDNAME) { RETURN_CODE_RETURN( 78 ); // unexpected null pointer } memset(pn, 0, sizeof(struct parsedname)); pn->known_bus = NULL; /* all buses */ pn->sparse_name = NULL ; RETURN_CODE_INIT(pn); /* Set the persistent state info (temp scale, ...) -- will be overwritten by client settings in the server */ CONTROLFLAGSLOCK; pn->control_flags = LocalControlFlags | SHOULD_RETURN_BUS_LIST; // initial flag as the bus-returning level, will change if a bus is specified CONTROLFLAGSUNLOCK; // initialization pp->pathnow = NO_PATH; pp->pathlast = NO_PATH; pp->pathnext = NO_PATH; /* Default attributes */ pn->state = ePS_normal; pn->type = ePN_root; /* uncached attribute */ if ( Globals.uncached ) { // local settings (--uncached) can set pn->state |= ePS_uncached; } // Also can be set by path ("/uncached") // Also in owserver, can be set by client flags // sibling inherits parent /* unaliased attribute */ if ( Globals.unaliased ) { // local settings (--unalaised) can set pn->state |= ePS_unaliased; } // Also can be set by path ("/unaliased") // Also in owserver, can be set by client flags // sibling inherits parent /* No device lock yet assigned */ pn->lock = NULL ; /* minimal structure for initial bus "detect" use -- really has connection and LocalControlFlags only */ pn->dirlength = -1 ; if (path == NO_PATH) { return 0; // success } if (strlen(path) > PATH_MAX) { RETURN_CODE_RETURN( 26 ) ; // path too long } /* Have to save pn->path at once */ strcpy(pn->path, "/"); // initial slash strcpy(pn->path+1, path[0]=='/'?path+1:path); strcpy(pn->path_to_server, pn->path); /* make a copy for destructive parsing without initial '/'*/ strcpy(pp->pathcpy,&pn->path[1]); /* pointer to rest of path after current token peeled off */ pp->pathnext = pp->pathcpy; pn->dirlength = strlen(pn->path) ; /* device name */ pn->device_name = NULL ; /* connection_in list and start */ /* ---------------------------- */ /* -- This is important: -- */ /* -- Buses can -- */ /* -- be added by Browse so -- */ /* -- a reader/writer lock is - */ /* -- held until ParsedNameDestroy */ /* ---------------------------- */ CONNIN_RLOCK; pn->selected_connection = NO_CONNECTION ; // Default bus assignment return 0 ; // success } /* Used for virtual directories like settings and statistics * If local, applies to all local (this program) and not a * specific local bus. * If remote, pass it on for the remote to handle * */ static enum parse_enum set_type( enum ePN_type epntype, struct parsedname * pn ) { if (SpecifiedLocalBus(pn)) { return parse_error; } else if ( ! SpecifiedRemoteBus(pn) ) { pn->type |= ePS_busanylocal; } pn->type = epntype; return parse_nonreal; } // Early parsing -- only bus entries, uncached and text may have preceeded static enum parse_enum Parse_Unspecified(char *pathnow, enum parse_pass remote_status, struct parsedname *pn) { if (strncasecmp(pathnow, "bus.", 4) == 0) { return Parse_Bus(pathnow, pn); } else if (strcasecmp(pathnow, "settings") == 0) { return set_type( ePN_settings, pn ) ; } else if (strcasecmp(pathnow, "statistics") == 0) { return set_type( ePN_statistics, pn ) ; } else if (strcasecmp(pathnow, "structure") == 0) { return set_type( ePN_structure, pn ) ; } else if (strcasecmp(pathnow, "system") == 0) { return set_type( ePN_system, pn ) ; } else if (strcasecmp(pathnow, "interface") == 0) { if (!SpecifiedBus(pn)) { return parse_error; } pn->type = ePN_interface; return parse_nonreal; } else if (strcasecmp(pathnow, "text") == 0) { pn->state |= ePS_json; return parse_first; } else if (strcasecmp(pathnow, "json") == 0) { pn->state |= ePS_text; return parse_first; } else if (strcasecmp(pathnow, "uncached") == 0) { pn->state |= ePS_uncached; return parse_first; } else if (strcasecmp(pathnow, "unaliased") == 0) { pn->state |= ePS_unaliased; return parse_first; } pn->type = ePN_real; return Parse_Branch(pathnow, remote_status, pn); } static enum parse_enum Parse_Branch(char *pathnow, enum parse_pass remote_status, struct parsedname *pn) { if (strcasecmp(pathnow, "alarm") == 0) { pn->state |= ePS_alarm; pn->type = ePN_real; return parse_real; } return Parse_Real(pathnow, remote_status, pn); } static enum parse_enum Parse_Real(char *pathnow, enum parse_pass remote_status, struct parsedname *pn) { if (strcasecmp(pathnow, "simultaneous") == 0) { LEVEL_DEBUG("TEST set simultaneous"); pn->selected_device = DeviceSimultaneous; return parse_prop; } else if (strcasecmp(pathnow, "text") == 0) { pn->state |= ePS_text; return parse_real; } else if (strcasecmp(pathnow, "json") == 0) { pn->state |= ePS_json; return parse_real; } else if (strcasecmp(pathnow, "thermostat") == 0) { pn->selected_device = DeviceThermostat; return parse_prop; } else if (strcasecmp(pathnow, "uncached") == 0) { pn->state |= ePS_uncached; return parse_real; } else if (strcasecmp(pathnow, "unaliased") == 0) { pn->state |= ePS_unaliased; return parse_real; } else { return Parse_RealDevice(pathnow, remote_status, pn); } } static enum parse_enum Parse_NonReal(char *pathnow, struct parsedname *pn) { if (strcasecmp(pathnow, "text") == 0) { pn->state |= ePS_text; return parse_nonreal; } else if (strcasecmp(pathnow, "json") == 0) { pn->state |= ePS_json; return parse_nonreal; } else if (strcasecmp(pathnow, "uncached") == 0) { pn->state |= ePS_uncached; return parse_nonreal; } else if (strcasecmp(pathnow, "unaliased") == 0) { pn->state |= ePS_unaliased; return parse_nonreal; } else { return Parse_NonRealDevice(pathnow, pn); } return parse_error; } /* We've reached a /bus.n entry */ static enum parse_enum Parse_Bus(char *pathnow, struct parsedname *pn) { char *found; INDEX_OR_ERROR bus_number; /* Processing for bus.X directories -- eventually will make this more generic */ if (!isdigit(pathnow[4])) { return parse_error; } bus_number = atoi(&pathnow[4]); if ( INDEX_NOT_VALID(bus_number) ) { return parse_error; } /* Should make a presence check on remote buses here, but * it's not a major problem if people use bad paths since * they will just end up with empty directory listings. */ if (SpecifiedLocalBus(pn)) { /* already specified a "bus." */ /* too many levels of bus for a non-remote adapter */ return parse_error; } else if (SpecifiedRemoteBus(pn)) { /* already specified a "bus." */ /* Let the remote bus do the heavy lifting */ pn->state |= ePS_busveryremote; return parse_first; } /* Since we are going to use a specific in-device now, set * pn->selected_connection to point at that device at once. */ if ( SetKnownBus(bus_number, pn) ) { return parse_error ; // bus doesn't exist } pn->state |= BusIsServer((pn)->selected_connection) ? ePS_busremote : ePS_buslocal ; if (SpecifiedLocalBus(pn)) { /* don't return bus-list for local paths. */ pn->control_flags &= (~SHOULD_RETURN_BUS_LIST); } /* Create the path without the "bus.x" part in pn->path_to_server */ if ( (found = strstr(pn->path, "/bus.")) ) { int length = found - pn->path; if ((found = strchr(found + 1, '/'))) { // more after bus strcpy(&(pn->path_to_server[length]), found); // copy rest } else { pn->path_to_server[length] = '\0'; // add final null } } return parse_first; } // search path for this exact mathing path segment static char * find_segment_in_path( char * segment, char * path ) { int segment_length = strlen(segment) ; char augmented_segment[ segment_length + 2 ] ; char * path_pointer = path ; augmented_segment[0] = '/' ; strcpy( &augmented_segment[1], segment ) ; while ( (path_pointer = strstr( path_pointer , augmented_segment )) != NULL ) { ++ path_pointer ; // point after '/' switch( path_pointer[segment_length] ) { case '\0': case '/': return path_pointer ; default: // not a full match -- try again break ; } } return NULL ; } /* replace alias with sn */ static void ReplaceAliasInPath( char * filename, struct parsedname * pn) { int alias_len = strlen(filename) ; // check total length if ( strlen(pn->path_to_server) + 14 - alias_len <= PATH_MAX ) { // find the alias char * alias_loc = find_segment_in_path( filename, pn->path_to_server ) ; if ( alias_loc != NULL ) { char * post_alias_loc ; ++alias_loc ; // point after '/' post_alias_loc = alias_loc + alias_len ; // move rest of path memmove( &alias_loc[14], post_alias_loc, strlen(post_alias_loc)+1 ) ; //write in serial number for alias bytes2string( alias_loc, pn->sn, 7 ) ; } } } /* This is when the alias name in mapped to a known serial number * behaves much more like the standard handling -- bus from sn */ static enum parse_enum Parse_Alias_Known( char *filename, enum parse_pass remote_status, struct parsedname *pn) { if (remote_status == parse_pass_pre_remote) { ReplaceAliasInPath( filename, pn ) ; } return Parse_RealDeviceSN( remote_status, pn ) ; } /* Get a device that isn't a serial number -- see if it's an alias */ static enum parse_enum Parse_Alias(char *filename, enum parse_pass remote_status, struct parsedname *pn) { INDEX_OR_ERROR bus ; // See if the alias is known in the permanent list. We get the serial number if ( GOOD( Cache_Get_Alias_SN(filename,pn->sn)) ) { // Success! The alias is already registered and the serial // number just now loaded in pn->sn return Parse_Alias_Known( filename, remote_status, pn ) ; } // By definition this is a remote device, or non-existent. pn->selected_device = &RemoteDevice ; // is alias name cached from previous query? bus = Cache_Get_Alias_Bus( filename ) ; if ( bus != INDEX_BAD ) { // This alias is cached in temporary list SetKnownBus(bus, pn); return parse_prop ; } // Look for alias in remote buses bus = RemoteAlias(pn) ; if ( bus == INDEX_BAD ) { return parse_error ; } // Found the alias (remotely) SetKnownBus(bus, pn); if ( pn->sn[0] == 0 && pn->sn[7]==0 ) { // no serial number owserver (older) Cache_Add_Alias_Bus(filename,bus) ; } else { Cache_Add_Alias( filename, pn->sn ) ; Cache_Add_Device( bus, pn->sn ) ; pn->selected_device = FS_devicefindhex(pn->sn[0], pn); } return parse_prop ; } /* Parse Name (only device name) part of string */ /* Return -ENOENT if not a valid name return 0 if good *next points to next segment, or NULL if not filetype */ static enum parse_enum Parse_RealDevice(char *filename, enum parse_pass remote_status, struct parsedname *pn) { pn->device_name = find_segment_in_path( filename, pn->path ) ; switch ( Parse_SerialNumber(filename,pn->sn) ) { case sn_not_sn: if ( Find_External_Sensor( filename ) ) { return Parse_External_Device( filename, pn ) ; } else { return Parse_Alias( filename, remote_status, pn) ; } case sn_valid: return Parse_RealDeviceSN( remote_status, pn ) ; case sn_invalid: default: return parse_error ; } } /* Device is known with serial number */ static enum parse_enum Parse_RealDeviceSN(enum parse_pass remote_status, struct parsedname *pn) { /* Search for known 1-wire device -- keyed to device name (family code in HEX) */ pn->selected_device = FS_devicefindhex(pn->sn[0], pn); // returning from owserver -- don't need to check presence (it's implied) if (remote_status == parse_pass_post_remote) { return parse_prop; } if (Globals.one_device) { SetKnownBus(INDEX_DEFAULT, pn); } else { /* Check the presence, and cache the proper bus number for better performance */ INDEX_OR_ERROR bus_nr = CheckPresence(pn); if ( INDEX_NOT_VALID(bus_nr) ) { return parse_error; /* CheckPresence failed */ } } return parse_prop; } /* Device is known with serial number */ static enum parse_enum Parse_External_Device( char *filename, struct parsedname *pn) { struct sensor_node * sensor_n = Find_External_Sensor( filename ) ; struct family_node * family_n = Find_External_Family( sensor_n->family ) ; pn->selected_device = &(family_n->dev) ; SetKnownBus(Inbound_Control.external->index, pn); return parse_prop; } /* Parse Name (non-device name) part of string */ /* Return -ENOENT if not a valid name return 0 if good */ static enum parse_enum Parse_NonRealDevice(char *filename, struct parsedname *pn) { //printf("Parse_NonRealDevice: [%s] [%s]\n", filename, pn->path); pn->device_name = find_segment_in_path( filename, pn->path ) ; FS_devicefind(filename, pn); return (pn->selected_device == &UnknownDevice) ? parse_error : parse_prop; } static enum parse_enum Parse_Property(char *filename, struct parsedname *pn) { char *dot = filename; //printf("FilePart: %s %s\n", filename, pn->path); // Special case for remote device. Use distant data if ( pn->selected_device == &RemoteDevice ) { // remote device, no known sn, can't handle a property return parse_error ; } // separate filename.dot filename = strsep(&dot, "."); //printf("FP name=%s, dot=%s\n", filename, dot); /* Match to known filetypes for this device */ pn->selected_filetype = bsearch(filename, pn->selected_device->filetype_array, (size_t) pn->selected_device->count_of_filetypes, sizeof(struct filetype), filetype_cmp) ; if ( pn->selected_filetype == NO_FILETYPE ) { LEVEL_DEBUG("Unknown property for this device %s",SAFESTRING(filename) ) ; return parse_error; /* filetype not found */ } //printf("FP known filetype %s\n",pn->selected_filetype->name) ; /* Filetype found, now process extension */ if (dot == NULL || dot[0] == '\0') { /* no extension */ if (pn->selected_filetype->ag != NON_AGGREGATE) { return parse_error; /* aggregate filetypes need an extension */ } pn->extension = 0; /* default when no aggregate */ // Non-aggregate cannot have an extension } else if (pn->selected_filetype->ag == NON_AGGREGATE) { return parse_error; /* An extension not allowed when non-aggregate */ // Sparse uses the extension verbatim (text or number) } else if (pn->selected_filetype->ag->combined==ag_sparse) { /* Sparse */ if (pn->selected_filetype->ag->letters == ag_letters) { /* text string */ pn->extension = 0; /* text extension, not number */ pn->sparse_name = owstrdup(dot) ; } else { /* Numbers */ char *p; //printf("FP numbers\n") ; pn->extension = strtol(dot, &p, 0); /* Number conversion */ if ((p == dot) || ((pn->extension == 0) && (errno == -EINVAL))) { return parse_error; /* Bad number */ } } // Non-sparse "ALL" } else if (strcasecmp(dot, "ALL") == 0) { //printf("FP ALL\n"); pn->extension = EXTENSION_ALL; /* ALL */ // Non-sparse "BYTE" } else if (pn->selected_filetype->format == ft_bitfield && strcasecmp(dot, "BYTE") == 0) { pn->extension = EXTENSION_BYTE; /* BYTE */ //printf("FP BYTE\n") ; // Non-sparse extension -- interpret and check bounds } else { /* specific extension */ if (pn->selected_filetype->ag->letters == ag_letters) { /* Letters */ //printf("FP letters\n") ; if ((strlen(dot) != 1) || !isupper(dot[0])) { return parse_error; } pn->extension = dot[0] - 'A'; /* Letter extension */ } else { /* Numbers */ char *p; //printf("FP numbers\n") ; pn->extension = strtol(dot, &p, 0); /* Number conversion */ if ((p == dot) || ((pn->extension == 0) && (errno == -EINVAL))) { return parse_error; /* Bad number */ } } //printf("FP ext=%d nr_elements=%d\n", pn->extension, pn->selected_filetype->ag->elements) ; /* Now check range */ if ((pn->extension < 0) || (pn->extension >= pn->selected_filetype->ag->elements)) { //printf("FP Extension out of range %d %d %s\n", pn->extension, pn->selected_filetype->ag->elements, pn->path); return parse_error; /* Extension out of range */ } //printf("FP in range\n") ; } //printf("FP Good\n") ; switch (pn->selected_filetype->format) { case ft_directory: // aux or main if ( pn->type == ePN_structure ) { // special case, structure for aux and main return parse_done; } if (BranchAdd(pn) != 0) { //printf("PN BranchAdd failed for %s\n", filename); return parse_error; } /* STATISTICS */ STATLOCK; if (pn->ds2409_depth > dir_depth) { dir_depth = pn->ds2409_depth; } STATUNLOCK; return parse_branch; case ft_subdir: //printf("PN %s is a subdirectory\n", filename); pn->subdir = pn->selected_filetype; pn->selected_filetype = NO_FILETYPE; return parse_subprop; default: return parse_done; } } static ZERO_OR_ERROR BranchAdd(struct parsedname *pn) { //printf("BRANCHADD\n"); if ((pn->ds2409_depth % BRANCH_INCR) == 0) { void *temp = pn->bp; if ((pn->bp = owrealloc(temp, (BRANCH_INCR + pn->ds2409_depth) * sizeof(struct ds2409_hubs))) == NULL) { SAFEFREE(temp) ; RETURN_CODE_RETURN( 79 ) ; // unable to allocate memory } } memcpy(pn->bp[pn->ds2409_depth].sn, pn->sn, SERIAL_NUMBER_SIZE); /* copy over DS2409 name */ pn->bp[pn->ds2409_depth].branch = pn->selected_filetype->data.i; ++pn->ds2409_depth; pn->selected_filetype = NO_FILETYPE; pn->selected_device = NO_DEVICE; return 0; } int filetype_cmp(const void *name, const void *ex) { return strcmp((const char *) name, ((const struct filetype *) ex)->name); } /* Parse a path/file combination */ ZERO_OR_ERROR FS_ParsedNamePlus(const char *path, const char *file, struct parsedname *pn) { ZERO_OR_ERROR ret = 0; char *fullpath; if (path == NO_PATH) { path = "" ; } if (file == NULL) { file = "" ; } fullpath = owmalloc(strlen(file) + strlen(path) + 2); if (fullpath == NO_PATH) { RETURN_CODE_RETURN( 79 ) ; // unable to allocate memory } strcpy(fullpath, path); if (fullpath[strlen(fullpath) - 1] != '/') { strcat(fullpath, "/"); } strcat(fullpath, file); //printf("PARSENAMEPLUS path=%s pre\n",fullpath) ; ret = FS_ParsedName(fullpath, pn); //printf("PARSENAMEPLUS path=%s post\n",fullpath) ; owfree(fullpath); //printf("PARSENAMEPLUS free\n") ; return ret; } /* Parse a path/file combination */ ZERO_OR_ERROR FS_ParsedNamePlusExt(const char *path, const char *file, int extension, enum ag_index alphanumeric, struct parsedname *pn) { if (extension == EXTENSION_BYTE ) { return FS_ParsedNamePlusText(path, file, "BYTE", pn); } else if (extension == EXTENSION_ALL ) { return FS_ParsedNamePlusText(path, file, "ALL", pn); } else if (alphanumeric == ag_letters) { char name[2] = { 'A'+extension, 0x00, } ; return FS_ParsedNamePlusText(path, file, name, pn); } else { char name[OW_FULLNAME_MAX]; UCLIBCLOCK; snprintf(name, OW_FULLNAME_MAX, "%d", extension); UCLIBCUNLOCK; return FS_ParsedNamePlusText(path, file, name, pn); } } /* Parse a path/file combination */ ZERO_OR_ERROR FS_ParsedNamePlusText(const char *path, const char *file, const char *extension, struct parsedname *pn) { char name[OW_FULLNAME_MAX]; UCLIBCLOCK; snprintf(name, OW_FULLNAME_MAX, "%s.%s", file, extension ); UCLIBCUNLOCK; return FS_ParsedNamePlus(path, name, pn); } void FS_ParsedName_Placeholder( struct parsedname * pn ) { FS_ParsedName( NULL, pn ) ; // minimal parsename -- no destroy needed } owfs-2.8p15/module/owlib/src/c/ow_bitfield.c0000664000175000017500000000223311612066404015657 00000000000000/* $Id: ow_bitfield.c,v 1.1 2011/07/21 18:16:36 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" // struct bitfield { "alias_link", number_of_bits, shift_left, } ZERO_OR_ERROR FS_r_bitfield(struct one_wire_query *owq) { struct bitfield * bf = PN(owq)->selected_filetype->data.v ; UINT mask = ( 0x01 << bf->size ) - 1 ; UINT val ; RETURN_ERROR_IF_BAD( FS_r_sibling_U( &val, bf->link, owq ) ) ; OWQ_U(owq) = (val >> bf->shift ) & mask ; return 0 ; } ZERO_OR_ERROR FS_w_bitfield(struct one_wire_query *owq) { struct bitfield * bf = PN(owq)->selected_filetype->data.v ; UINT mask = ( 0x01 << bf->size ) - 1 ; UINT val ; // read it in RETURN_ERROR_IF_BAD( FS_r_sibling_U( &val, bf->link, owq ) ) ; // clear the bits val &= ~(mask << bf->shift) ; // Add in the new value val |= (OWQ_U(owq) & mask) << bf->shift ; // write it out return FS_w_sibling_U( val, bf->link, owq ) ; } owfs-2.8p15/module/owlib/src/c/ow_w1_addremove.c0000644000175000017500000000403211666515011016451 00000000000000/* $Id: ow_w1_addremove.c,v 1.20 2011/12/03 21:52:09 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" static struct connection_in * CreateW1In(int bus_master) ; static GOOD_OR_BAD W1_nomatch( struct connection_in * trial, struct connection_in * existing ) ; // Create a new bus master (W1 type) static struct connection_in * CreateW1In(int bus_master) { struct connection_in * in = AllocIn(NO_CONNECTION) ; char name[63] ; int sn_ret ; if ( in == NO_CONNECTION ) { return NO_CONNECTION ; } UCLIBCLOCK ; sn_ret = snprintf(name,62,"w1_bus_master%d",bus_master) ; UCLIBCUNLOCK ; if ( sn_ret < 0 ) { RemoveIn(in) ; return NO_CONNECTION ; } SOC(in)->devicename = owstrdup(name) ; in->master.w1.id = bus_master ; in->busmode = bus_w1 ; in->master.w1.w1_slave_order = w1_slave_order_unknown ; Init_Pipe( in->master.w1.netlink_pipe ) ; if ( BAD( W1_detect(in)) ) { RemoveIn(in) ; return NO_CONNECTION ; } LEVEL_DEBUG("Setup structure for %s",SOC(in)->devicename) ; return in ; } static GOOD_OR_BAD W1_nomatch( struct connection_in * trial, struct connection_in * existing ) { if ( existing->busmode != bus_w1 ) { return gbGOOD ; } if ( trial->master.w1.id != existing->master.w1.id ) { return gbGOOD ; } return gbBAD; } void AddW1Bus( int bus_master ) { struct connection_in * new_in = CreateW1In(bus_master) ; if ( new_in == NO_CONNECTION ) { return ; } LEVEL_DEBUG("Request master be added: w1_bus_master%d.", bus_master); SOC(new_in)->type = ct_none ; Add_InFlight( W1_nomatch, new_in ) ; } void RemoveW1Bus( int bus_master ) { struct connection_in * in = CreateW1In( bus_master ) ; Del_InFlight( W1_nomatch, in ) ; // tolerant of in==NO_CONNECTION } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_connect_out.c0000644000175000017500000000354411706154300016416 00000000000000/* $Id: ow_connect_out.c,v 1.1 2012/01/20 03:00:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" /* Routines for handling a linked list of connections out */ /* typical connection out would be a network port for owserver or web access */ struct outbound_control Outbound_Control = { .active = 0, .next_index = 0, .head = NULL, }; struct connection_out *NewOut(void) { size_t len = sizeof(struct connection_out); struct connection_out *now = (struct connection_out *) owmalloc(len); if (now) { memset(now, 0, len); now->next = Outbound_Control.head; Outbound_Control.head = now; now->index = Outbound_Control.next_index++; ++Outbound_Control.active ; // Zero sref's -- done with struct memset //now->sref0 = 0 ; //now->sref1 = 0 ; } else { LEVEL_DEFAULT("Cannot allocate memory for server structure,"); } return now; } void FreeOutAll(void) { struct connection_out *next = Outbound_Control.head; struct connection_out *now; Outbound_Control.head = NULL; Outbound_Control.active = 0; while (next) { now = next; next = now->next; LEVEL_DEBUG("Freeing outbound %s #%d",now->zero.name,now->index); SAFEFREE(now->zero.name) ; SAFEFREE(now->zero.type) ; SAFEFREE(now->zero.domain) ; SAFEFREE(now->name) ; SAFEFREE(now->host) ; SAFEFREE(now->service) ; if (now->ai) { freeaddrinfo(now->ai); now->ai = NULL; } #if OW_ZERO if (libdnssd != NULL) { if (now->sref0) { DNSServiceRefDeallocate(now->sref0); } if (now->sref1) { DNSServiceRefDeallocate(now->sref1); } } #endif owfree(now); } } owfs-2.8p15/module/owlib/src/c/ow_locks.c0000644000175000017500000000500011742172216015204 00000000000000/* $Id: ow_locks.c,v 1.94 2012/04/14 03:52:46 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* locks are to handle multithreading */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Globals ----------- */ #if OW_MT #ifdef __UCLIBC__ #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) < 0x00091D) /* If uClibc < 0.9.29, then re-initialize internal pthread-structs */ extern char *__pthread_initial_thread_bos; void __pthread_initialize(void); #endif /* UCLIBC_VERSION */ #endif /* __UCLIBC__ */ #endif /* OW_MT */ // Global structure holding mutexes struct mutexes Mutex ; /* Essentially sets up mutexes to protect global data/devices */ void LockSetup(void) { #if OW_MT /* global mutex attribute */ _MUTEX_ATTR_INIT(Mutex.mattr); #ifdef __UCLIBC__ #if ((__UCLIBC_MAJOR__ << 16)+(__UCLIBC_MINOR__ << 8)+(__UCLIBC_SUBLEVEL__) < 0x00091D) /* If uClibc < 0.9.29, then re-initialize internal pthread-structs * pthread and mutexes doesn't work after daemon() is called and * the main-process is gone. * * This workaround will probably be fixed in uClibc-0.9.28 * Other uClibc developers have noticed similar problems which are * trigged when pthread functions are used in shared libraries. */ __pthread_initial_thread_bos = NULL; __pthread_initialize(); _MUTEX_ATTR_SET(Mutex.mattr, PTHREAD_MUTEX_ADAPTIVE_NP); #else /* UCLIBC_VERSION */ _MUTEX_ATTR_SET(Mutex.mattr, PTHREAD_MUTEX_DEFAULT); #endif /* UCLIBC_VERSION */ _MUTEX_INIT(Mutex.uclibc_mutex); #else /* __UCLIBC__ */ _MUTEX_ATTR_SET(Mutex.mattr, PTHREAD_MUTEX_DEFAULT); #endif /* __UCLIBC__ */ _MUTEX_INIT(Mutex.stat_mutex); _MUTEX_INIT(Mutex.controlflags_mutex); _MUTEX_INIT(Mutex.fstat_mutex); _MUTEX_INIT(Mutex.dir_mutex); _MUTEX_INIT(Mutex.typedir_mutex); _MUTEX_INIT(Mutex.externaldir_mutex); _MUTEX_INIT(Mutex.namefind_mutex); _MUTEX_INIT(Mutex.aliasfind_mutex); _MUTEX_INIT(Mutex.externalcount_mutex); RWLOCK_INIT(Mutex.lib); RWLOCK_INIT(Mutex.cache); RWLOCK_INIT(Mutex.persistent_cache); RWLOCK_INIT(Inbound_Control.lock); RWLOCK_INIT(Inbound_Control.monitor_lock); #if OW_USB _MUTEX_INIT(Mutex.libusb_mutex); #endif /* OW_USB */ #endif /* OW_MT */ } owfs-2.8p15/module/owlib/src/c/ow_2413.c0000644000175000017500000001260711740076517014502 00000000000000/* $Id: ow_2413.c,v 1.60 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Changes 7/2004 Extensive improvements based on input from Serg Oskin */ #include #include "owfs_config.h" #include "ow_2413.h" /* ------- Prototypes ----------- */ /* DS2413 switch */ READ_FUNCTION(FS_r_piostate); WRITE_FUNCTION(FS_w_piostate); READ_FUNCTION(FS_r_pio); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_sense); //READ_FUNCTION(FS_r_latch); /* ------- Structures ----------- */ static struct aggregate A2413 = { 2, ag_letters, ag_aggregate, }; static struct filetype DS2413[] = { F_STANDARD, {"piostate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_piostate, FS_w_piostate, INVISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_BITFIELD, &A2413, ft_bitfield, fc_link, FS_r_pio, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A2413, ft_bitfield, fc_link, FS_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, // {"latch", PROPERTY_LENGTH_BITFIELD, &A2413, ft_bitfield, fc_link, FS_r_latch, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(3A, DS2413, DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_PIO_ACCESS_READ 0xF5 #define _1W_PIO_ACCESS_WRITE 0x5A #define _1W_2413_LATCH_MASK 0x0A #define _1W_2413_CONFIRMATION 0xAA /* ------- Functions ------------ */ /* DS2413 */ static GOOD_OR_BAD OW_write(BYTE data, const struct parsedname *pn); static GOOD_OR_BAD OW_read(BYTE * data, const struct parsedname *pn); static UINT SENSED_state(UINT status_bits); static UINT LATCH_state(UINT status_bits); static ZERO_OR_ERROR FS_r_piostate(struct one_wire_query *owq) { /* surrogate property bit 0 PIOA pin state bit 1 PIOA latch state bit 2 PIOB pin state bit 3 PIOB latch state */ BYTE piostate ; if ( OW_read( &piostate, PN(owq) ) ) { return -EINVAL ; } OWQ_U(owq) = piostate ; return 0 ; } /* write 2413 switch -- 2 values*/ static ZERO_OR_ERROR FS_w_piostate(struct one_wire_query *owq) { UINT pio = OWQ_U(owq) ; return OW_write( pio, PN(owq) ) ? -EINVAL : 0 ; } /* 2413 switch activity latch is actual set state of PIOs, what we want in this case */ /* bites 1 and 3 */ static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { UINT piostate = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &piostate, "piostate", owq ) ; // bits 1>0 and 3->1 // complement OWQ_U(owq) = LATCH_state( piostate ) ^ 0x03 ; return z_or_e ; } /* write 2413 switch -- 2 values*/ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { // complement ZERO_OR_ERROR ret = FS_w_sibling_U( OWQ_U(owq) ^ 0x03 , "piostate", owq ); if ( ret == 0 ) { // Able to write, but piostate is potentially now incorrect // since we use a different method to set pios FS_del_sibling( "piostate", owq ) ; return 0 ; } return ret ; } /* 2413 switch PIO sensed*/ /* bits 0 and 2 */ static ZERO_OR_ERROR FS_sense(struct one_wire_query *owq) { UINT piostate = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &piostate, "piostate", owq ) ; // bits 0->0 and 2->1 OWQ_U(owq) = SENSED_state(piostate) ; return z_or_e ; } /* read status byte */ static GOOD_OR_BAD OW_read(BYTE * data, const struct parsedname *pn) { BYTE cmd[] = { _1W_PIO_ACCESS_READ, }; BYTE resp[1] ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(cmd), TRXN_READ1(resp), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; // High nibble the complement of low nibble? // Fix thanks to josef_heiler if ((resp[0] & 0x0F) != ((~resp[0] >> 4) & 0x0F)) { return gbBAD; } data[0] = resp[0] & 0x0F ; return gbGOOD; } /* write status byte */ /* top 6 bits are set to 1, complement then sent */ static GOOD_OR_BAD OW_write(BYTE data, const struct parsedname *pn) { BYTE data_masked = data | 0xFC ; BYTE cmd[] = { _1W_PIO_ACCESS_WRITE, data_masked, ~data_masked, }; BYTE chk[1]; BYTE confirm[] = { _1W_2413_CONFIRMATION, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(cmd), TRXN_READ1(chk), TRXN_COMPARE(chk,confirm,1), TRXN_END, }; return BUS_transaction(t, pn) ; } // piostate -> sense static UINT SENSED_state(UINT status_bits) { return ((status_bits & 0x01) >> 0) | ((status_bits & 0x04) >>1); } // piostate -> latch static UINT LATCH_state(UINT status_bits) { return ((status_bits & 0x02) >> 1) | ((status_bits & 0x08) >>2); } owfs-2.8p15/module/owlib/src/c/ow_server.c0000664000175000017500000000562611504260776015424 00000000000000/* $Id: ow_server.c,v 1.151 2010/12/22 02:27:10 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" static void Server_setroutines(struct interface_routines *f); static void Zero_setroutines(struct interface_routines *f); static void Server_close(struct connection_in *in); static void Server_setroutines(struct interface_routines *f) { f->detect = Server_detect; f->reset = NO_RESET_ROUTINE; f->next_both = NO_NEXT_BOTH_ROUTINE ; f->PowerByte = NO_POWERBYTE_ROUTINE; f->ProgramPulse = NO_PROGRAMPULSE_ROUTINE; f->sendback_data = NO_SENDBACKDATA_ROUTINE; f->sendback_bits = NO_SENDBACKBITS_ROUTINE; f->select = NO_SELECT_ROUTINE; f->select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; f->reconnect = NO_RECONNECT_ROUTINE; f->close = Server_close; f->flags = 0 ; } static void Zero_setroutines(struct interface_routines *f) { f->detect = Server_detect; f->reset = NO_RESET_ROUTINE; f->next_both = NO_NEXT_BOTH_ROUTINE ; f->PowerByte = NO_POWERBYTE_ROUTINE; f->ProgramPulse = NO_PROGRAMPULSE_ROUTINE; f->sendback_data = NO_SENDBACKDATA_ROUTINE; f->sendback_bits = NO_SENDBACKBITS_ROUTINE; f->select = NO_SELECT_ROUTINE; f->select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; f->reconnect = NO_RECONNECT_ROUTINE; f->close = Server_close; f->flags = 0 ; } // bus_zero is a server found by zeroconf/Bonjour // It differs in that the server must respond GOOD_OR_BAD Zero_detect(struct connection_in *in) { if ( in==NO_CONNECTION ) { return gbBAD ; } SOC(in)->type = ct_tcp ; SOC(in)->state = cs_virgin ; in->busmode = bus_zero; if (SOC(in)->devicename == NULL) { return gbBAD; } RETURN_BAD_IF_BAD( COM_open(in) ) ; in->Adapter = adapter_tcp; in->adapter_name = "tcp"; Zero_setroutines(&(in->iroutines)); return gbGOOD; } // Set up inbound connection to an owserver // Actual tcp connection created as needed GOOD_OR_BAD Server_detect(struct connection_in *in) { if (SOC(in)->devicename == NULL) { return gbBAD; } SOC(in)->type = ct_tcp ; SOC(in)->state = cs_virgin ; RETURN_BAD_IF_BAD( COM_open(in) ) ; in->Adapter = adapter_tcp; in->adapter_name = "tcp"; in->busmode = bus_server; Server_setroutines(&(in->iroutines)); return gbGOOD; } // Free up the owserver inbound connection // actual connections opened and closed independently static void Server_close(struct connection_in *in) { SAFEFREE(in->master.tcp.type) ; SAFEFREE(in->master.tcp.domain) ; SAFEFREE(in->master.tcp.name) ; } owfs-2.8p15/module/owlib/src/c/ow_system.c0000644000175000017500000001170511740076517015433 00000000000000/* $Id: ow_system.c,v 1.71 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Stats are a pseudo-device -- they are a file-system entry and handled as such, but have a different caching type to distiguish their handling */ #include #include "owfs_config.h" #include "ow_system.h" #include "ow_pid.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ /* Statistics reporting */ READ_FUNCTION(FS_pidfile); READ_FUNCTION(FS_pid); READ_FUNCTION(FS_in); READ_FUNCTION(FS_out); READ_FUNCTION(FS_define); /* -------- Structures ---------- */ /* special entry -- picked off by parsing before filetypes tried */ static struct filetype sys_process[] = { {"pidfile", 128, NON_AGGREGATE, ft_vascii, fc_static, FS_pidfile, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA,}, // variable length {"pid", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_pid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; struct device d_sys_process = { "process", "process", ePN_system, COUNT_OF_FILETYPES(sys_process), sys_process, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype sys_connections[] = { {"count_current_buses", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_in, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"count_outbound_connections", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_out, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; struct device d_sys_connections = { "connections", "connections", ePN_system, COUNT_OF_FILETYPES(sys_connections), sys_connections, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype sys_configure[] = { {"threaded", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_MT}, }, {"tai8570", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_TAI8570}, }, {"thermocouples", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_THERMOCOUPLE}, }, {"parport", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_PARPORT}, }, {"USB", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_USB}, }, {"i2c", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_I2C}, }, {"cache", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_CACHE}, }, {"HA7Net", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_HA7}, }, {"DebugInfo", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:OW_DEBUG}, }, {"zeroconf", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_static, FS_define, NO_WRITE_FUNCTION, VISIBLE, {i:1}, }, }; struct device d_sys_configure = { "configuration", "configuration", ePN_system, COUNT_OF_FILETYPES(sys_configure), sys_configure, NO_GENERIC_READ, NO_GENERIC_WRITE }; /* ------- Functions ------------ */ static ZERO_OR_ERROR FS_pidfile(struct one_wire_query *owq) { char *name = ""; if (pid_file) { name = pid_file; } return OWQ_format_output_offset_and_size_z(name, owq); } static ZERO_OR_ERROR FS_pid(struct one_wire_query *owq) { OWQ_U(owq) = getpid(); return 0; } static ZERO_OR_ERROR FS_in(struct one_wire_query *owq) { OWQ_U(owq) = Inbound_Control.active; return 0; } static ZERO_OR_ERROR FS_out(struct one_wire_query *owq) { OWQ_U(owq) = Outbound_Control.active; return 0; } static ZERO_OR_ERROR FS_define(struct one_wire_query *owq) { OWQ_Y(owq) = OWQ_pn(owq).selected_filetype->data.i; return 0; } owfs-2.8p15/module/owlib/src/c/ow_powerbyte.c0000664000175000017500000000327211501212424016111 00000000000000/* $Id: ow_powerbyte.c,v 1.6 2010/12/12 18:31:48 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" // Send 8 bits of communication to the 1-Wire Net // Delay delay msec and return to normal // // Power is supplied by normal pull-up resistor, nothing special // /* Returns 0=good bad = -EIO */ GOOD_OR_BAD BUS_PowerByte(BYTE data, BYTE * resp, UINT delay, const struct parsedname *pn) { GOOD_OR_BAD ret; struct connection_in * in = pn->selected_connection ; if ( in->iroutines.PowerByte !=NO_POWERBYTE_ROUTINE ) { // use available byte level routine ret = (in->iroutines.PowerByte) (data, resp, delay, pn); } else if ( in->iroutines.PowerBit != NO_POWERBIT_ROUTINE && in->iroutines.sendback_bits != NO_SENDBACKBITS_ROUTINE ) { // use available bit level routines BYTE sending[8]; BYTE receive[8] ; int i ; for ( i = 0 ; i < 8 ; ++i ) { sending[i] = UT_getbit(&data,i) ? 0xFF : 0x00 ; } ret = BUS_sendback_bits( sending, receive, 7, pn ) ; if ( GOOD(ret) ) { ret = BUS_PowerBit( sending[7], &receive[7], delay, pn ) ; } for ( i = 0 ; i < 8 ; ++i ) { UT_setbit( resp, i, receive[i] ) ; } } else { // send with no true power applied ret = BUS_sendback_data(&data, resp, 1, pn); // delay UT_delay(delay); } if ( BAD(ret) ) { STAT_ADD1_BUS(e_bus_pullup_errors, in); return gbBAD ; } return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_dnssd.c0000664000175000017500000000466111616030345015216 00000000000000/* $Id: ow_dnssd.c,v 1.23 2011/08/02 17:16:21 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2006 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #if OW_ZERO #include "ow.h" #include "ow_dl.h" #include "ow_dnssd.h" DLHANDLE libdnssd = NULL; #if OW_CYGWIN #ifdef HAVE_DLFCN_H #include #endif /* HAVE_DLFCN_H */ #endif /* OW_CYGWIN */ _DNSServiceRefSockFD DNSServiceRefSockFD; _DNSServiceProcessResult DNSServiceProcessResult; _DNSServiceRefDeallocate DNSServiceRefDeallocate; _DNSServiceResolve DNSServiceResolve; _DNSServiceBrowse DNSServiceBrowse; _DNSServiceRegister DNSServiceRegister; _DNSServiceReconfirmRecord DNSServiceReconfirmRecord; _DNSServiceCreateConnection DNSServiceCreateConnection; _DNSServiceEnumerateDomains DNSServiceEnumerateDomains; #define DNSfunction_link( name ) name = (_##name) DL_sym( libdnssd, #name );\ if ( name == NULL ) {\ LEVEL_CONNECT("Zeroconf/Bonjour is disabled since "#name" isn't found");\ return -1;\ } else { \ LEVEL_DEBUG("Linked in Bonjour function "#name) ;\ } int OW_Load_dnssd_library(void) { int i ; libdnssd = NULL ; // marker for successful opening of library char libdirs[3][80] = { #if OW_CYGWIN //{ "/opt/owfs/lib/libdns_sd.dll" }, {"libdns_sd.dll"}, #elif OW_DARWIN // MacOSX have dnssd functions in libSystem {"libSystem.dylib"}, #elif defined(HAVE_DLOPEN) {"/opt/owfs/lib/libdns_sd.so"}, {"libdns_sd.so"}, #endif {""} // needed at end }; for ( i=0 ; *libdirs[i] ; ++i ) { libdnssd = DL_open( libdirs[i] ) ; if ( libdnssd != NULL ) { LEVEL_CONNECT( "DL_open [%s] success", libdirs[i] ); break ; } } if (libdnssd == NULL) { LEVEL_CONNECT("Zeroconf/Bonjour is disabled since dnssd library isn't found"); return -1; } DNSfunction_link(DNSServiceRefSockFD); DNSfunction_link(DNSServiceProcessResult); DNSfunction_link(DNSServiceRefDeallocate); DNSfunction_link(DNSServiceResolve); DNSfunction_link(DNSServiceBrowse); DNSfunction_link(DNSServiceRegister); DNSfunction_link(DNSServiceReconfirmRecord); DNSfunction_link(DNSServiceCreateConnection); DNSfunction_link(DNSServiceEnumerateDomains); return 0; } void OW_Free_dnssd_library(void) { if (libdnssd) { DL_close(libdnssd); libdnssd = NULL; } } #endif /* OW_ZERO */ owfs-2.8p15/module/owlib/src/c/ow_dirblob.c0000664000175000017500000000744611611434674015534 00000000000000/* $Id: ow_dirblob.c,v 1.19 2011/07/20 02:13:16 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface LI -- LINK commands L1 -- 2480B commands FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #include #include "owfs_config.h" #include "ow.h" #define DIRBLOB_ELEMENT_LENGTH 8 #define DIRBLOB_ALLOCATION_INCREMENT 10 /* A "dirblob" is a structure holding a list of 1-wire serial numbers (8 bytes each) with some housekeeping information It is used for directory caches, and some "all at once" adapters types Most interestingly, it allocates memory dynamically. */ void DirblobClear(struct dirblob *db) { SAFEFREE(db->snlist) ; db->allocated = db->devices; db->devices = 0; db->troubled = 0; } void DirblobInit(struct dirblob *db) { db->devices = 0; db->allocated = 0; db->snlist = 0; db->troubled = 0; } int DirblobPure(const struct dirblob *db) { return !db->troubled; } void DirblobPoison(struct dirblob *db) { db->troubled = 1; } int DirblobElements(const struct dirblob *db) { return db->devices; } int DirblobAdd(const BYTE * sn, struct dirblob *db) { if ( db->troubled ) { return -EINVAL ; } // make more room? -- blocks of 10 devices (80byte) if ((db->devices >= db->allocated) || (db->snlist == NULL)) { int newalloc = db->allocated + DIRBLOB_ALLOCATION_INCREMENT; BYTE *try_bigger_block = owrealloc(db->snlist, DIRBLOB_ELEMENT_LENGTH * newalloc); if (try_bigger_block != NULL) { db->allocated = newalloc; db->snlist = try_bigger_block; } else { // allocation failed -- keep old db->troubled = 1; return -ENOMEM; } } // add the device and increment the counter memcpy(&(db->snlist[DIRBLOB_ELEMENT_LENGTH * db->devices]), sn, DIRBLOB_ELEMENT_LENGTH); ++db->devices; return 0; } int DirblobGet(int device_index, BYTE * sn, const struct dirblob *db) { if (device_index >= db->devices) { return -ENODEV; } memcpy(sn, &(db->snlist[DIRBLOB_ELEMENT_LENGTH * device_index]), DIRBLOB_ELEMENT_LENGTH); return 0; } /* Search for a serial number return position (>=0) on match return -1 on no match or error */ int DirblobSearch(BYTE * sn, const struct dirblob *db) { int device_index; if (db == NULL || db->devices < 1) { return INDEX_BAD; } for (device_index = 0; device_index < db->devices; ++device_index) { if (memcmp(sn, &(db->snlist[DIRBLOB_ELEMENT_LENGTH * device_index]), DIRBLOB_ELEMENT_LENGTH) == 0) { return device_index; } } return INDEX_BAD; } // used in cache, fixes up a dirblob when retrieved from the cache int DirblobRecreate( BYTE * snlist, int size, struct dirblob *db) { DirblobInit( db ) ; if ( size == 0 ) { return 0 ; } db->snlist = (BYTE *) owmalloc(size) ; if ( db->snlist == NULL ) { db->troubled = 1 ; return -ENOMEM ; } memcpy(db->snlist, snlist, size); db->allocated = db->devices = size / 8; return 0 ; } owfs-2.8p15/module/owlib/src/c/ow_1991.c0000644000175000017500000003736511740076517014524 00000000000000/* $Id: ow_1991.c,v 1.41 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1991.h" /* ------- Prototypes ----------- */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_ident); WRITE_FUNCTION(FS_w_ident); READ_FUNCTION(FS_r_memory); WRITE_FUNCTION(FS_w_memory); WRITE_FUNCTION(FS_w_password); WRITE_FUNCTION(FS_w_reset_password); WRITE_FUNCTION(FS_w_change_password); #define _DS1991_PAGES 3 #define _DS1991_PAGESIZE 48 /* ------- Structures ----------- */ static struct aggregate A1991 = { _DS1991_PAGES, ag_numbers, ag_separate, }; static struct filetype DS1991[] = { F_STANDARD, {"memory", 144, NON_AGGREGATE, ft_binary, fc_link, FS_r_memory, FS_w_memory, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 48, &A1991, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"pages/password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, {"pages/ident", 8, &A1991, ft_binary, fc_volatile, FS_r_ident, FS_w_ident, VISIBLE, NO_FILETYPE_DATA, }, {"settings", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"settings/reset_password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_reset_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/change_password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_change_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/ident", 8, &A1991, ft_binary, fc_volatile, FS_r_ident, FS_w_ident, VISIBLE, NO_FILETYPE_DATA, }, {"settings/page", 48, &A1991, ft_binary, fc_volatile, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(02, DS1991, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1425[] = { F_STANDARD, {"memory", 144, NON_AGGREGATE, ft_binary, fc_link, FS_r_memory, FS_w_memory, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 48, &A1991, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"pages/password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, {"pages/ident", 8, &A1991, ft_binary, fc_volatile, FS_r_ident, FS_w_ident, VISIBLE, NO_FILETYPE_DATA, }, {"settings", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"settings/reset_password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_reset_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/change_password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_change_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/password", 8, &A1991, ft_binary, fc_stable, NO_READ_FUNCTION, FS_w_password, VISIBLE, NO_FILETYPE_DATA, }, {"settings/ident", 8, &A1991, ft_binary, fc_volatile, FS_r_ident, FS_w_ident, VISIBLE, NO_FILETYPE_DATA, }, {"settings/page", 48, &A1991, ft_binary, fc_volatile, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(82, DS1425, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x96 #define _1W_READ_SCRATCHPAD 0x69 #define _1W_COPY_SCRATCHPAD 0x3C #define _1W_WRITE_PASSWORD 0x5A #define _1W_WRITE_SUBKEY 0x99 #define _1W_READ_SUBKEY 0x66 static BYTE global_passwd[_DS1991_PAGES][8] = { "", "", "" }; /* ------- Functions ------------ */ static GOOD_OR_BAD OW_r_ident(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_ident(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_reset_password(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_change_password(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_page(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_page(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_memory(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_w_memory(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn); static GOOD_OR_BAD OW_r_subkey(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn, const int extension); static GOOD_OR_BAD OW_w_subkey(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn, const int extension); /* array with magic bytes representing the Copy Scratch operations */ enum block { ALL = 0, IDENT, PASSWORD, DATA }; static const BYTE cp_array[9][8] = { {0x56, 0x56, 0x7F, 0x51, 0x57, 0x5D, 0x5A, 0x7F}, // 00-3F {0x9A, 0x9A, 0xB3, 0x9D, 0x64, 0x6E, 0x69, 0x4C}, // ident {0x9A, 0x9A, 0x4C, 0x62, 0x9B, 0x91, 0x69, 0x4C}, // passwd {0x9A, 0x65, 0xB3, 0x62, 0x9B, 0x6E, 0x96, 0x4C}, // 10-17 {0x6A, 0x6A, 0x43, 0x6D, 0x6B, 0x61, 0x66, 0x43}, // 18-1F {0x95, 0x95, 0xBC, 0x92, 0x94, 0x9E, 0x99, 0xBC}, // 20-27 {0x65, 0x9A, 0x4C, 0x9D, 0x64, 0x91, 0x69, 0xB3}, // 28-2F {0x65, 0x65, 0xB3, 0x9D, 0x64, 0x6E, 0x96, 0xB3}, // 30-37 {0x65, 0x65, 0x4C, 0x62, 0x9B, 0x91, 0x96, 0xB3}, // 38-3F }; #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif static ZERO_OR_ERROR FS_w_password(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); size_t s = OWQ_size(owq); if (s > 8) { s = 8; } memset(global_passwd[pn->extension], 0, 8); memcpy(global_passwd[pn->extension], (BYTE *) OWQ_buffer(owq), s); //printf("Use password [%s] for subkey %d\n", global_passwd[pn->extension], pn->extension); return 0; } static ZERO_OR_ERROR FS_w_reset_password(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_reset_password((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_change_password(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_change_password((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_page((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_page((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_ident(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_ident((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_ident(struct one_wire_query *owq) { if (OWQ_offset(owq)) { return -EINVAL; } return GB_to_Z_OR_E(OW_w_ident((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_r_memory(struct one_wire_query *owq) { OWQ_length(owq) = OWQ_size(owq) ; return GB_to_Z_OR_E(OW_r_memory((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static ZERO_OR_ERROR FS_w_memory(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_memory((BYTE *) OWQ_buffer(owq), OWQ_size(owq), (size_t) OWQ_offset(owq), PN(owq))) ; } static GOOD_OR_BAD OW_w_reset_password(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE set_password[_DS1991_PAGES] = { _1W_WRITE_PASSWORD, 0x00, 0x00 }; BYTE passwd[8]; BYTE ident[8]; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(set_password), TRXN_READ(ident, 8), TRXN_WRITE(ident, 8), TRXN_WRITE(ident, 8), TRXN_WRITE(passwd, 8), TRXN_END, }; if (offset) { return gbBAD; } memset(passwd, 0, 8); memcpy(passwd, data, MIN(size, 8)); set_password[1] = pn->extension << 6; set_password[2] = ~(set_password[1]); RETURN_BAD_IF_BAD(BUS_transaction(tscratch, pn)) ; /* Verification is done... now send ident + password * Note: ALL saved data in subkey will be deleted during this operation */ memcpy(global_passwd[pn->extension], passwd, 8); return gbGOOD; } static GOOD_OR_BAD OW_w_subkey(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn, const int extension) { BYTE p[4] = { _1W_WRITE_SUBKEY, 0x00, 0x00, 0x00 }; // write subkey BYTE ident[8]; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ(ident, 8), TRXN_WRITE(global_passwd[extension], 8), TRXN_WRITE(&data[0x10], size - 0x10), TRXN_END, }; if ((size <= 0x10) || (size > 0x40)) { return gbBAD; } p[1] = extension << 6; p[1] |= (0x10 + offset); // + 0x10 -> 0x3F p[2] = ~(p[1]); return BUS_transaction(tscratch, pn) ; } static GOOD_OR_BAD OW_r_subkey(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn, const int extension) { BYTE p[_DS1991_PAGES] = { _1W_READ_SUBKEY, 0x00, 0x00 }; // read subkey struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ(data, 8), TRXN_WRITE(global_passwd[extension], 8), TRXN_WRITE(&data[0x10 + offset], 0x30 - offset), TRXN_END, }; memset(data, 0, 0x40); memcpy(&data[8], global_passwd[extension], 8); if (offset >= 0x30) { return gbBAD; } if (size != 0x40) { /* Only allow reading whole subkey right now */ return gbBAD; } p[1] = extension << 6; p[1] |= (offset + 0x10); p[2] = ~(p[1]); return BUS_transaction(tscratch, pn) ; } static GOOD_OR_BAD OW_r_memory(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE all_data[0x40]; int i, nr_bytes; size_t left = size; if (offset) { return gbBAD; } for (i = 0; (i < _DS1991_PAGES) && (left > 0); i++) { memset(all_data, 0, 0x40); RETURN_BAD_IF_BAD( OW_r_subkey(all_data, 0x40, 0, pn, i) ); nr_bytes = MIN(0x30, left); memcpy(&data[i * 0x30], &all_data[0x10], nr_bytes); left -= nr_bytes; } return gbGOOD; } static GOOD_OR_BAD OW_w_memory(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE all_data[0x40]; int i, nr_bytes; size_t left = size; if (offset) { return gbBAD; } for (i = 0; (i < _DS1991_PAGES) && (left > 0); i++) { memset(all_data, 0, 0x40); RETURN_BAD_IF_BAD( OW_r_subkey(all_data, 0x40, 0, pn, i) ); nr_bytes = MIN(0x30, left); memcpy(&all_data[0x10], &data[size - left], nr_bytes); RETURN_BAD_IF_BAD( OW_w_subkey(all_data, 0x40, 0, pn, i) ); left -= nr_bytes; } return gbGOOD; } // size and offset already bounds checked static GOOD_OR_BAD OW_r_ident(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE all_data[0x40]; RETURN_BAD_IF_BAD(OW_r_subkey(all_data, 0x40, 0, pn, pn->extension)) ; memcpy(data, &all_data[offset], size); return gbGOOD; } static GOOD_OR_BAD OW_w_ident(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE write_scratch[_DS1991_PAGES] = { _1W_WRITE_SCRATCHPAD, 0x00, 0x00 }; BYTE copy_scratch[_DS1991_PAGES] = { _1W_COPY_SCRATCHPAD, 0x00, 0x00 }; BYTE all_data[0x40]; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(write_scratch), TRXN_WRITE(all_data, 0x40), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(copy_scratch), TRXN_WRITE(cp_array[IDENT], 8), TRXN_WRITE(global_passwd[pn->extension], 8), TRXN_END, }; write_scratch[1] = 0xC0 + offset; write_scratch[2] = ~(write_scratch[1]); memset(all_data, 0, 0x40); memcpy(all_data, data, MIN(size, 8)); RETURN_BAD_IF_BAD(BUS_transaction(tscratch, pn)) ; copy_scratch[1] = pn->extension << 6; copy_scratch[2] = ~(copy_scratch[1]); RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; return gbGOOD; } static GOOD_OR_BAD OW_w_change_password(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE write_scratch[_DS1991_PAGES] = { _1W_WRITE_SCRATCHPAD, 0x00, 0x00 }; BYTE copy_scratch[_DS1991_PAGES] = { _1W_COPY_SCRATCHPAD, 0x00, 0x00 }; BYTE all_data[0x40]; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(write_scratch), TRXN_WRITE(all_data, 0x40), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(copy_scratch), TRXN_WRITE(cp_array[PASSWORD], 8), TRXN_WRITE(global_passwd[pn->extension], 8), TRXN_END, }; write_scratch[1] = 0xC0 + offset; write_scratch[2] = ~(write_scratch[1]); memset(all_data, 0, 0x40); memcpy(&all_data[0x08], data, MIN(size, 8)); RETURN_BAD_IF_BAD(BUS_transaction(tscratch, pn)) ; copy_scratch[1] = pn->extension << 6; copy_scratch[2] = ~(copy_scratch[1]); RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; memcpy(global_passwd[pn->extension], &all_data[0x08], 8); return gbGOOD; } static GOOD_OR_BAD OW_r_page(BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE all_data[0x40]; if (offset > 0x2F) { return gbBAD; } RETURN_BAD_IF_BAD( OW_r_subkey(all_data, 0x40, 0, pn, pn->extension) ); memcpy(data, &all_data[0x10 + offset], size); return gbGOOD; } static GOOD_OR_BAD OW_w_page(const BYTE * data, const size_t size, const off_t offset, const struct parsedname *pn) { BYTE write_scratch[_DS1991_PAGES] = { _1W_WRITE_SCRATCHPAD, 0xC0, BYTE_INVERSE(0xC0) }; BYTE copy_scratch[_DS1991_PAGES] = { _1W_COPY_SCRATCHPAD, 0x00, 0x00 }; BYTE all_data[0x40]; int i, nr_bytes; size_t left = size; struct transaction_log tscratch[] = { TRXN_START, TRXN_WRITE3(write_scratch), TRXN_WRITE(all_data, 0x40), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(copy_scratch), TRXN_WRITE(global_passwd[pn->extension], 8), TRXN_END, }; (void) offset; // to suppress compiler warning if (size > 0x30) { //printf("size > 0x30\n"); return gbBAD; } memset(all_data, 0, 0x40); memcpy(&all_data[0x10], data, size); RETURN_BAD_IF_BAD(BUS_transaction(tscratch, pn)) ; /* * There are two possibilities to write memory. * Write byte 0x00->0x3F (including ident,password) * Write only 8 bytes at a time. * Haven't decided if I should: * read page(48 bytes), overwrite data, save page * or * write block (8 bytes) */ for (i = 0; (i < 8) && (left > 0); i++) { nr_bytes = MIN(left, 8); copy_scratch[1] = (pn->extension << 6); copy_scratch[2] = ~(copy_scratch[1]); tcopy[2].out = cp_array[DATA + i]; RETURN_BAD_IF_BAD(BUS_transaction(tcopy, pn)) ; left -= nr_bytes; } return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_simultaneous.c0000644000175000017500000002552211740076517016641 00000000000000/* $Id: ow_simultaneous.c,v 1.89 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Simultaneous is a trigger to do a mass conversion on all the devices in the specified path */ /* Added "present" From Jan Kandziora to search for any devices */ #include #include "owfs_config.h" #include "ow_simultaneous.h" /* ------- Prototypes ----------- */ /* Statistics reporting */ READ_FUNCTION(FS_r_convert); WRITE_FUNCTION(FS_w_convert_temp); WRITE_FUNCTION(FS_w_convert_volt); READ_FUNCTION(FS_r_present); READ_FUNCTION(FS_r_single); /* -------- Structures ---------- */ static struct filetype simultaneous[] = { {"temperature", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_convert, FS_w_convert_temp, VISIBLE, {i:simul_temp}, }, {"voltage", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_convert, FS_w_convert_volt, VISIBLE, {i:simul_volt}, }, {"present", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_present, NO_WRITE_FUNCTION, VISIBLE, {i:_1W_READ_ROM}, }, {"present_ds2400", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_present, NO_WRITE_FUNCTION, VISIBLE, {i:_1W_OLD_READ_ROM}, }, {"single", 18, NON_AGGREGATE, ft_ascii, fc_volatile, FS_r_single, NO_WRITE_FUNCTION, VISIBLE, {i:_1W_READ_ROM}, }, {"single_ds2400", 18, NON_AGGREGATE, ft_ascii, fc_volatile, FS_r_single, NO_WRITE_FUNCTION, VISIBLE, {i:_1W_OLD_READ_ROM}, }, }; DeviceEntry(simultaneous, simultaneous, NO_GENERIC_READ, NO_GENERIC_WRITE); // in this order: enum sumul_type { simul_temp, simul_volt, } ; struct internal_prop ipSimul[] = { {"temperature", fc_volatile}, {"voltage", fc_volatile}, }; #define _1W_CONVERT_T 0x44 #define _1W_READ_POWERMODE 0xB4 /* ------- Functions ------------ */ static void OW_single2cache(BYTE * sn, const struct parsedname *pn2); GOOD_OR_BAD FS_Test_Simultaneous( enum simul_type type, UINT delay, const struct parsedname * pn) { time_t dwell_time ; time_t remaining_delay ; //LEVEL_DEBUG("TEST Simultaneous valid?"); if( BAD( Cache_Get_Simul_Time(type, &dwell_time, pn)) ) { LEVEL_DEBUG("No simultaneous conversion currently valid"); return gbBAD ; // No simultaneous valid } remaining_delay = delay - 1000 * dwell_time ; LEVEL_DEBUG("TEST remaining delay=%ld, delay=%ld, 1000*dwelltime=%ld",(long int)remaining_delay,(long int)delay, (long int)(1000*dwell_time)); if ( remaining_delay > 0 ) { LEVEL_DEBUG("Simultaneous conversion requires %d msec delay",(int) remaining_delay); UT_delay(remaining_delay) ; } else { LEVEL_DEBUG("Simultaneous conversion, no delay"); } return gbGOOD ; } static ZERO_OR_ERROR FS_w_convert_temp(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct parsedname s_pn_directory; struct parsedname * pn_directory = &s_pn_directory ; struct connection_in * in = pn->selected_connection ; const BYTE cmd_temp[] = { _1W_SKIP_ROM, _1W_CONVERT_T }; const BYTE cmd_powermode[] = { _1W_READ_POWERMODE, }; BYTE pow[1] ; struct transaction_log tpower[] = { TRXN_START, TRXN_WRITE1(cmd_powermode), TRXN_READ1(pow), TRXN_END, }; struct transaction_log t_powered_convert[] = { TRXN_START, TRXN_WRITE2(cmd_temp), TRXN_END, }; struct transaction_log t_unpowered_convert[] = { TRXN_START, TRXN_WRITE2(cmd_temp), TRXN_DELAY(1000), TRXN_END, }; if (OWQ_Y(owq) == 0) { return 0; // don't send convert } switch (in->Adapter) { case adapter_Bad: case adapter_w1_monitor: case adapter_browse_monitor: case adapter_usb_monitor: case adapter_fake: case adapter_tester: case adapter_mock: /* Since writing to /simultaneous/temperature is done recursive to all * adapters, we have to fake a successful write even if it's detected * as an unsupported adapter. */ return gbGOOD ; default: break ; } FS_LoadDirectoryOnly(pn_directory, pn); // setup up for full directory message // Get Power status RETURN_BAD_IF_BAD(BUS_transaction(tpower, pn_directory)) ; //LEVEL_DEBUG("TEST read power"); Cache_Add_Simul(simul_temp, pn_directory); // Mark start time if ( pow[0] != 0 ) { // powered // Send the conversion and let the timing work out when the actual // temperature reading is requested if ( GOOD(BUS_transaction(t_powered_convert, pn_directory) ) ) { return 0 ; } } else if ( in->Adapter == adapter_DS2482_800 ) { // special case for the 8-channel DS2482-800 // Rather than block the whole chip (all 8 channels) by polling GOOD_OR_BAD ret ; _MUTEX_LOCK(in->bus_mutex); // channel _MUTEX_LOCK(in->master.i2c.head->master.i2c.all_channel_lock); // master ret = BUS_transaction_nolock(t_powered_convert, pn_directory) ; _MUTEX_UNLOCK(in->master.i2c.head->master.i2c.all_channel_lock); //master if ( GOOD(ret) ) { UT_delay(1000) ; // wait for passive } _MUTEX_UNLOCK(in->bus_mutex); //channel if ( GOOD(ret) ) { return 0 ; } } else { if ( GOOD(BUS_transaction(t_unpowered_convert, pn_directory) )) { return 0 ; } } Cache_Del_Simul(simul_temp, pn_directory); // Clear start time LEVEL_DEBUG("Trouble setting simultaneous for %s",pn_directory->path); return -EINVAL ; } static ZERO_OR_ERROR FS_w_convert_volt(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct parsedname pn_directory; if (OWQ_Y(owq) == 0) { return 0; // don't send convert } FS_LoadDirectoryOnly(&pn_directory, pn); Cache_Del_Internal(&ipSimul[simul_volt], &pn_directory); // remove existing entry /* Since writing to /simultaneous/temperature is done recursive to all * adapters, we have to fake a successful write even if it's detected * as a bad adapter. */ if (pn->selected_connection->Adapter != adapter_Bad) { BYTE cmd_volt[] = { _1W_SKIP_ROM, 0x3C, 0x0F, 0x00, 0xFF, 0xFF }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(cmd_volt, 4, 0), TRXN_DELAY(5), TRXN_END, }; if ( GOOD(BUS_transaction(t, &pn_directory)) ) { Cache_Add_SlaveSpecific(NULL, 0, &ipSimul[simul_volt], &pn_directory); } } return 0; } static ZERO_OR_ERROR FS_r_convert(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); struct parsedname pn_directory; FS_LoadDirectoryOnly(&pn_directory, pn); OWQ_Y(owq) = GOOD (Cache_Get_SlaveSpecific(NULL, 0, &ipSimul[pn->selected_filetype->data.i], &pn_directory) ); return 0; } static ZERO_OR_ERROR FS_r_present(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); switch (pn->selected_connection->Adapter) { case adapter_fake: case adapter_tester: // fake adapter -- simple memory look OWQ_Y(owq) = (DirblobElements(&(pn->selected_connection->master.fake.main)) > 0); default: { struct parsedname pn_directory; BYTE read_ROM[1] ; BYTE resp[SERIAL_NUMBER_SIZE]; BYTE collisions[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; BYTE match[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(read_ROM), TRXN_READ(resp, 8), TRXN_END, }; /* check if DS2400 compatibility is needed */ read_ROM[0] = _1W_READ_ROM; FS_LoadDirectoryOnly(&pn_directory, pn); RETURN_ERROR_IF_BAD(BUS_transaction(t, &pn_directory)) ; if (memcmp(resp, collisions, SERIAL_NUMBER_SIZE)) { // all devices OWQ_Y(owq) = 1; // YES present } else if (memcmp(resp, match, SERIAL_NUMBER_SIZE)) { // some device(s) complained OWQ_Y(owq) = 1; // YES present if (CRC8(resp, SERIAL_NUMBER_SIZE)) { return 0; // crc8 error -- more than one device } OW_single2cache(resp, &pn_directory); } else { // no devices OWQ_Y(owq) = 0; } } break ; } return 0; } static ZERO_OR_ERROR FS_r_single(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); ASCII ad[30] = { 0x00, }; // long enough -- default "blank" BYTE resp[SERIAL_NUMBER_SIZE]; switch (pn->selected_connection->Adapter) { case adapter_fake: case adapter_tester: case adapter_mock: if (DirblobElements(&(pn->selected_connection->master.fake.main)) == 1) { DirblobGet(0, resp, &(pn->selected_connection->master.fake.main)); FS_devicename(ad, sizeof(ad), resp, pn); } break ; default: { struct parsedname pn_directory; BYTE read_ROM[1] ; BYTE match[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; BYTE collisions[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(read_ROM), TRXN_READ(resp, SERIAL_NUMBER_SIZE), TRXN_END, }; /* check if DS2400 compatibility is needed */ read_ROM[0] = pn->selected_filetype->data.i; FS_LoadDirectoryOnly(&pn_directory, pn); RETURN_ERROR_IF_BAD(BUS_transaction(t, &pn_directory)) ; LEVEL_DEBUG("dat=" SNformat " crc8=%02x", SNvar(resp), CRC8(resp, 7)); if ((memcmp(resp, collisions, SERIAL_NUMBER_SIZE) != 0) && (memcmp(resp, match, SERIAL_NUMBER_SIZE) != 0) && (CRC8(resp, SERIAL_NUMBER_SIZE) == 0)) { // non-empty, and no CRC error OW_single2cache(resp, &pn_directory); /* Return device id. */ FS_devicename(ad, sizeof(ad), resp, pn); } else { /* Jan Kandziora: I think it's not really an error if no iButton is connected to a lock. As EINVAL is given if something went wrong with the host adapter (e.g. pulled from the host), too, those errors are then obscured by catching the "no key connected" EINVAL. */ ad[0] = '\0' ; } } break ; } return OWQ_format_output_offset_and_size_z(ad, owq); } // Do cache for single item static void OW_single2cache(BYTE * sn, const struct parsedname *pn) { struct dirblob db; DirblobInit(&db); DirblobAdd(sn, &db); if (DirblobPure(&db)) { Cache_Add_Dir(&db, pn); // Directory cache } Cache_Add_Device(pn->selected_connection->index, sn); // Device cache } owfs-2.8p15/module/owlib/src/c/ow_udp_read.c0000664000175000017500000000437311440235033015662 00000000000000/* $Id: ow_udp_read.c,v 1.7 2010/09/03 18:10:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" /* Read "n" bytes from a descriptor. */ /* Stolen from Unix Network Programming by Stevens, Fenner, Rudoff p89 */ /* return < 0 if failure */ ssize_t udp_read(FILE_DESCRIPTOR_OR_ERROR file_descriptor, void *vptr, size_t n, const struct timeval * ptv, struct sockaddr_in *from, socklen_t *fromlen) { size_t nleft; char *ptr; ptr = vptr; nleft = n; while (nleft > 0) { int select_result; fd_set readset; struct timeval tv ; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); /* Read if it doesn't timeout first */ timercpy( &tv, ptv ) ; select_result = select(file_descriptor + 1, &readset, NULL, NULL, &tv); if (select_result > 0) { ssize_t read_or_error; /* Is there something to read? */ if (FD_ISSET(file_descriptor, &readset) == 0) { return -EIO; /* error */ } read_or_error = recvfrom(file_descriptor, ptr, nleft, 0, (struct sockaddr *)from, fromlen) ; if ( read_or_error < 0 ) { if (errno == EINTR) { errno = 0; // clear errno. We never use it anyway. } else { ERROR_DATA("udp read error"); return -EIO; } } else if (read_or_error == 0) { break; /* EOF */ } else { //Debug_Bytes( "UDPread",ptr, nread ) ; nleft -= read_or_error; ptr += read_or_error; } } else if (select_result < 0) { /* select error */ if (errno == EINTR) { /* select() was interrupted, try again */ continue; } ERROR_DATA("udp read selection error (network)"); return -EIO; } else { /* timed out */ LEVEL_CONNECT("udp read timeout after %d bytes", n - nleft); return -EAGAIN; } } return (n - nleft); /* return >= 0 */ } owfs-2.8p15/module/owlib/src/c/ow_bus.c0000664000175000017500000000144111446543274014700 00000000000000/* $Id: ow_bus.c,v 1.102 2010/09/23 03:17:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_connection.h" GOOD_OR_BAD BUS_detect( struct connection_in * in ) { GOOD_OR_BAD (*detect) (struct connection_in * in) = in->iroutines.detect ; if ( detect != NO_DETECT_ROUTINE ) { return (detect)(in) ; } return gbBAD ; } void BUS_close( struct connection_in * in ) { void (*bus_close) (struct connection_in * in) = in->iroutines.close ; if ( bus_close != NO_CLOSE_ROUTINE ) { return (bus_close)(in); } } owfs-2.8p15/module/owlib/src/c/ow_iterate.c0000664000175000017500000000441211360752555015544 00000000000000/* $Id: ow_iterate.c,v 1.19 2010/04/13 02:22:37 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_interate.c */ /* routines to split reads and writes if longer than page */ #include #include "owfs_config.h" #include "ow.h" GOOD_OR_BAD COMMON_readwrite_paged(struct one_wire_query *owq, size_t page, size_t pagelen, GOOD_OR_BAD (*readwritefunc) (BYTE *, size_t, off_t, struct parsedname *)) { size_t size = OWQ_size(owq); off_t offset = OWQ_offset(owq) + pagelen * page; BYTE *buffer_position = (BYTE *) OWQ_buffer(owq); struct parsedname *pn = PN(owq); /* successive pages, will start at page start */ OWQ_length(owq) = size; while (size > 0) { size_t thispage = pagelen - (offset % pagelen); if (thispage > size) { thispage = size; } RETURN_BAD_IF_BAD( readwritefunc(buffer_position, thispage, offset, pn) ) ; buffer_position += thispage; size -= thispage; offset += thispage; } return gbGOOD; } // The same as COMMON_readwrite_paged above except the results are nicely placed in the OWQ buffers with sizes and offsets. GOOD_OR_BAD COMMON_OWQ_readwrite_paged(struct one_wire_query *owq, size_t page, size_t pagelen, GOOD_OR_BAD (*readwritefunc) (struct one_wire_query *, size_t, size_t)) { size_t size = OWQ_size(owq); off_t offset = OWQ_offset(owq) + pagelen * page; struct parsedname *pn = PN(owq); OWQ_allocate_struct_and_pointer(owq_page); /* holds a pointer to a position in owq's buffer */ OWQ_create_temporary(owq_page, OWQ_buffer(owq), size, offset, pn); /* successive pages, will start at page start */ OWQ_length(owq) = size; while (size > 0) { size_t thispage = pagelen - (offset % pagelen); if (thispage > size) { thispage = size; } OWQ_size(owq_page) = thispage; if (readwritefunc(owq_page, 0, pagelen)) { LEVEL_DEBUG("error at offset %ld", (long) offset); return gbBAD; } OWQ_buffer(owq_page) += thispage; size -= thispage; offset += thispage; // This is permitted (changing OWQ_offset and not restoring) since owq_page is a scratch var OWQ_offset(owq_page) = offset; } return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_telnet_write.c0000664000175000017500000000361011517343222016602 00000000000000/* $Id: ow_telnet_write.c,v 1.1 2011/01/24 18:36:02 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "telnet.h" /* Telnet handling concepts from Jerry Scharf: You should request the number of bytes you expect. When you scan it, start looking for FF FA codes. If that shows up, see if the F0 is in the read buffer. If so, move the char pointer back to where the FF point was and ask for the rest of the string (expected - FF...F0 bytes.) If the F0 isn't in the read buffer, start reading byte by byte into a separate variable looking for F0. Once you find that, then do the move the pointer and read the rest piece as above. Finally, don't forget to scan the rest of the strings for more FF FA blocks. It's most sloppy when the FF is the last character of the initial read buffer... You can also scan and remove the patterns FF F1 - FF F9 as these are 2 byte commands that the transmitter can send at any time. It is also possible that you could see FF FB xx - FF FE xx 3 byte codes, but this would be in response to FF FA codes that you would send, so that seems unlikely. Handling these would be just the same as the FF FA codes above. */ /* Write to a telnet device */ GOOD_OR_BAD telnet_write_binary( const BYTE * buf, const size_t size, struct connection_in *in) { size_t new_size = 0 ; size_t i = 0 ; // temporary buffer (add some extra space) BYTE new_buf[2*size] ; while ( i < size ) { if ( buf[i] == TELNET_IAC ) { new_buf[ new_size++ ] = TELNET_IAC ; // to double it } new_buf[ new_size++ ] = buf[ i++ ] ; } return COM_write( new_buf, new_size, in ) ; } owfs-2.8p15/module/owlib/src/c/ow_eeef.c0000644000175000017500000003107511742700145015006 00000000000000/* $Id: ow_eeef.c,v 1.20 2012/04/16 02:13:57 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_eeef.h" #include /* ------- Prototypes ----------- */ /* Hobby boards UVI and colleagues */ READ_FUNCTION(FS_temperature); READ_FUNCTION(FS_version); READ_FUNCTION(FS_type_number); READ_FUNCTION(FS_localtype); READ_FUNCTION(FS_r_temperature_offset); WRITE_FUNCTION(FS_w_temperature_offset); READ_FUNCTION(FS_r_UVI_offset); WRITE_FUNCTION(FS_w_UVI_offset); READ_FUNCTION(FS_r_in_case); WRITE_FUNCTION(FS_w_in_case); READ_FUNCTION(FS_UVI); READ_FUNCTION(FS_UVI_valid); READ_FUNCTION(FS_r_sensor); static enum e_visibility VISIBLE_EF_UVI( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EF_MOISTURE( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EF_MOISTURE_LOG( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EF_SNIFFER( const struct parsedname * pn ) ; static enum e_visibility VISIBLE_EF_HUB( const struct parsedname * pn ) ; enum e_EF_type { eft_UVI = 1, eft_MOI = 2, eft_LOG = 3, eft_SNF = 4, eft_HUB = 5, } ; /* ------- Structures ----------- */ static struct aggregate AMOIST = { 4, ag_numbers, ag_aggregate, }; static struct filetype HobbyBoards_EE[] = { F_STANDARD_NO_TYPE, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_volatile, FS_temperature, NO_WRITE_FUNCTION, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"temperature_offset", PROPERTY_LENGTH_TEMPGAP, NON_AGGREGATE, ft_tempgap, fc_stable, FS_r_temperature_offset, FS_w_temperature_offset, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"version", 5, NON_AGGREGATE, ft_ascii, fc_stable, FS_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"type_number", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_type_number, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"type", PROPERTY_LENGTH_TYPE, NON_AGGREGATE, ft_ascii, fc_link, FS_localtype, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"UVI", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"UVI/UVI", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_UVI, NO_WRITE_FUNCTION, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"UVI/valid", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_UVI_valid, NO_WRITE_FUNCTION, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"UVI/UVI_offset", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_stable, FS_r_UVI_offset, FS_w_UVI_offset, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, {"UVI/in_case", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_in_case, FS_w_in_case, VISIBLE_EF_UVI, NO_FILETYPE_DATA, }, }; DeviceEntry(EE, HobbyBoards_EE, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype HobbyBoards_EF[] = { F_STANDARD_NO_TYPE, {"version", 5, NON_AGGREGATE, ft_ascii, fc_stable, FS_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"type_number", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_type_number, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"type", PROPERTY_LENGTH_TYPE, NON_AGGREGATE, ft_ascii, fc_link, FS_localtype, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"moisture", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_EF_MOISTURE, NO_FILETYPE_DATA, }, {"moisture/sensor", PROPERTY_LENGTH_INTEGER, &AMOIST, ft_integer, fc_volatile, FS_r_sensor, NO_WRITE_FUNCTION, VISIBLE_EF_MOISTURE, NO_FILETYPE_DATA, }, }; DeviceEntry(EF, HobbyBoards_EF, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _EEEF_READ_VERSION 0x11 #define _EEEF_READ_TYPE 0x12 #define _EEEF_READ_TEMPERATURE 0x21 #define _EEEF_SET_TEMPERATURE_OFFSET 0x22 #define _EEEF_READ_TEMPERATURE_OFFSET 0x23 #define _EEEF_READ_UVI 0x24 #define _EEEF_SET_UVI_OFFSET 0x25 #define _EEEF_READ_UVI_OFFSET 0x26 #define _EEEF_SET_IN_CASE 0x27 #define _EEEF_READ_IN_CASE 0x28 #define _EEEF_READ_SENSOR 0x21 #define _EEEF_SET_LEAF 0x22 #define _EEEF_GET_LEAF 0x23 static enum e_EF_type VISIBLE_EF( const struct parsedname * pn ) ; /* finds the visibility value (0x0071 ...) either cached, or computed via the device_id (then cached) */ static enum e_EF_type VISIBLE_EF( const struct parsedname * pn ) { int eft = -1 ; LEVEL_DEBUG("Checking visibility of %s",SAFESTRING(pn->path)) ; if ( BAD( GetVisibilityCache( &eft, pn ) ) ) { struct one_wire_query * owq = OWQ_create_from_path(pn->path) ; // for read if ( owq != NULL) { UINT U_eft ; if ( FS_r_sibling_U( &U_eft, "type_number", owq ) == 0 ) { eft = U_eft ; SetVisibilityCache( eft, pn ) ; } OWQ_destroy(owq) ; } } return (enum e_EF_type) eft ; } static enum e_visibility VISIBLE_EF_UVI( const struct parsedname * pn ) { switch ( VISIBLE_EF(pn) ) { case eft_UVI: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EF_MOISTURE( const struct parsedname * pn ) { switch ( VISIBLE_EF(pn) ) { case eft_MOI: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EF_MOISTURE_LOG( const struct parsedname * pn ) { switch ( VISIBLE_EF(pn) ) { case eft_LOG: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EF_SNIFFER( const struct parsedname * pn ) { switch ( VISIBLE_EF(pn) ) { case eft_SNF: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_EF_HUB( const struct parsedname * pn ) { switch ( VISIBLE_EF(pn) ) { case eft_HUB: return visible_now ; default: return visible_not_now ; } } /* ------- Functions ------------ */ /* prototypes */ static GOOD_OR_BAD OW_version(BYTE * major, BYTE * minor, struct parsedname * pn) ; static GOOD_OR_BAD OW_type(BYTE * type_number, struct parsedname * pn) ; static GOOD_OR_BAD OW_UVI(_FLOAT * UVI, struct parsedname * pn) ; static GOOD_OR_BAD OW_r_UVI_offset(_FLOAT * UVI, struct parsedname * pn) ; static GOOD_OR_BAD OW_temperature(_FLOAT * T, struct parsedname * pn) ; static GOOD_OR_BAD OW_r_temperature_offset(_FLOAT * T, struct parsedname * pn) ; static GOOD_OR_BAD OW_read(BYTE command, BYTE * bytes, size_t size, struct parsedname * pn) ; static GOOD_OR_BAD OW_write(BYTE command, BYTE byte, struct parsedname * pn); static GOOD_OR_BAD OW_r_wetness( int *wetness, struct parsedname * pn); // returns major/minor as 2 hex bytes (ascii) static ZERO_OR_ERROR FS_version(struct one_wire_query *owq) { char v[6]; BYTE major, minor ; RETURN_ERROR_IF_BAD(OW_version(&major,&minor,PN(owq))) ; UCLIBCLOCK; snprintf(v,6,"%.2X.%.2X",major,minor); UCLIBCUNLOCK; return OWQ_format_output_offset_and_size(v, 5, owq); } static ZERO_OR_ERROR FS_type_number(struct one_wire_query *owq) { BYTE type_number ; RETURN_ERROR_IF_BAD(OW_type(&type_number,PN(owq))) ; OWQ_U(owq) = type_number ; return 0; } static ZERO_OR_ERROR FS_temperature(struct one_wire_query *owq) { _FLOAT T ; RETURN_ERROR_IF_BAD(OW_temperature(&T,PN(owq))) ; OWQ_F(owq) = T ; return 0; } static ZERO_OR_ERROR FS_UVI(struct one_wire_query *owq) { _FLOAT UVI ; RETURN_ERROR_IF_BAD( OW_UVI(&UVI,PN(owq))) ; OWQ_F(owq) = UVI ; return 0; } static ZERO_OR_ERROR FS_r_UVI_offset(struct one_wire_query *owq) { _FLOAT UVI ; RETURN_ERROR_IF_BAD(OW_r_UVI_offset(&UVI,PN(owq))) ; OWQ_F(owq) = UVI ; return 0; } static ZERO_OR_ERROR FS_r_temperature_offset(struct one_wire_query *owq) { _FLOAT T ; RETURN_BAD_IF_BAD(OW_r_temperature_offset(&T,PN(owq))) ; OWQ_F(owq) = T ; return 0; } static ZERO_OR_ERROR FS_w_temperature_offset(struct one_wire_query *owq) { signed char c ; #ifdef HAVE_LRINT c = lrint(2.0*OWQ_F(owq)); // round off #else c = 2.0*OWQ_F(owq); #endif RETURN_ERROR_IF_BAD(OW_write(_EEEF_SET_TEMPERATURE_OFFSET,(BYTE)c,PN(owq))) ; return 0; } static ZERO_OR_ERROR FS_w_UVI_offset(struct one_wire_query *owq) { unsigned char c ; #ifdef HAVE_LRINT c = lrint(10.0*OWQ_F(owq)); // round off #else c = 10.0*OWQ_F(owq)+.49; #endif return GB_to_Z_OR_E(OW_write(_EEEF_SET_UVI_OFFSET,(BYTE)c,PN(owq))) ; } static ZERO_OR_ERROR FS_localtype(struct one_wire_query *owq) { UINT type_number ; if ( FS_r_sibling_U( &type_number, "type_number", owq ) != 0 ) { return -EINVAL ; } switch ((enum e_EF_type) type_number) { case eft_UVI: return OWQ_format_output_offset_and_size_z("HB_UVI_METER", owq) ; case eft_MOI: return OWQ_format_output_offset_and_size_z("HB_MOISTURE_METER", owq) ; case eft_LOG: return OWQ_format_output_offset_and_size_z("HB_MOISTURE_METER_DATALOGGER", owq) ; case eft_SNF: return OWQ_format_output_offset_and_size_z("HB_SNIFFER", owq) ; case eft_HUB: return OWQ_format_output_offset_and_size_z("HB_HUB", owq) ; default: return FS_type(owq); } } static ZERO_OR_ERROR FS_UVI_valid(struct one_wire_query *owq) { UINT type_number = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &type_number, "type_number", owq ) ; switch (type_number) { case 0x01: OWQ_Y(owq) = 1 ; break ; default: OWQ_Y(owq) = 0 ; break ; } return z_or_e ; } static ZERO_OR_ERROR FS_r_in_case(struct one_wire_query *owq) { BYTE in_case ; RETURN_ERROR_IF_BAD( OW_read(_EEEF_READ_IN_CASE,&in_case,1,PN(owq))) ; switch(in_case) { case 0x00: OWQ_Y(owq) = 0 ; break ; case 0xFF: OWQ_Y(owq) = 1 ; break ; default: return -EINVAL ; } return 0 ; } static ZERO_OR_ERROR FS_w_in_case(struct one_wire_query *owq) { BYTE in_case = OWQ_Y(owq) ? 0xFF : 0x00 ; return GB_to_Z_OR_E( OW_write(_EEEF_SET_IN_CASE,in_case,PN(owq))) ; } static ZERO_OR_ERROR FS_r_sensor(struct one_wire_query *owq) { int w[4] ; RETURN_ERROR_IF_BAD( OW_r_wetness( w, PN(owq) ) ) ; OWQ_array_I(owq, 0) = w[0] ; OWQ_array_I(owq, 1) = w[1] ; OWQ_array_I(owq, 2) = w[2] ; OWQ_array_I(owq, 3) = w[3] ; return 0 ; } static GOOD_OR_BAD OW_version(BYTE * major, BYTE * minor, struct parsedname * pn) { BYTE response[2] ; RETURN_BAD_IF_BAD(OW_read(_EEEF_READ_VERSION, response, 2, pn)) ; *minor = response[0] ; *major = response[1] ; return gbGOOD ; } static GOOD_OR_BAD OW_type(BYTE * type_number, struct parsedname * pn) { RETURN_BAD_IF_BAD(OW_read(_EEEF_READ_TYPE, type_number, 1, pn)) ; return gbGOOD ; } static GOOD_OR_BAD OW_UVI(_FLOAT * UVI, struct parsedname * pn) { BYTE u[1] ; RETURN_BAD_IF_BAD( OW_read(_EEEF_READ_UVI, u, 1, pn) ) ; if (u[0]==0xFF) { return gbBAD; } UVI[0] = 0.1 * ((_FLOAT) u[0]) ; return gbGOOD ; } static GOOD_OR_BAD OW_r_UVI_offset(_FLOAT * UVI, struct parsedname * pn) { BYTE u[1] ; RETURN_BAD_IF_BAD( OW_read(_EEEF_READ_UVI_OFFSET, u, 1, pn) ); if (u[0]==0xFF) { return gbBAD; } UVI[0] = 0.1 * ((_FLOAT) ((signed char) u[0])) ; return gbGOOD ; } static GOOD_OR_BAD OW_r_temperature_offset(_FLOAT * T, struct parsedname * pn) { BYTE t[1] ; RETURN_BAD_IF_BAD(OW_read(_EEEF_READ_TEMPERATURE_OFFSET, t, 1, pn)) ; T[0] = 0.5 * ((_FLOAT) ((signed char)t[0])) ; return gbGOOD ; } static GOOD_OR_BAD OW_temperature(_FLOAT * temperature, struct parsedname * pn) { BYTE t[2] ; RETURN_BAD_IF_BAD(OW_read(_EEEF_READ_TEMPERATURE, t, 2, pn)) ; temperature[0] = (_FLOAT) 0.5 * UT_int16(t) ; return gbGOOD ; } static GOOD_OR_BAD OW_read(BYTE command, BYTE * bytes, size_t size, struct parsedname * pn) { BYTE c[] = { command,} ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(c), TRXN_READ(bytes,size), TRXN_END, }; return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_write(BYTE command, BYTE byte, struct parsedname * pn) { BYTE c[] = { command, byte, } ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(c), TRXN_END, }; return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_r_wetness( int *wetness, struct parsedname * pn) { BYTE w[4] ; RETURN_BAD_IF_BAD(OW_read(_EEEF_READ_SENSOR, w, 4, pn)) ; wetness[0] = (uint8_t) w[0] ; wetness[1] = (uint8_t) w[1] ; wetness[2] = (uint8_t) w[2] ; wetness[3] = (uint8_t) w[3] ; return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_interface.c0000644000175000017500000005275511740076517016061 00000000000000/* $Id: ow_interface.c,v 1.50 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* interface is data and control of bus master */ #include #include "owfs_config.h" #include "ow.h" #include "ow_interface.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ /* Statistics reporting */ READ_FUNCTION(FS_name); READ_FUNCTION(FS_port); READ_FUNCTION(FS_version); READ_FUNCTION(FS_r_overdrive); READ_FUNCTION(FS_r_channel); WRITE_FUNCTION(FS_w_overdrive); READ_FUNCTION(FS_r_yesno); WRITE_FUNCTION(FS_w_yesno); READ_FUNCTION(FS_r_reconnect); WRITE_FUNCTION(FS_w_reconnect); READ_FUNCTION(FS_r_pulldownslewrate); WRITE_FUNCTION(FS_w_pulldownslewrate); READ_FUNCTION(FS_r_writeonelowtime); WRITE_FUNCTION(FS_w_writeonelowtime); READ_FUNCTION(FS_r_datasampleoffset); WRITE_FUNCTION(FS_w_datasampleoffset); READ_FUNCTION(FS_r_APU); WRITE_FUNCTION(FS_w_APU); READ_FUNCTION(FS_r_PPM); WRITE_FUNCTION(FS_w_PPM); READ_FUNCTION(FS_r_baud); WRITE_FUNCTION(FS_w_baud); READ_FUNCTION(FS_r_templimit); WRITE_FUNCTION(FS_w_templimit); //#define DEBUG_DS2490 #ifdef DEBUG_DS2490 READ_FUNCTION(FS_r_ds2490status); #endif /* Statistics reporting */ READ_FUNCTION(FS_stat_p); READ_FUNCTION(FS_bustime); READ_FUNCTION(FS_elapsed); #if OW_USB int DS9490_getstatus(BYTE * buffer, int readlen, const struct parsedname *pn); #endif static enum e_visibility VISIBLE_DS2482( const struct parsedname * pn ) { switch ( pn->selected_connection->busmode ) { case bus_i2c: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_DS9490( const struct parsedname * pn ) { switch ( pn->selected_connection->busmode ) { case bus_usb: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_DS2480B( const struct parsedname * pn ) { switch ( pn->selected_connection->busmode ) { case bus_serial: case bus_xport: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_HA5( const struct parsedname * pn ) { switch ( pn->selected_connection->busmode ) { case bus_ha5: return visible_now ; default: return visible_not_now ; } } static enum e_visibility VISIBLE_PSEUDO( const struct parsedname * pn ) { switch ( pn->selected_connection->busmode ) { case bus_fake: case bus_tester: case bus_mock: return visible_now ; default: return visible_not_now ; } } /* -------- Structures ---------- */ /* Rare PUBLIC aggregate structure to allow changing the number of adapters */ static struct filetype interface_settings[] = { {"name", 128, NON_AGGREGATE, ft_vascii, fc_static, FS_name, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"address", 512, NON_AGGREGATE, ft_vascii, fc_static, FS_port, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"overdrive", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE, {s:offsetof(struct connection_in,overdrive),}, }, {"version", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_version, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"ds2404_found", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE, {s:offsetof(struct connection_in,ds2404_found),}, }, {"reconnect", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_reconnect, FS_w_reconnect, VISIBLE, NO_FILETYPE_DATA, }, {"usb", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_DS9490, NO_FILETYPE_DATA, }, #ifdef DEBUG_DS2490 {"usb/ds2490status", 128, NON_AGGREGATE, ft_vascii, fc_static, FS_r_ds2490status, NO_WRITE_FUNCTION, VISIBLE_DS9490, NO_FILETYPE_DATA, }, #endif {"usb/pulldownslewrate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_pulldownslewrate, FS_w_pulldownslewrate, VISIBLE_DS9490, NO_FILETYPE_DATA, }, {"usb/writeonelowtime", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_writeonelowtime, FS_w_writeonelowtime, VISIBLE_DS9490, NO_FILETYPE_DATA, }, {"usb/datasampleoffset", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_datasampleoffset, FS_w_datasampleoffset, VISIBLE_DS9490, NO_FILETYPE_DATA, }, {"usb/flexible_timing", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE_DS9490, {s:offsetof(struct connection_in,flex),}, }, {"serial", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_DS2480B, NO_FILETYPE_DATA, }, {"serial/reverse_polarity", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE_DS2480B, {s:offsetof(struct connection_in,master.serial.reverse_polarity),}, }, {"serial/baudrate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_static, FS_r_baud, FS_w_baud, VISIBLE_DS2480B, NO_FILETYPE_DATA, }, {"serial/flexible_timing", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE_DS2480B, {s:offsetof(struct connection_in,flex),}, }, {"ha5", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_HA5, NO_FILETYPE_DATA, }, {"ha5/checksum", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_yesno, FS_w_yesno, VISIBLE_HA5, {s:offsetof(struct connection_in,master.ha5.checksum), }, }, {"ha5/channel", 1, NON_AGGREGATE, ft_ascii, fc_static, FS_r_channel, NO_WRITE_FUNCTION, VISIBLE_HA5, NO_FILETYPE_DATA, }, {"i2c", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_DS2482, NO_FILETYPE_DATA, }, {"i2c/ActivePullUp", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_APU, FS_w_APU, VISIBLE_DS2482, NO_FILETYPE_DATA, }, {"i2c/PulsePresenceMask", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_static, FS_r_PPM, FS_w_PPM, VISIBLE_DS2482, NO_FILETYPE_DATA, }, {"simulated", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_PSEUDO, NO_FILETYPE_DATA, }, {"simulated/templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE_PSEUDO, {i:1}, }, {"simulated/temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE_PSEUDO, {i:0}, }, }; struct device d_interface_settings = { "settings", "settings", ePN_interface, COUNT_OF_FILETYPES(interface_settings), interface_settings, NO_GENERIC_READ, NO_GENERIC_WRITE }; static struct filetype interface_statistics[] = { {"elapsed_time", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_elapsed, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"bus_time", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_statistic, FS_bustime, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"reconnects", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_reconnects}, }, {"reconnect_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_reconnect_errors}, }, {"locks", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_locks}, }, {"unlocks", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_unlocks}, }, {"errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_errors}, }, {"resets", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_resets}, }, {"program_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_program_errors}, }, {"pullup_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_pullup_errors}, }, {"reset_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_reset_errors}, }, {"shorts", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_short_errors}, }, {"read_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_read_errors}, }, {"write_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_write_errors}, }, {"open_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_open_errors}, }, {"close_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_close_errors}, }, {"detect_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_detect_errors}, }, {"select_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_select_errors}, }, {"status_errors", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_status_errors}, }, {"timeouts", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_timeouts}, }, {"search_errors", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"search_errors/error_pass_1", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_search_errors1}, }, {"search_errors/error_pass_2", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_search_errors2}, }, {"search_errors/error_pass_3", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_search_errors3}, }, {"overdrive", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"overdrive/attempts", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_try_overdrive}, }, {"overdrive/failures", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_statistic, FS_stat_p, NO_WRITE_FUNCTION, VISIBLE, {i:e_bus_failed_overdrive}, }, }; struct device d_interface_statistics = { "statistics", "statistics", 0, COUNT_OF_FILETYPES(interface_statistics), interface_statistics, NO_GENERIC_READ, NO_GENERIC_WRITE }; /* ------- Functions ------------ */ /* Just some tests to support reconnection */ static ZERO_OR_ERROR FS_r_reconnect(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); OWQ_Y(owq) = (pn->selected_connection->reconnect_state == reconnect_error); return 0; } /* Just some tests to support reconnection */ static ZERO_OR_ERROR FS_w_reconnect(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); pn->selected_connection->reconnect_state = OWQ_Y(owq) ? reconnect_error : reconnect_ok ; return 0; } /* DS2482 APU setting */ #define DS2482_REG_CFG_APU 0x01 static ZERO_OR_ERROR FS_r_APU(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); switch ( pn->selected_connection->busmode ) { case bus_i2c: OWQ_Y(owq) = ( (pn->selected_connection->master.i2c.configreg & DS2482_REG_CFG_APU) != 0x00 ) ; return 0; default: return -ENOTSUP ; } } static ZERO_OR_ERROR FS_w_APU(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); switch ( pn->selected_connection->busmode ) { case bus_i2c: if ( OWQ_Y(owq) ) { pn->selected_connection->master.i2c.configreg |= DS2482_REG_CFG_APU ; } else { pn->selected_connection->master.i2c.configreg &= ~DS2482_REG_CFG_APU ; } break ; default: break ; } return 0 ; } static ZERO_OR_ERROR FS_r_yesno( struct one_wire_query * owq ) { struct parsedname * pn = PN(owq) ; struct connection_in * in = pn->selected_connection ; struct filetype * ft = pn->selected_filetype ; size_t struct_offset = ft->data.s ; char * in_loc = (void *) in ; int * p_yes_no = (int *)(in_loc + struct_offset) ; switch( (ft->visible)(pn) ) { case visible_not_now: case visible_never: return -ENOTSUP ; default: break ; } OWQ_Y(owq) = p_yes_no[0] ; return 0 ; } static ZERO_OR_ERROR FS_w_yesno( struct one_wire_query * owq ) { struct parsedname * pn = PN(owq) ; struct connection_in * in = pn->selected_connection ; struct filetype * ft = pn->selected_filetype ; size_t struct_offset = ft->data.s ; char * in_loc = (void *) in ; int * p_yes_no = (int *)(in_loc + struct_offset) ; switch( (ft->visible)(pn) ) { case visible_not_now: case visible_never: return -ENOTSUP ; default: break ; } p_yes_no[0] = OWQ_Y(owq) ; in->changed_bus_settings |= CHANGED_USB_SPEED ; return 0 ; } /* fake adapter temperature limits */ static ZERO_OR_ERROR FS_r_templimit(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); switch ( pn->selected_connection->busmode ) { case bus_fake: case bus_mock: case bus_tester: OWQ_F(owq) = pn->selected_filetype->data.i ? pn->selected_connection->master.fake.templow : pn->selected_connection->master.fake.temphigh; return 0; default: return -ENOTSUP ; } } static ZERO_OR_ERROR FS_w_templimit(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); switch ( pn->selected_connection->busmode ) { case bus_fake: case bus_mock: case bus_tester: if (pn->selected_filetype->data.i) { pn->selected_connection->master.fake.templow = OWQ_F(owq); } else { pn->selected_connection->master.fake.temphigh = OWQ_F(owq); } return 0; default: break ; } return 0 ; } /* Serial baud rate */ static ZERO_OR_ERROR FS_r_baud(struct one_wire_query *owq) { struct connection_in * in = PN(owq)->selected_connection ; switch ( in->busmode ) { case bus_serial: case bus_link: case bus_ha5: case bus_ha7e: OWQ_U(owq) = COM_BaudRate( SOC(in)->baud ) ; return 0; default: return -ENOTSUP ; } } static ZERO_OR_ERROR FS_w_baud(struct one_wire_query *owq) { struct connection_in * in = PN(owq)->selected_connection ; switch ( in->busmode ) { case bus_serial: case bus_link: SOC(in)->baud = COM_MakeBaud( (speed_t) OWQ_U(owq) ) ; ++in->changed_bus_settings ; break ; default: break ; } return 0 ; } /* DS2482 PPM setting */ #define DS2482_REG_CFG_PPM 0x02 static ZERO_OR_ERROR FS_r_PPM(struct one_wire_query *owq) { struct connection_in * in = PN(owq)->selected_connection ; switch ( in->busmode ) { case bus_i2c: OWQ_Y(owq) = ( (in->master.i2c.configreg & DS2482_REG_CFG_PPM) != 0x00 ) ; return 0; default: return -ENOTSUP ; } } static ZERO_OR_ERROR FS_w_PPM(struct one_wire_query *owq) { struct connection_in * in = PN(owq)->selected_connection ; switch ( in->busmode ) { case bus_i2c: if ( OWQ_Y(owq) ) { in->master.i2c.configreg |= DS2482_REG_CFG_PPM ; } else { in->master.i2c.configreg &= ~DS2482_REG_CFG_PPM ; } break ; default: break ; } return 0 ; } /* For HA5 channel -- a single letter */ static ZERO_OR_ERROR FS_r_channel(struct one_wire_query *owq) { return OWQ_format_output_offset_and_size( (char *) &(PN(owq)->selected_connection->master.ha5.channel), 1, owq); } /* Just some tests to support overdrive */ static ZERO_OR_ERROR FS_r_overdrive(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); OWQ_Y(owq) = pn->selected_connection->overdrive ; return 0; } static ZERO_OR_ERROR FS_w_overdrive(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); pn->selected_connection->overdrive = OWQ_Y(owq) ; pn->selected_connection->changed_bus_settings |= CHANGED_USB_SPEED ; return 0; } #ifdef DEBUG_DS2490 static ZERO_OR_ERROR FS_r_ds2490status(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); char res[256]; char buffer[ DS9490_getstatus_BUFFER_LENGTH ]; int ret; res[0] = '\0'; if (pn->selected_connection->busmode == bus_usb) { #if OW_USB ret = DS9490_getstatus(buffer, 0, PN(owq)); if (ret < 0) { sprintf(res, "DS9490_getstatus failed: %d\n", ret); } else { sprintf(res, "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], buffer[8], buffer[9], buffer[10], buffer[11], buffer[12], buffer[13], buffer[14], buffer[15]); } /* uchar EnableFlags; uchar OneWireSpeed; uchar StrongPullUpDuration; uchar ProgPulseDuration; uchar PullDownSlewRate; uchar Write1LowTime; uchar DSOW0RecoveryTime; uchar Reserved1; uchar StatusFlags; uchar CurrentCommCmd1; uchar CurrentCommCmd2; uchar CommBufferStatus; // Buffer for COMM commands uchar WriteBufferStatus; // Buffer we write to uchar ReadBufferStatus; // Buffer we read from */ #endif } return OWQ_format_output_offset_and_size_z(res, owq); } #endif /* * Value is between 0 and 7. * Default value is 3. * * PARMSET_Slew15Vus 0x0 * PARMSET_Slew2p20Vus 0x1 * PARMSET_Slew1p65Vus 0x2 * PARMSET_Slew1p37Vus 0x3 (default with altUSB) * PARMSET_Slew1p10Vus 0x4 * PARMSET_Slew0p83Vus 0x5 (default without altUSB) * PARMSET_Slew0p70Vus 0x6 * PARMSET_Slew0p55Vus 0x7 */ static ZERO_OR_ERROR FS_r_pulldownslewrate(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb) { return -ENOTSUP; #if OW_USB } else { OWQ_U(owq) = pn->selected_connection->master.usb.pulldownslewrate; #endif /* OW_USB */ } return 0; } static ZERO_OR_ERROR FS_w_pulldownslewrate(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb) { return -ENOTSUP; } #if OW_USB if (OWQ_U(owq) > 7) { return -ENOTSUP; } pn->selected_connection->master.usb.pulldownslewrate = OWQ_U(owq); pn->selected_connection->changed_bus_settings |= CHANGED_USB_SLEW ; // force a reset LEVEL_DEBUG("Set slewrate to %d", pn->selected_connection->master.usb.pulldownslewrate); #endif /* OW_USB */ return 0; } /* * Value is between 8 and 15, which represents 8us and 15us. * Default value is 10us. (with altUSB) * Default value is 12us. (without altUSB) */ static ZERO_OR_ERROR FS_r_writeonelowtime(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb) { OWQ_U(owq) = 10; #if OW_USB } else { OWQ_U(owq) = pn->selected_connection->master.usb.writeonelowtime + 8; #endif /* OW_USB */ } return 0; } static ZERO_OR_ERROR FS_w_writeonelowtime(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb) { return -ENOTSUP; } #if OW_USB if ((OWQ_U(owq) < 8) || (OWQ_U(owq) > 15)) { return -ENOTSUP; } pn->selected_connection->master.usb.writeonelowtime = OWQ_U(owq) - 8; pn->selected_connection->changed_bus_settings |= CHANGED_USB_LOW ; // force a reset #endif /* OW_USB */ return 0; } /* * Value is between 3 and 10, which represents 3us and 10us. * Default value is 8us. (with altUSB) * Default value is 7us. (without altUSB) */ static ZERO_OR_ERROR FS_r_datasampleoffset(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb) { OWQ_U(owq) = 8; #if OW_USB } else { OWQ_U(owq) = pn->selected_connection->master.usb.datasampleoffset + 3; #endif /* OW_USB */ } return 0; } static ZERO_OR_ERROR FS_w_datasampleoffset(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (pn->selected_connection->busmode != bus_usb){ return -ENOTSUP; } #if OW_USB if ((OWQ_U(owq) < 3) || (OWQ_U(owq) > 10)) { return -ENOTSUP; } pn->selected_connection->master.usb.datasampleoffset = OWQ_U(owq) - 3; pn->selected_connection->changed_bus_settings |= CHANGED_USB_OFFSET; // force a reset #endif /* OW_USB */ return 0; } /* special check, -remote file length won't match local sizes */ static ZERO_OR_ERROR FS_name(struct one_wire_query *owq) { char *name = ""; struct parsedname *pn = PN(owq); //printf("NAME %d=%s\n",pn->selected_connection->index,pn->selected_connection->adapter_name); if (pn->selected_connection->adapter_name) { name = pn->selected_connection->adapter_name; } return OWQ_format_output_offset_and_size_z(name, owq); } /* special check, -remote file length won't match local sizes */ static ZERO_OR_ERROR FS_port(struct one_wire_query *owq) { return OWQ_format_output_offset_and_size_z( SAFESTRING( SOC(PN(owq)->selected_connection)->devicename), owq); } /* special check, -remote file length won't match local sizes */ static ZERO_OR_ERROR FS_version(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); OWQ_U(owq) = pn->selected_connection->Adapter; return 0; } static ZERO_OR_ERROR FS_stat_p(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); OWQ_U(owq) = pn->selected_connection->bus_stat[pn->selected_filetype->data.i]; return 0; } static ZERO_OR_ERROR FS_bustime(struct one_wire_query *owq) { OWQ_F(owq) = TVfloat( &(PN(owq)->selected_connection->bus_time) ) ; return 0; } static ZERO_OR_ERROR FS_elapsed(struct one_wire_query *owq) { OWQ_U(owq) = NOW_TIME - StateInfo.start_time; return 0; } owfs-2.8p15/module/owlib/src/c/ow_com_free.c0000644000175000017500000000207611707143413015660 00000000000000/* $Id: ow_com_free.c,v 1.2 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif void COM_free(struct connection_in *connection) { if (connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to close a NULL device"); return ; } if ( connection != connection->channel_info.head ) { // Not the head of the multi-bus device return ; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: case ct_usb: break ; case ct_telnet: case ct_tcp: tcp_free( connection ) ; break ; case ct_i2c: case ct_netlink: break ; case ct_serial: serial_free( connection ) ; break ; } SAFEFREE(SOC(connection)->devicename) ; SOC(connection)->state = cs_virgin ; } owfs-2.8p15/module/owlib/src/c/ow_2505.c0000644000175000017500000001556011740076517014505 00000000000000/* $Id: ow_2505.c,v 1.62 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2505.h" /* ------- Prototypes ----------- */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_status); WRITE_FUNCTION(FS_w_status); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); #define _1W_READ_MEMORY 0xF0 #define _1W_READ_STATUS 0xAA #define _1W_EXTENDED_READ_MEMORY 0xA5 #define _1W_WRITE_MEMORY 0x0F #define _1W_SPEED_WRITE_MEMORY 0xF3 #define _1W_WRITE_STATUS 0x55 #define _1W_SPEED_WRITE_STATUS 0xF5 /* ------- Structures ----------- */ static struct aggregate A2505 = { 64, ag_numbers, ag_separate, }; static struct aggregate A2505s = { 11, ag_numbers, ag_separate, }; static struct filetype DS2505[] = { F_STANDARD, {"memory", 2048, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2505, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"status", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"status/page", 8, &A2505s, ft_binary, fc_stable, FS_r_status, FS_w_status, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(0B, DS2505, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1985U[] = { F_STANDARD, {"memory", 2048, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2505, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"status", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"status/page", 8, &A2505s, ft_binary, fc_stable, FS_r_status, FS_w_status, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(8B, DS1985U, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A2506 = { 256, ag_numbers, ag_separate, }; static struct aggregate A2506s = { 11, ag_numbers, ag_separate, }; static struct filetype DS2506[] = { F_STANDARD, {"memory", 8192, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2506, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"status", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"status/page", 32, &A2506s, ft_binary, fc_stable, FS_r_status, FS_w_status, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(0F, DS2506, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1986U[] = { F_STANDARD, {"memory", 8192, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2506, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"status", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"status/page", 32, &A2506s, ft_binary, fc_stable, FS_r_status, FS_w_status, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(8F, DS1986U, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); /* ------- Functions ------------ */ /* DS2505 */ static GOOD_OR_BAD OW_w_status(BYTE * data, size_t size, off_t offset, struct parsedname *pn); /* 2505 memory */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, pagesize, COMMON_read_memory_F0)) ; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_status(struct one_wire_query *owq) { size_t pagesize = FileLength(PN(owq)) ; return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, OWQ_pn(owq).extension, pagesize, COMMON_read_memory_crc16_AA)) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { return COMMON_write_eprom_mem_owq(owq) ; } static ZERO_OR_ERROR FS_w_status(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_status(OWQ_explode(owq))) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension * pagesize) ; } static GOOD_OR_BAD OW_w_status(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[6] = { _1W_WRITE_STATUS, LOW_HIGH_ADDRESS(offset), data[0] }; GOOD_OR_BAD ret = gbGOOD; struct transaction_log tfirst[] = { TRXN_START, TRXN_WR_CRC16(p, 4, 0), TRXN_PROGRAM, TRXN_READ1(p), TRXN_END, }; if (size == 0) { return gbGOOD; } if (size == 1) { return BUS_transaction(tfirst, pn) || (p[0] & (~data[0])); } BUSLOCK(pn); if ( BAD(BUS_transaction(tfirst, pn)) || (p[0] & ~data[0])) { ret = gbBAD; } else { size_t i; const BYTE *d = &data[1]; UINT s = offset + 1; struct transaction_log trest[] = { //TRXN_WR_CRC16_SEEDED( p, &s, 1, 0 ) , TRXN_WR_CRC16_SEEDED(p, p, 1, 0), TRXN_PROGRAM, TRXN_READ1(p), TRXN_END, }; for (i = 0; i < size; ++i, ++d, ++s) { if ( BAD(BUS_transaction(trest, pn)) || (p[0] & ~d[0])) { ret = gbBAD; break; } } } BUSUNLOCK(pn); return ret; } owfs-2.8p15/module/owlib/src/c/ow_dl.c0000664000175000017500000000202711427405365014504 00000000000000/* $Id: ow_dl.c,v 1.7 2010/08/08 01:40:05 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_dl.h" #if OW_ZERO DLHANDLE DL_open(const char *pathname) { #if OW_CYGWIN return LoadLibrary(pathname); #elif defined(HAVE_DLOPEN) return dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL ); #endif } void *DL_sym(DLHANDLE handle, const char *name) { #if OW_CYGWIN return (void *) GetProcAddress(handle, name); #elif defined(HAVE_DLOPEN) return dlsym(handle, name); #endif } int DL_close(DLHANDLE handle) { #if OW_CYGWIN if (FreeLibrary(handle)) { return 0; } return -1; #elif defined(HAVE_DLOPEN) return dlclose(handle); #endif } char *DL_error(void) { #if OW_CYGWIN return "Error in WIN32 DL"; #elif defined(HAVE_DLOPEN) return dlerror(); #endif } #endif owfs-2.8p15/module/owlib/src/c/getaddrinfo.c0000664000175000017500000007156311371330656015677 00000000000000/* $USAGI: getaddrinfo.c,v 1.16 2001/10/04 09:52:03 sekiya Exp $ */ /* The Inner Net License, Version 2.00 The author(s) grant permission for redistribution and use in source and binary forms, with or without modification, of the software and documentation provided that the following conditions are met: 0. If you receive a version of the software that is specifically labelled as not being for redistribution (check the version message and/or README), you are not permitted to redistribute that version of the software in any way or form. 1. All terms of the all other applicable copyrights and licenses must be followed. 2. Redistributions of source code must retain the authors' copyright notice(s), this list of conditions, and the following disclaimer. 3. Redistributions in binary form must reproduce the authors' copyright notice(s), this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 4. All advertising materials mentioning features or use of this software must display the following acknowledgement with the name(s) of the authors as specified in the copyright notice(s) substituted where indicated: This product includes software developed by , The Inner Net, and other contributors. 5. Neither the name(s) of the author(s) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If these license terms cause you a real problem, contact the author. */ /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ #include #include "owfs_config.h" #ifdef HAVE_PTHREAD #include #endif #ifndef HAVE_GETADDRINFO #define _GNU_SOURCE #define __FORCE_GLIBC #ifdef HAVE_FEATURES_H #include #endif #include #include #include #include "compat_netdb.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_RESOLV_H #include #endif #include "ow_debug.h" #include "ow_alloc.h" /* The following declarations and definitions have been removed from * the public header since we don't want people to use them. */ #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */ #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type. */ #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) #define GAIH_OKIFUNSPEC 0x0100 #define GAIH_EAI ~(GAIH_OKIFUNSPEC) struct gaih_service { const char *name; int num; }; struct gaih_servtuple { struct gaih_servtuple *next; int socktype; int protocol; int port; }; static const struct gaih_servtuple nullserv; struct gaih_addrtuple { struct gaih_addrtuple *next; int family; char addr[16]; uint32_t scopeid; }; struct gaih_typeproto { int socktype; int protocol; char name[4]; int protoflag; }; /* Values for `protoflag'. */ #define GAI_PROTO_NOSERVICE 1 #define GAI_PROTO_PROTOANY 2 static const struct gaih_typeproto gaih_inet_typeproto[] = { {0, 0, "", 0}, {SOCK_STREAM, IPPROTO_TCP, "tcp", 0}, {SOCK_DGRAM, IPPROTO_UDP, "udp", 0}, {SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY | GAI_PROTO_NOSERVICE}, {0, 0, "", 0} }; struct gaih { int family; int (*gaih) (const char *name, const struct gaih_service * service, const struct addrinfo * req, struct addrinfo ** pai); }; #if PF_UNSPEC == 0 static const struct addrinfo default_hints; #else static const struct addrinfo default_hints = { 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL }; #endif static int addrconfig(sa_family_t af) { int s; int ret; int saved_errno = errno; s = socket(af, SOCK_DGRAM, 0); if (s < 0) ret = (errno == EMFILE) ? 1 : 0; else { close(s); ret = 1; } __set_errno(saved_errno); return ret; } #if 0 #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 #endif /* Using Unix sockets this way is a security risk. */ static int gaih_local(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { struct utsname utsname; if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST)) return GAIH_OKIFUNSPEC | -EAI_NONAME; if ((name != NULL) || (req->ai_flags & AI_CANONNAME)) if (uname(&utsname) < 0) return -EAI_SYSTEM; if (name != NULL) { if (strcmp(name, "localhost") && strcmp(name, "local") && strcmp(name, "unix") && strcmp(name, utsname.nodename)) return GAIH_OKIFUNSPEC | -EAI_NONAME; } if (req->ai_protocol || req->ai_socktype) { const struct gaih_typeproto *tp = gaih_inet_typeproto + 1; while (tp->name[0] && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0 || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } *pai = owmalloc(sizeof(struct addrinfo) + sizeof(struct sockaddr_un) + ((req->ai_flags & AI_CANONNAME) ? (strlen(utsname.nodename) + 1) : 0)); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_next = NULL; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = AF_LOCAL; (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM; (*pai)->ai_protocol = req->ai_protocol; (*pai)->ai_addrlen = sizeof(struct sockaddr_un); (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len = sizeof(struct sockaddr_un); #endif /* HAVE_SA_LEN */ ((struct sockaddr_un *) (*pai)->ai_addr)->sun_family = AF_LOCAL; memset(((struct sockaddr_un *) (*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); if (service) { struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; if (strchr(service->name, '/') != NULL) { if (strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; strcpy(sunp->sun_path, service->name); } else { if (strlen(P_tmpdir "/") + 1 + strlen(service->name) >= sizeof(sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; __stpcpy(__stpcpy(sunp->sun_path, P_tmpdir "/"), service->name); } } else { /* This is a dangerous use of the interface since there is a time window between the test for the file and the actual creation (done by the caller) in which a file with the same name could be created. */ char *buf = ((struct sockaddr_un *) (*pai)->ai_addr)->sun_path; if (__builtin_expect(__path_search(buf, L_tmpnam, NULL, NULL, 0), 0) != 0 || __builtin_expect(__gen_tempname(buf, __GT_NOCREATE), 0) != 0) return -EAI_SYSTEM; } if (req->ai_flags & AI_CANONNAME) (*pai)->ai_canonname = strcpy((char *) *pai + sizeof(struct addrinfo) + sizeof(struct sockaddr_un), utsname.nodename); else (*pai)->ai_canonname = NULL; return 0; } #endif /* 0 */ #ifndef HAVE_GETHOSTBYNAME_R struct hostent *gethostbyname_r(const char *name, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD _MUTEX_LOCK(gethostbyname_lock); #endif res = gethostbyname(name); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD _MUTEX_UNLOCK(gethostbyname_lock); #endif return res; } #endif #ifndef HAVE_GETSERVBYNAME_R struct servent *getservbyname_r(const char *name, const char *proto, struct servent *result, char *buf, size_t buflen) { #ifdef HAVE_PTHREAD static pthread_mutex_t getservbyname_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct servent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD _MUTEX_LOCK(getservbyname_lock); #endif res = getservbyname(name, proto); if (res) memcpy(result, res, sizeof(struct servent)); #ifdef HAVE_PTHREAD _MUTEX_UNLOCK(getservbyname_lock); #endif return res; } #endif static int gaih_inet_serv(const char *servicename, const struct gaih_typeproto *tp, const struct addrinfo *req, struct gaih_servtuple *st) { struct servent *s; size_t tmpbuflen = 1024; struct servent ts; char *tmpbuf; int r; do { tmpbuf = alloca(tmpbuflen); #if 0 r = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen, &s); if (!s) r = errno; if (r != 0 || s == NULL) { if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } #else s = getservbyname_r(servicename, tp->name, &ts, tmpbuf, tmpbuflen); if (s == NULL) { r = errno; if (r == ERANGE) tmpbuflen *= 2; else return GAIH_OKIFUNSPEC | -EAI_SERVICE; } else { r = 0; } #endif } while (r); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = s->s_port; return 0; } #define gethosts(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = 0; \ h = gethostbyname_r (name, &th, tmpbuf, \ tmpbuflen, &herrno); \ if(!h) rc = errno; \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #ifndef HAVE_GETHOSTBYNAME2_R struct hostenv *gethostbyname2_r(const char *name, int af, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) { /* Don't support this if it doesn't exists... (eg. IPV6 will fail on cygwin for example) */ (void) name; (void) af; (void) ret; (void) buf; (void) buflen; (void) result; (void) h_errnop; return NULL; } #endif #if __HAS_IPV6__ #define gethosts2(_family, _type) \ { \ int i, herrno; \ size_t tmpbuflen; \ struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = alloca (tmpbuflen); \ rc = gethostbyname2_r (name, _family, &th, tmpbuf, \ tmpbuflen, &h, &herrno); \ } while (rc == ERANGE && herrno == NETDB_INTERNAL); \ if (rc != 0) \ { \ if (herrno == NETDB_INTERNAL) \ { \ __set_h_errno (herrno); \ return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ no_data = EAI_AGAIN; \ else \ no_data = herrno == NO_DATA; \ } \ else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ if (*pat == NULL) { \ *pat = alloca (sizeof(struct gaih_addrtuple)); \ (*pat)->scopeid = 0; \ } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ } \ } #endif #ifndef HAVE_GETHOSTBYADDR_R struct hostent *gethostbyaddr_r(const char *name, int len, int type, struct hostent *result, char *buf, size_t buflen, int *h_errnop) { #ifdef HAVE_PTHREAD static pthread_mutex_t gethostbyaddr_lock = PTHREAD_MUTEX_INITIALIZER; #endif struct hostent *res; (void) buf; // not used (void) buflen; // not used #ifdef HAVE_PTHREAD _MUTEX_LOCK(gethostbyaddr_lock); #endif res = gethostbyaddr(name, len, type); if (res) { memcpy(result, res, sizeof(struct hostent)); } else { *h_errnop = errno; } #ifdef HAVE_PTHREAD _MUTEX_UNLOCK(gethostbyaddr_lock); #endif return res; } #endif static int gaih_inet(const char *name, const struct gaih_service *service, const struct addrinfo *req, struct addrinfo **pai) { const struct gaih_typeproto *tp = gaih_inet_typeproto; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; struct gaih_addrtuple *at = NULL; int rc; int v4mapped = (req->ai_family == PF_UNSPEC #if __HAS_IPV6__ || req->ai_family == PF_INET6 #endif ) && (req->ai_flags & AI_V4MAPPED); if (req->ai_protocol || req->ai_socktype) { ++tp; while (tp->name[0] && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype) || (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol))) ++tp; if (!tp->name[0]) { if (req->ai_socktype) return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); else return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } if (service != NULL) { if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); if (service->num < 0) { if (tp->name[0]) { st = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, st))) return rc; } else { struct gaih_servtuple **pst = &st; for (tp++; tp->name[0]; tp++) { struct gaih_servtuple *newp; if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) continue; if (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) continue; if (req->ai_protocol != 0 && !(tp->protoflag & GAI_PROTO_PROTOANY) && req->ai_protocol != tp->protocol) continue; newp = (struct gaih_servtuple *) alloca(sizeof(struct gaih_servtuple)); if ((rc = gaih_inet_serv(service->name, tp, req, newp))) { if (rc & GAIH_OKIFUNSPEC) continue; return rc; } *pst = newp; pst = &(newp->next); } if (st == (struct gaih_servtuple *) &nullserv) return (GAIH_OKIFUNSPEC | -EAI_SERVICE); } } else { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = htons(service->num); } } else if (req->ai_socktype || req->ai_protocol) { st = alloca(sizeof(struct gaih_servtuple)); st->next = NULL; st->socktype = tp->socktype; st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) ? req->ai_protocol : tp->protocol); st->port = 0; } else { /* * Neither socket type nor protocol is set. Return all socket types * we know about. */ struct gaih_servtuple **lastp = &st; for (++tp; tp->name[0]; ++tp) { struct gaih_servtuple *newp; newp = alloca(sizeof(struct gaih_servtuple)); newp->next = NULL; newp->socktype = tp->socktype; newp->protocol = tp->protocol; newp->port = 0; *lastp = newp; lastp = &newp->next; } } if (name != NULL) { at = alloca(sizeof(struct gaih_addrtuple)); at->family = AF_UNSPEC; at->scopeid = 0; at->next = NULL; if (inet_pton(AF_INET, name, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET || v4mapped) at->family = AF_INET; else return -EAI_FAMILY; } #if __HAS_IPV6__ if (at->family == AF_UNSPEC) { char *namebuf = strdupa(name); char *scope_delim; scope_delim = strchr(namebuf, SCOPE_DELIMITER); if (scope_delim != NULL) *scope_delim = '\0'; if (inet_pton(AF_INET6, namebuf, at->addr) > 0) { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) at->family = AF_INET6; else return -EAI_FAMILY; if (scope_delim != NULL) { int try_numericscope = 0; if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) { at->scopeid = if_nametoindex(scope_delim + 1); if (at->scopeid == 0) try_numericscope = 1; } else try_numericscope = 1; if (try_numericscope != 0) { char *end; assert(sizeof(uint32_t) <= sizeof(unsigned long)); at->scopeid = (uint32_t) strtoul(scope_delim + 1, &end, 10); if (*end != '\0') return GAIH_OKIFUNSPEC | -EAI_NONAME; } } } } #endif if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0) { struct hostent *h; struct gaih_addrtuple **pat = &at; int no_data = 0; int no_inet6_data; /* * If we are looking for both IPv4 and IPv6 address we don't want * the lookup functions to automatically promote IPv4 addresses to * IPv6 addresses. */ #if __HAS_IPV6__ if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) gethosts(AF_INET6, struct in6_addr); #endif no_inet6_data = no_data; if (req->ai_family == AF_INET || (!v4mapped && req->ai_family == AF_UNSPEC) || (v4mapped && (no_inet6_data != 0 || (req->ai_flags & AI_ALL)))) #if __HAS_IPV6__ gethosts2(AF_INET, struct in_addr); #else gethosts(AF_INET, struct in_addr); #endif if (no_data != 0 && no_inet6_data != 0) { /* If both requests timed out report this. */ if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN) return -EAI_AGAIN; /* * We made requests but they turned out no data. * The name is known, though. */ return (GAIH_OKIFUNSPEC | -EAI_AGAIN); } } if (at->family == AF_UNSPEC) return (GAIH_OKIFUNSPEC | -EAI_NONAME); } else { struct gaih_addrtuple *atr; atr = at = alloca(sizeof(struct gaih_addrtuple)); memset(at, '\0', sizeof(struct gaih_addrtuple)); if (req->ai_family == 0) { at->next = alloca(sizeof(struct gaih_addrtuple)); memset(at->next, '\0', sizeof(struct gaih_addrtuple)); } #if __HAS_IPV6__ if (req->ai_family == 0 || req->ai_family == AF_INET6) { extern const struct in6_addr __in6addr_loopback; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) memcpy(at->addr, &__in6addr_loopback, sizeof(struct in6_addr)); atr = at->next; } #endif if (req->ai_family == 0 || req->ai_family == AF_INET) { atr->family = AF_INET; if ((req->ai_flags & AI_PASSIVE) == 0) *(uint32_t *) atr->addr = htonl(INADDR_LOOPBACK); } } if (pai == NULL) return 0; { const char *c = NULL; struct gaih_servtuple *st2; struct gaih_addrtuple *at2 = at; size_t socklen, namelen; sa_family_t family; /* * buffer is the size of an unformatted IPv6 address in * printable format. */ char buffer[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; while (at2 != NULL) { if (req->ai_flags & AI_CANONNAME) { struct hostent *h = NULL; int herrno; struct hostent th; size_t tmpbuflen = 512; char *tmpbuf; do { tmpbuflen *= 2; tmpbuf = alloca(tmpbuflen); if (tmpbuf == NULL) return -EAI_MEMORY; rc = 0; h = gethostbyaddr_r(at2->addr, #if __HAS_IPV6__ ((at2->family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr)), #else sizeof(struct in_addr), #endif at2->family, &th, tmpbuf, tmpbuflen, &herrno); if (!h) rc = errno; } while (rc == errno && herrno == NETDB_INTERNAL); if (rc != 0 && herrno == NETDB_INTERNAL) { __set_h_errno(herrno); return -EAI_SYSTEM; } if (h == NULL) c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer)); else c = h->h_name; if (c == NULL) return GAIH_OKIFUNSPEC | -EAI_NONAME; namelen = strlen(c) + 1; } else namelen = 0; #if __HAS_IPV6__ if (at2->family == AF_INET6 || v4mapped) { family = AF_INET6; socklen = sizeof(struct sockaddr_in6); } else #endif { family = AF_INET; socklen = sizeof(struct sockaddr_in); } for (st2 = st; st2 != NULL; st2 = st2->next) { *pai = owmalloc(sizeof(struct addrinfo) + socklen + namelen); if (*pai == NULL) return -EAI_MEMORY; (*pai)->ai_flags = req->ai_flags; (*pai)->ai_family = family; (*pai)->ai_socktype = st2->socktype; (*pai)->ai_protocol = st2->protocol; (*pai)->ai_addrlen = socklen; (*pai)->ai_addr = (void *) (*pai) + sizeof(struct addrinfo); #ifdef HAVE_SA_LEN (*pai)->ai_addr->sa_len = socklen; #endif /* HAVE_SA_LEN */ (*pai)->ai_addr->sa_family = family; #if __HAS_IPV6__ if (family == AF_INET6) { struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *) (*pai)->ai_addr; sin6p->sin6_flowinfo = 0; if (at2->family == AF_INET6) { memcpy(&sin6p->sin6_addr, at2->addr, sizeof(struct in6_addr)); } else { sin6p->sin6_addr.s6_addr32[0] = 0; sin6p->sin6_addr.s6_addr32[1] = 0; sin6p->sin6_addr.s6_addr32[2] = htonl(0x0000ffff); memcpy(&sin6p->sin6_addr.s6_addr32[3], at2->addr, sizeof(sin6p->sin6_addr.s6_addr32[3])); } sin6p->sin6_port = st2->port; sin6p->sin6_scope_id = at2->scopeid; } else #endif { struct sockaddr_in *sinp = (struct sockaddr_in *) (*pai)->ai_addr; memcpy(&sinp->sin_addr, at2->addr, sizeof(struct in_addr)); sinp->sin_port = st2->port; memset(sinp->sin_zero, '\0', sizeof(sinp->sin_zero)); } if (c) { (*pai)->ai_canonname = ((void *) (*pai) + sizeof(struct addrinfo) + socklen); strcpy((*pai)->ai_canonname, c); } else (*pai)->ai_canonname = NULL; (*pai)->ai_next = NULL; pai = &((*pai)->ai_next); } at2 = at2->next; } } return 0; } static struct gaih gaih[] = { #if __HAS_IPV6__ {PF_INET6, gaih_inet}, #endif {PF_INET, gaih_inet}, #if 0 {PF_LOCAL, gaih_local}, #endif {PF_UNSPEC, NULL} }; int getaddrinfo(const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) { int i = 0, j = 0, last_i = 0; struct addrinfo *p = NULL, **end; struct gaih *g = gaih, *pg = NULL; struct gaih_service gaih_service, *pservice; if (name != NULL && name[0] == '*' && name[1] == 0) name = NULL; if (service != NULL && service[0] == '*' && service[1] == 0) service = NULL; if (name == NULL && service == NULL) return EAI_NONAME; if (hints == NULL) hints = &default_hints; if (hints->ai_flags & ~(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG | AI_V4MAPPED | AI_ALL)) return EAI_BADFLAGS; if ((hints->ai_flags & AI_CANONNAME) && name == NULL) return EAI_BADFLAGS; if (service && service[0]) { char *c; gaih_service.name = service; gaih_service.num = strtoul(gaih_service.name, &c, 10); if (*c) gaih_service.num = -1; else /* * Can't specify a numerical socket unless a protocol * family was given. */ if (hints->ai_socktype == 0 && hints->ai_protocol == 0) return EAI_SERVICE; pservice = &gaih_service; } else pservice = NULL; if (pai) end = &p; else end = NULL; while (g->gaih) { if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC) { if ((hints->ai_flags & AI_ADDRCONFIG) && !addrconfig(g->family)) continue; j++; if (pg == NULL || pg->gaih != g->gaih) { pg = g; i = g->gaih(name, pservice, hints, end); if (i != 0) { last_i = i; if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC)) continue; if (p) freeaddrinfo(p); return -(i & GAIH_EAI); } if (end) while (*end) end = &((*end)->ai_next); } } ++g; } if (j == 0) return EAI_FAMILY; if (p) { *pai = p; return 0; } if (pai == NULL && last_i == 0) return 0; if (p) freeaddrinfo(p); return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *p; while (ai != NULL) { p = ai; ai = ai->ai_next; owfree(p); } } #define N_(x) x static struct { int code; const char *msg; } values[] = { { EAI_ADDRFAMILY, N_("Address family for hostname not supported")}, { EAI_AGAIN, N_("Temporary failure in name resolution")}, { EAI_BADFLAGS, N_("Bad value for ai_flags")}, { EAI_FAIL, N_("Non-recoverable failure in name resolution")}, { EAI_FAMILY, N_("ai_family not supported")}, { EAI_MEMORY, N_("Memory allocation failure")}, { EAI_NODATA, N_("No address associated with hostname")}, { EAI_NONAME, N_("Name or service not known")}, { EAI_SERVICE, N_("Servname not supported for ai_socktype")}, { EAI_SOCKTYPE, N_("ai_socktype not supported")}, { EAI_SYSTEM, N_("System error")}, { EAI_INPROGRESS, N_("Processing request in progress")}, { EAI_CANCELED, N_("Request canceled")}, { EAI_NOTCANCELED, N_("Request not canceled")}, { EAI_ALLDONE, N_("All requests done")}, { EAI_INTR, N_("Interrupted by a signal")} }; const char *gai_strerror(int code) { size_t i; for (i = 0; i < sizeof(values) / sizeof(values[0]); ++i) if (values[i].code == code) return (values[i].msg); return ("Unknown error"); } #endif /* HAVE_GETADDRINFO */ #ifndef HAVE_INET_NTOP /* char * * inet_ntop4(src, dst, size) * format an IPv4 address * return: * `dst' (as a const) * notes: * (1) uses no statics * (2) takes a u_char* not an in_addr as input * author: * Paul Vixie, 1996. */ static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size) { char tmp[sizeof("255.255.255.255") + 1] = "\0"; int octet; int i; i = 0; for (octet = 0; octet <= 3; octet++) { if (src[octet] > 255) { __set_errno(ENOSPC); return (NULL); } tmp[i++] = '0' + src[octet] / 100; if (tmp[i - 1] == '0') { tmp[i - 1] = '0' + (src[octet] / 10 % 10); if (tmp[i - 1] == '0') i--; } else { tmp[i++] = '0' + (src[octet] / 10 % 10); } tmp[i++] = '0' + src[octet] % 10; tmp[i++] = '.'; } tmp[i - 1] = '\0'; if (strlen(tmp) > size) { __set_errno(ENOSPC); return (NULL); } return strcpy(dst, tmp); } /* char * * inet_ntop(af, src, dst, size) * convert a network format address to presentation format. * return: * pointer to presentation format address (`dst'), or NULL (see errno). * author: * Paul Vixie, 1996. */ const char *inet_ntop(af, src, dst, size) int af; const void *src; char *dst; socklen_t size; { switch (af) { case AF_INET: return (inet_ntop4(src, dst, size)); #if __HAS_IPV6__ case AF_INET6: return (inet_ntop6(src, dst, size)); #endif default: __set_errno(EAFNOSUPPORT); return (NULL); } /* NOTREACHED */ } #endif /* HAVE_INET_NTOP */ #ifndef HAVE_INET_PTON /* int * inet_pton4(src, dst) * like inet_aton() but without all the hexadecimal and shorthand. * return: * 1 if `src' is a valid dotted quad, else 0. * notice: * does not touch `dst' unless it's returning 1. * author: * Paul Vixie, 1996. */ static int inet_pton4(const char *src, unsigned char *dst) { int saw_digit, octets, ch; unsigned char tmp[4], *tp; saw_digit = 0; octets = 0; *(tp = tmp) = 0; while ((ch = *src++) != '\0') { if (ch >= '0' && ch <= '9') { unsigned int new = *tp * 10 + (ch - '0'); if (new > 255) return (0); *tp = new; if (!saw_digit) { if (++octets > 4) return (0); saw_digit = 1; } } else if (ch == '.' && saw_digit) { if (octets == 4) return (0); *++tp = 0; saw_digit = 0; } else return (0); } if (octets < 4) return (0); memcpy(dst, tmp, 4); return (1); } /* int * inet_pton(af, src, dst) * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * return: * 1 if the address was valid for the specified address family * 0 if the address wasn't valid (`dst' is untouched in this case) * -1 if some other error occurred (`dst' is untouched in this case, too) * author: * Paul Vixie, 1996. */ int inet_pton(af, src, dst) int af; const char *src; void *dst; { switch (af) { case AF_INET: return (inet_pton4(src, dst)); #if __HAS_IPV6__ case AF_INET6: return (inet_pton6(src, dst)); #endif default: __set_errno(EAFNOSUPPORT); return (-1); } /* NOTREACHED */ } #endif /* HAVE_INET_PTON */ owfs-2.8p15/module/owlib/src/c/ow_tree.c0000644000175000017500000002435111741156523015044 00000000000000/* $Id: ow_tree.c,v 1.69 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_devices.h" #include "ow_external.h" static int device_compare(const void *a, const void *b); static int file_compare(const void *a, const void *b); static void Device2Tree(const struct device *d, enum ePN_type type); static void External_Process(void); struct device *DeviceSimultaneous; struct device *DeviceThermostat; static int device_compare(const void *a, const void *b) { return strcmp(((const struct device *) a)->family_code, ((const struct device *) b)->family_code); } static int file_compare(const void *a, const void *b) { return strcmp(((const struct filetype *) a)->name, ((const struct filetype *) b)->name); } void *Tree[ePN_max_type]; #ifdef __FreeBSD__ static void Device2Tree(const struct device *d, enum ePN_type type) { // FreeBSD fix from Robert Nilsson /* In order for DeviceDestroy to work on FreeBSD we must copy the keys. Otherwise, tdestroy will attempt to free implicitly allocated structures. */ // Note, I'm not using owmalloc since owfree is probably not calledby FreeBSD's tdestroy // struct device *d_copy ; if ((d_copy = (struct device *) malloc(sizeof(struct device)))) { memmove(d_copy, d, sizeof(struct device)); } else { LEVEL_DATA("Could not allocate memory for device %s", d->readable_name); return ; } // Add in the device into the appropriate red/black tree tsearch(d_copy, &Tree[type], device_compare); // Sort all the file types alphabetically for search and listing if (d_copy->filetype_array != NULL) { qsort(d_copy->filetype_array, (size_t) d_copy->count_of_filetypes, sizeof(struct filetype), file_compare); } } #else /* not FreeBSD */ static void Device2Tree(const struct device *d, enum ePN_type type) { // Add in the device into the appropriate red/black tree tsearch(d, &Tree[type], device_compare); // Sort all the file types alphabetically for search and listing if (d->filetype_array != NULL) { qsort(d->filetype_array, (size_t) d->count_of_filetypes, sizeof(struct filetype), file_compare); } } #endif /* __FreeBSD__ */ static void free_node(void *nodep) { (void) nodep; /* nothing to free */ return; } void DeviceDestroy(void) { UINT i; // clear external trees tdestroy( sensor_tree, owfree_func ) ; tdestroy( family_tree, owfree_func ) ; tdestroy( property_tree, owfree_func ) ; // clear these trees -- have static data for (i = 0; i < (sizeof(Tree) / sizeof(void *)); i++) { /* ePN_structure is just a duplicate of ePN_real */ if (i != ePN_structure) { SAFETDESTROY( Tree[i], free_node); } else { /* ePN_structure (will be cleared in ePN_real) */ Tree[i] = NULL; } } } void DeviceSort(void) { memset(Tree, 0, sizeof(void *) * ePN_max_type); /* Sort the filetypes for the unrecognized device */ qsort(UnknownDevice.filetype_array, (size_t) UnknownDevice.count_of_filetypes, sizeof(struct filetype), file_compare); Device2Tree( & d_Example_slave, ePN_real); Device2Tree( & d_BAE, ePN_real); Device2Tree( & d_DS1420, ePN_real); Device2Tree( & d_DS1425, ePN_real); Device2Tree( & d_DS18S20, ePN_real); Device2Tree( & d_DS18B20, ePN_real); Device2Tree( & d_DS1821, ePN_real); Device2Tree( & d_DS1822, ePN_real); Device2Tree( & d_DS1825, ePN_real); Device2Tree( & d_DS1921, ePN_real); Device2Tree( & d_DS1923, ePN_real); Device2Tree( & d_DS1977, ePN_real); Device2Tree( & d_DS1963S, ePN_real); Device2Tree( & d_DS1963L, ePN_real); Device2Tree( & d_DS1982U, ePN_real); Device2Tree( & d_DS1985U, ePN_real); Device2Tree( & d_DS1986U, ePN_real); Device2Tree( & d_DS1991, ePN_real); Device2Tree( & d_DS1992, ePN_real); Device2Tree( & d_DS1993, ePN_real); Device2Tree( & d_DS1995, ePN_real); Device2Tree( & d_DS1996, ePN_real); Device2Tree( & d_DS2401, ePN_real); Device2Tree( & d_DS2404, ePN_real); Device2Tree( & d_DS2405, ePN_real); Device2Tree( & d_DS2406, ePN_real); Device2Tree( & d_DS2408, ePN_real); Device2Tree( & d_DS2409, ePN_real); Device2Tree( & d_DS2413, ePN_real); Device2Tree( & d_DS2415, ePN_real); Device2Tree( & d_DS2417, ePN_real); Device2Tree( & d_DS2423, ePN_real); Device2Tree( & d_DS2430A, ePN_real); Device2Tree( & d_DS2431, ePN_real); Device2Tree( & d_DS2433, ePN_real); Device2Tree( & d_DS2436, ePN_real); Device2Tree( & d_DS2437, ePN_real); Device2Tree( & d_DS2438, ePN_real); Device2Tree( & d_DS2450, ePN_real); Device2Tree( & d_DS2502, ePN_real); Device2Tree( & d_DS2505, ePN_real); Device2Tree( & d_DS2506, ePN_real); Device2Tree( & d_DS2720, ePN_real); Device2Tree( & d_DS2740, ePN_real); Device2Tree( & d_DS2751, ePN_real); Device2Tree( & d_DS2755, ePN_real); Device2Tree( & d_DS2760, ePN_real); Device2Tree( & d_DS2770, ePN_real); Device2Tree( & d_DS2780, ePN_real); Device2Tree( & d_DS2781, ePN_real); Device2Tree( & d_DS2890, ePN_real); Device2Tree( & d_DS28EA00, ePN_real); Device2Tree( & d_DS28EC20, ePN_real); Device2Tree( & d_DS28E04, ePN_real); Device2Tree( & d_EDS, ePN_real); Device2Tree( & d_HobbyBoards_EE, ePN_real); Device2Tree( & d_HobbyBoards_EF, ePN_real); Device2Tree( & d_LCD, ePN_real); Device2Tree( & d_simultaneous, ePN_real); Device2Tree( & d_stats_cache, ePN_statistics); Device2Tree( & d_stats_directory, ePN_statistics); Device2Tree( & d_stats_errors, ePN_statistics); Device2Tree( & d_stats_read, ePN_statistics); Device2Tree( & d_stats_thread, ePN_statistics); Device2Tree( & d_stats_write, ePN_statistics); Device2Tree( & d_stats_return_code, ePN_statistics); Device2Tree( & d_set_timeout, ePN_settings); Device2Tree( & d_set_units, ePN_settings); Device2Tree( & d_set_alias, ePN_settings); Device2Tree( & d_set_return_code, ePN_settings); Device2Tree( & d_sys_process, ePN_system); Device2Tree( & d_sys_connections, ePN_system); Device2Tree( & d_sys_configure, ePN_system); Device2Tree( & d_interface_settings, ePN_interface); Device2Tree( & d_interface_statistics, ePN_interface); /* Add external devices */ External_Process() ; /* Match simultaneous for special processing */ { struct parsedname pn; pn.type = ePN_real; FS_devicefind("simultaneous", &pn); DeviceSimultaneous = pn.selected_device; } /* Match thermostat for special processing */ { struct parsedname pn; pn.type = ePN_real; FS_devicefind("thermostat", &pn); DeviceThermostat = pn.selected_device; } /* structure uses same tree as real */ Tree[ePN_structure] = Tree[ePN_real]; } struct device * FS_devicefindhex(BYTE f, struct parsedname *pn) { char ID[] = "XX"; const struct device d = { ID, NULL, 0, 0, NULL, NO_GENERIC_READ, NO_GENERIC_WRITE }; struct device_opaque *p; num2string(ID, f); if ((p = tfind(&d, &Tree[pn->type], device_compare))) { return p->key; } else { num2string(ID, f ^ 0x80); if ((p = tfind(&d, &Tree[pn->type], device_compare))) { return p->key; } } return &UnknownDevice ; } void FS_devicefind(const char *code, struct parsedname *pn) { const struct device d = { code, NULL, 0, 0, NULL, NO_GENERIC_READ, NO_GENERIC_WRITE }; struct device_opaque *p = tfind(&d, &Tree[pn->type], device_compare); if (p) { pn->selected_device = p->key; } else { pn->selected_device = &UnknownDevice; } } /* Need to lock struct global_namefind_struct since twalk requires global data -- can't pass void pointer */ /* Except all *_detect routines are done sequentially, not concurrently */ struct { const struct family_node * f ; int count ; } global_externalcount_struct; static void External_propertycount_action(const void *nodep, const VISIT which, const int depth) { const struct property_node *p = *(struct property_node * const *) nodep; (void) depth; switch (which) { case leaf: case postorder: if (strcmp(p->family, global_externalcount_struct.f->family) == 0 ) { ++global_externalcount_struct.count; } case preorder: case endorder: break; } } static void External_propertycopy_action(const void *nodep, const VISIT which, const int depth) { const struct property_node *p = *(struct property_node * const *) nodep; (void) depth; switch (which) { case leaf: case postorder: if (strcmp(p->family, global_externalcount_struct.f->family) == 0 ) { memcpy( & (global_externalcount_struct.f->dev.filetype_array[global_externalcount_struct.count]), &(p->ft), sizeof(struct filetype) ) ; ++global_externalcount_struct.count; } case preorder: case endorder: break; } } // First loop through families -- to count properties and allocate filetype array. static void External_family_action(const void *nodep, const VISIT which, const int depth) { const struct family_node *p = *(struct family_node * const *) nodep; struct family_node * non_const_f ; // to allow assignments (void) depth; switch (which) { case leaf: case postorder: // First count global_externalcount_struct.f = p ; global_externalcount_struct.count = 0 ; twalk( property_tree, External_propertycount_action); // Refind this node to allow assignment non_const_f = Find_External_Family( p->family ) ; non_const_f->dev.filetype_array = owcalloc( global_externalcount_struct.count, sizeof( struct filetype) ) ; non_const_f->dev.count_of_filetypes = global_externalcount_struct.count ; // Next copy global_externalcount_struct.count = 0 ; twalk( property_tree, External_propertycopy_action); // Finally add to tree Device2Tree( & (p->dev), ePN_real); break ; case preorder: case endorder: break; } } static void External_Process(void) { EXTERNALCOUNTLOCK; twalk( family_tree, External_family_action); EXTERNALCOUNTUNLOCK; } owfs-2.8p15/module/owlib/src/c/ow_ds9097U.c0000644000175000017500000007745611740105145015200 00000000000000/* $Id: ow_ds9097U.c,v 1.178 2012/04/07 18:41:41 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* This is the busmaster code for the DS2480B-based DS9097U * The serial adapter from Dallas Maxim */ /* Multimaster: * In general the link is DS9097U a multimaster design (only one bus master per serial or telnet port) * None the less, all settings are assigned to the head line */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" static RESET_TYPE DS2480_reset(const struct parsedname *pn); static enum search_status DS2480_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD DS2480_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn); static GOOD_OR_BAD DS2480_PowerBit(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn); static GOOD_OR_BAD DS2480_ProgramPulse(const struct parsedname *pn); static GOOD_OR_BAD DS2480_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD DS2480_sendback_bits(const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn); static GOOD_OR_BAD DS2480_reconnect(const struct parsedname * pn); static void DS2480_close(struct connection_in *in) ; static void DS2480_setroutines(struct connection_in *in); static GOOD_OR_BAD DS2480_detect_serial(struct connection_in *in) ; static RESET_TYPE DS2480_reset_in(struct connection_in * in); static GOOD_OR_BAD DS2480_initialize_repeatedly(struct connection_in * in); static GOOD_OR_BAD DS2480_big_reset(struct connection_in * in) ; static GOOD_OR_BAD DS2480_big_reset_serial(struct connection_in * in) ; static void DS2480_adapter(struct connection_in *in) ; static GOOD_OR_BAD DS2480_big_configuration(struct connection_in * in) ; static GOOD_OR_BAD DS2480_read(BYTE * buf, const size_t size, struct connection_in * in); static GOOD_OR_BAD DS2480_write(const BYTE * buf, const size_t size, struct connection_in * in); static GOOD_OR_BAD DS2480_sendout_cmd(const BYTE * cmd, const size_t len, struct connection_in * in); static GOOD_OR_BAD DS2480_sendback_cmd(const BYTE * cmd, BYTE * resp, const size_t len, struct connection_in * in); static GOOD_OR_BAD DS2480_configuration_write(BYTE parameter_code, BYTE value_code, struct connection_in * in); static GOOD_OR_BAD DS2480_configuration_read(BYTE parameter_code, BYTE value_code, struct connection_in * in); static GOOD_OR_BAD DS2480_stop_pulse(BYTE * response, struct connection_in * in); static RESET_TYPE DS2480_reset_once(struct connection_in * in) ; static GOOD_OR_BAD DS2480_set_baud(struct connection_in * in) ; static void DS2480_set_baud_control(struct connection_in * in) ; static BYTE DS2480b_speed_byte( struct connection_in * in ) ; static void DS2480_flush( const struct connection_in * in ) ; static void DS2480_slurp( struct connection_in * in ) ; static void DS2480_setroutines(struct connection_in *in) { in->iroutines.detect = DS2480_detect; in->iroutines.reset = DS2480_reset; in->iroutines.next_both = DS2480_next_both; in->iroutines.PowerByte = DS2480_PowerByte; in->iroutines.PowerBit = DS2480_PowerBit; in->iroutines.ProgramPulse = DS2480_ProgramPulse; // in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_data = DS2480_sendback_data; in->iroutines.sendback_bits = DS2480_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = DS2480_reconnect ; in->iroutines.close = DS2480_close; in->iroutines.flags = ADAP_FLAG_default; in->bundling_length = UART_FIFO_SIZE; } // Number of times to try init (from digitemp code)) #define DS9097U_INIT_CYCLES 3 /* --------------------------- */ /* DS2480 defines from PDkit */ /* --------------------------- */ // Mode Commands #define MODE_DATA 0xE1 #define MODE_COMMAND 0xE3 #define MODE_STOP_PULSE 0xF1 // Return byte value #define RB_CHIPID_MASK 0x1C #define RB_RESET_MASK 0x03 #define RB_1WIRESHORT 0x00 #define RB_PRESENCE 0x01 #define RB_ALARMPRESENCE 0x02 #define RB_NOPRESENCE 0x03 #define RB_BIT_MASK 0x03 #define RB_BIT_ONE 0x03 #define RB_BIT_ZERO 0x00 // Masks for all bit ranges #define CMD_MASK 0x80 #define FUNCTSEL_MASK 0x60 #define BITPOL_MASK 0x10 #define SPEEDSEL_MASK 0x0C #define MODSEL_MASK 0x02 #define PARMSEL_MASK 0x70 #define PARMSET_MASK 0x0E // Command or config bit #define CMD_COMM 0x81 #define CMD_COMM_RESPONSE 0x80 #define CMD_CONFIG 0x01 #define CMD_CONFIG_RESPONSE 0x00 // Function select bits #define FUNCTSEL_BIT 0x00 #define FUNCTSEL_SEARCHON 0x30 #define FUNCTSEL_SEARCHOFF 0x20 #define FUNCTSEL_RESET 0x40 #define FUNCTSEL_CHMOD 0x60 // Bit polarity/Pulse voltage bits #define BITPOL_ONE 0x10 #define BITPOL_ZERO 0x00 #define BITPOL_5V 0x00 #define BITPOL_12V 0x10 // One Wire speed bits #define SPEEDSEL_STD 0x00 #define SPEEDSEL_FLEX 0x04 #define SPEEDSEL_OD 0x08 #define SPEEDSEL_PULSE 0x0C // Data/Command mode select bits #define MODSEL_DATA 0x00 #define MODSEL_COMMAND 0x02 // 5V Follow Pulse select bits (If 5V pulse // will be following the next byte or bit.) #define PRIME5V_TRUE 0x02 #define PRIME5V_FALSE 0x00 // Parameter select bits #define PARMSEL_PARMREAD 0x00 #define PARMSEL_SLEW 0x10 #define PARMSEL_12VPULSE 0x20 #define PARMSEL_5VPULSE 0x30 #define PARMSEL_WRITE1LOW 0x40 #define PARMSEL_SAMPLEOFFSET 0x50 #define PARMSEL_ACTIVEPULLUPTIME 0x60 #define PARMSEL_BAUDRATE 0x70 // Pull down slew rate. #define PARMSET_Slew15Vus 0x00 #define PARMSET_Slew2p2Vus 0x02 #define PARMSET_Slew1p65Vus 0x04 #define PARMSET_Slew1p37Vus 0x06 #define PARMSET_Slew1p1Vus 0x08 #define PARMSET_Slew0p83Vus 0x0A #define PARMSET_Slew0p7Vus 0x0C #define PARMSET_Slew0p55Vus 0x0E // 12V programming pulse time table #define PARMSET_32us 0x00 #define PARMSET_64us 0x02 #define PARMSET_128us 0x04 #define PARMSET_256us 0x06 #define PARMSET_512us 0x08 #define PARMSET_1024us 0x0A #define PARMSET_2048us 0x0C #define PARMSET_infinite 0x0E // 5V strong pull up pulse time table #define PARMSET_16p4ms 0x00 #define PARMSET_65p5ms 0x02 #define PARMSET_131ms 0x04 #define PARMSET_262ms 0x06 #define PARMSET_524ms 0x08 #define PARMSET_1p05s 0x0A #define PARMSET_2p10s 0x0C #define PARMSET_infinite 0x0E // Write 1 low time #define PARMSET_Write8us 0x00 #define PARMSET_Write9us 0x02 #define PARMSET_Write10us 0x04 #define PARMSET_Write11us 0x06 #define PARMSET_Write12us 0x08 #define PARMSET_Write13us 0x0A #define PARMSET_Write14us 0x0C #define PARMSET_Write15us 0x0E // Data sample offset and Write 0 recovery time #define PARMSET_SampOff3us 0x00 #define PARMSET_SampOff4us 0x02 #define PARMSET_SampOff5us 0x04 #define PARMSET_SampOff6us 0x06 #define PARMSET_SampOff7us 0x08 #define PARMSET_SampOff8us 0x0A #define PARMSET_SampOff9us 0x0C #define PARMSET_SampOff10us 0x0E // Active pull up on time #define PARMSET_PullUp0p0us 0x00 #define PARMSET_PullUp0p5us 0x02 #define PARMSET_PullUp1p0us 0x04 #define PARMSET_PullUp1p5us 0x06 #define PARMSET_PullUp2p0us 0x08 #define PARMSET_PullUp2p5us 0x0A #define PARMSET_PullUp3p0us 0x0C #define PARMSET_PullUp3p5us 0x0E // Baud rate bits #define PARMSET_9600 0x00 #define PARMSET_19200 0x02 #define PARMSET_57600 0x04 #define PARMSET_115200 0x06 #define PARMSET_REVERSE_POLARITY 0x08 // Search defines #define SEARCH_BIT_ON 0x01 #define DS2404_family 0x04 // Could probably be UART_FIFO_SIZE (160) but that will take some testing #define MAX_SEND_SIZE 64 /* Reset and detect a DS2480B */ /* returns 0=good */ // bus locking at a higher level GOOD_OR_BAD DS2480_detect(struct connection_in *in) { /* Set up low-level routines */ DS2480_setroutines(in); in->overdrive = 0 ; in->flex = Globals.serial_flextime ; // Now set desired baud and polarity // BUS_reset will do the actual changes in->master.serial.reverse_polarity = Globals.serial_reverse ; COM_set_standard( in ) ; // standard COM port settings // first pass with hardware flow control RETURN_GOOD_IF_GOOD( DS2480_detect_serial(in) ) ; SOC(in)->flow = flow_second; // flow control RETURN_BAD_IF_BAD(COM_change(in)) ; return DS2480_detect_serial(in) ; } // setting for serial port already made static GOOD_OR_BAD DS2480_detect_serial(struct connection_in *in) { SOC(in)->state = cs_virgin ; if ( BAD(DS2480_initialize_repeatedly(in)) ) { LEVEL_DEBUG("Could not initilize the DS9097U even after several tries") ; COM_close(in) ; return gbBAD ; } in->busmode = bus_serial; DS2480_adapter(in) ; return gbGOOD ; } // Make several attempts to initialize -- based on Digitemp example static GOOD_OR_BAD DS2480_initialize_repeatedly(struct connection_in * in) { int init_cycles ; for ( init_cycles = 0 ; init_cycles < DS9097U_INIT_CYCLES ; ++init_cycles ) { LEVEL_DEBUG("Attempt %d of %d to initialize the DS9097U",init_cycles,DS9097U_INIT_CYCLES) ; RETURN_GOOD_IF_GOOD( DS2480_big_reset(in) ) ; } return gbBAD ; } static void DS2480_adapter(struct connection_in *in) { // in->Adapter is set in DS2480_reset from some status bits switch (in->Adapter) { case adapter_DS9097U2: case adapter_DS9097U: in->adapter_name = "DS9097U"; break; case adapter_LINK: case adapter_LINK_10: case adapter_LINK_11: case adapter_LINK_12: case adapter_LINK_13: case adapter_LINK_14: case adapter_LINK_other: in->adapter_name = "LINK(emulate mode)"; break; default: in->adapter_name = "DS2480B based"; break; } } static GOOD_OR_BAD DS2480_reconnect(const struct parsedname * pn) { LEVEL_DEBUG("Attempting reconnect on %s",SAFESTRING(SOC(pn->selected_connection)->devicename)); return DS2480_big_reset(pn->selected_connection) ; } // do the com port and configuration stuff static GOOD_OR_BAD DS2480_big_reset(struct connection_in * in) { switch (SOC(in)->type) { case ct_telnet: SOC(in)->timeout.tv_sec = Globals.timeout_network ; SOC(in)->timeout.tv_usec = 0 ; return DS2480_big_reset_serial(in) ; case ct_serial: default: SOC(in)->timeout.tv_sec = Globals.timeout_serial ; SOC(in)->timeout.tv_usec = 0 ; SOC(in)->flow = flow_none ; RETURN_GOOD_IF_GOOD( DS2480_big_reset_serial(in)) ; SOC(in)->flow = flow_none ; RETURN_GOOD_IF_GOOD( DS2480_big_reset_serial(in)) ; SOC(in)->flow = flow_hard ; RETURN_GOOD_IF_GOOD( DS2480_big_reset_serial(in)) ; return gbBAD ; } } // do the com port and configuration stuff static GOOD_OR_BAD DS2480_big_reset_serial(struct connection_in * in) { BYTE reset_byte = (BYTE) ( CMD_COMM | FUNCTSEL_RESET | SPEEDSEL_STD ); // Open the com port in 9600 Baud. RETURN_BAD_IF_BAD(COM_open(in)) ; // send a break to reset the DS2480 COM_break(in); // It's in command mode now in->master.serial.mode = ds2480b_command_mode ; // send the timing byte (A reset command at 9600 baud) DS2480_write( &reset_byte, 1, in ) ; // delay to let line settle UT_delay(4); // flush the buffers DS2480_flush(in); // ignore response DS2480_slurp( in ) ; // Now set desired baud and polarity // BUS_reset will do the actual changes in->changed_bus_settings = 1 ; // Force a mode change // Send a reset again LEVEL_DEBUG("Send the initial reset to the bus master."); DS2480_reset_in(in) ; // delay to let line settle UT_delay(400); // flush the buffers DS2480_flush(in); // ignore response DS2480_slurp( in ) ; // Now set desired baud and polarity return DS2480_big_configuration(in) ; } // do the configuration stuff static GOOD_OR_BAD DS2480_big_configuration(struct connection_in * in) { BYTE single_bit = CMD_COMM | BITPOL_ONE | DS2480b_speed_byte(in) ; BYTE single_bit_response ; // Now set desired baud and polarity // BUS_reset will do the actual changes in->changed_bus_settings = 1 ; // Force a mode change // Send a reset again DS2480_reset_in(in) ; // delay to let line settle UT_delay(4); // default W1LT = 10us (write-1 low time) RETURN_BAD_IF_BAD(DS2480_configuration_write(PARMSEL_WRITE1LOW, PARMSET_Write10us, in)) ; // default DSO/WORT = 8us (data sample offset / write 0 recovery time ) RETURN_BAD_IF_BAD(DS2480_configuration_write(PARMSEL_SAMPLEOFFSET, PARMSET_SampOff8us, in)) ; // Strong pullup duration = infinite RETURN_BAD_IF_BAD(DS2480_configuration_write(PARMSEL_5VPULSE, PARMSET_infinite, in)) ; // Program pulse duration = 512usec RETURN_BAD_IF_BAD(DS2480_configuration_write(PARMSEL_12VPULSE, PARMSET_512us, in)) ; // Send a single bit // The datasheet wants this RETURN_BAD_IF_BAD(DS2480_sendback_cmd(&single_bit, &single_bit_response, 1, in)) ; /* Apparently need to reset again to get the version number properly */ return gbRESET( DS2480_reset_in(in) ) ; } // configuration of DS2480B -- parameter code is already shifted in the defines (by 4 bites) // configuration of DS2480B -- value code is already shifted in the defines (by 1 bit) static GOOD_OR_BAD DS2480_configuration_write(BYTE parameter_code, BYTE value_code, struct connection_in * in) { BYTE send_code = CMD_CONFIG | parameter_code | value_code; BYTE expected_response = CMD_CONFIG_RESPONSE | parameter_code | value_code; BYTE actual_response; RETURN_BAD_IF_BAD(DS2480_sendback_cmd(&send_code, &actual_response, 1, in)) ; if (expected_response == actual_response) { return gbGOOD; } LEVEL_DEBUG("wrong response (%.2X not %.2X)",actual_response,expected_response) ; return gbBAD; } // configuration of DS2480B -- parameter code is already shifted in the defines (by 4 bites) // configuration of DS2480B -- value code is already shifted in the defines (by 1 bit) static GOOD_OR_BAD DS2480_configuration_read(BYTE parameter_code, BYTE value_code, struct connection_in * in) { BYTE send_code = CMD_CONFIG | PARMSEL_PARMREAD | (parameter_code>>3); BYTE expected_response = CMD_CONFIG_RESPONSE | PARMSEL_PARMREAD | value_code; BYTE actual_response; RETURN_BAD_IF_BAD( DS2480_sendback_cmd(&send_code, &actual_response, 1, in)) ; if (expected_response == actual_response) { return gbGOOD; } LEVEL_DEBUG("wrong response (%.2X not %.2X)",actual_response,expected_response) ; return gbBAD; } // configuration of DS2480B -- parameter code is already shifted in the defines (by 4 bites) // configuration of DS2480B -- value code is already shifted in the defines (by 1 bit) // Set Baud rate -- can't use DS2480_configuration_code because return byte is at a different speed static void DS2480_set_baud_control(struct connection_in * in) { // restrict allowable baud rates based on device capabilities COM_BaudRestrict( &(SOC(in)->baud), B9600, B19200, B57600, B115200, 0 ) ; if ( GOOD( DS2480_set_baud(in) ) ) { return ; } LEVEL_DEBUG("Failed first attempt at resetting baud rate of bus master %s",SAFESTRING(SOC(in)->devicename)) ; if ( GOOD( DS2480_set_baud(in) ) ) { return ; } LEVEL_DEBUG("Failed second attempt at resetting baud rate of bus master %s",SAFESTRING(SOC(in)->devicename)) ; // uh oh -- undefined state -- not sure what the bus speed is. in->reconnect_state = reconnect_error ; SOC(in)->baud = B9600 ; ++in->changed_bus_settings ; return; } static GOOD_OR_BAD DS2480_set_baud(struct connection_in * in) { BYTE value_code = 0 ; BYTE send_code ; // Find rate parameter switch ( SOC(in)->baud ) { case B9600: value_code = PARMSET_9600 ; break ; case B19200: value_code = PARMSET_19200 ; break ; #ifdef B57600 /* MacOSX support max 38400 in termios.h ? */ case B57600: value_code = PARMSET_57600 ; break ; #endif #ifdef B115200 /* MacOSX support max 38400 in termios.h ? */ case B115200: value_code = PARMSET_115200 ; break ; #endif default: SOC(in)->baud = B9600 ; value_code = PARMSET_9600 ; break ; } // Add polarity if ( in->master.serial.reverse_polarity ) { value_code |= PARMSET_REVERSE_POLARITY ; } send_code = CMD_CONFIG | PARMSEL_BAUDRATE | value_code; // Send configuration change DS2480_flush(in); UT_delay(5); // uh oh -- undefined state -- not sure what the bus speed is. RETURN_BAD_IF_BAD(DS2480_sendout_cmd(&send_code, 1, in)) ; // Change OS view of rate UT_delay(5); COM_change(in) ; UT_delay(5); DS2480_slurp(in); // Check rate RETURN_BAD_IF_BAD( DS2480_configuration_read( PARMSEL_BAUDRATE, value_code, in ) ) ; return gbGOOD ; } static BYTE DS2480b_speed_byte( struct connection_in * in ) { if ( in->overdrive ) { return SPEEDSEL_OD ; } else if ( in->flex ) { return SPEEDSEL_FLEX ; } else { return SPEEDSEL_STD ; } } //-------------------------------------------------------------------------- // Reset all of the devices on the 1-Wire Net and return the result. // // This routine will not function correctly on some // Alarm reset types of the DS1994/DS1427/DS2404 with // Rev 1,2, and 3 of the DS2480/DS2480B. static RESET_TYPE DS2480_reset(const struct parsedname *pn) { return DS2480_reset_in( pn->selected_connection ) ; } static RESET_TYPE DS2480_reset_in(struct connection_in * in) { if ( in->changed_bus_settings != 0) { in->changed_bus_settings = 0 ; DS2480_set_baud_control(in); // reset paramters } switch( DS2480_reset_once(in) ) { case BUS_RESET_OK: return BUS_RESET_OK ; case BUS_RESET_SHORT: return BUS_RESET_SHORT; case BUS_RESET_ERROR: default: { // Some kind of reset problem (not including bus short) // Try simple fixes BYTE dummy[1] ; //we don't check the pulse stop, since it's only a whim. // perhaps the DS9097U wasn't in command mode, so missed the reset // force a mode switch in->master.serial.mode = ds2480b_data_mode ; // Also make sure no power or programming pulse active DS2480_stop_pulse(dummy,in) ; // And now reset again return DS2480_reset_once(in) ; } } } static RESET_TYPE DS2480_reset_once(struct connection_in * in) { BYTE reset_byte = (BYTE) ( CMD_COMM | FUNCTSEL_RESET | DS2480b_speed_byte(in) ); BYTE reset_response ; // flush the buffers DS2480_flush(in); // send the packet // read back the 1 byte response if ( BAD(DS2480_sendback_cmd(&reset_byte, &reset_response, 1, in)) ) { return BUS_RESET_ERROR; } /* The adapter type is encoded in this response byte */ /* The known values correspond to the types in enum adapter_type */ /* Other values are assigned for adapters that don't have this hardcoded value */ in->Adapter = (reset_response & RB_CHIPID_MASK) >> 2; switch (reset_response & RB_RESET_MASK) { case RB_1WIRESHORT: return BUS_RESET_SHORT; case RB_NOPRESENCE: in->AnyDevices = anydevices_no ; return BUS_RESET_OK; case RB_PRESENCE: case RB_ALARMPRESENCE: in->AnyDevices = anydevices_yes ; // check if programming voltage available in->ProgramAvailable = ((reset_response & PARMSEL_12VPULSE) == PARMSEL_12VPULSE); DS2480_flush(in); return BUS_RESET_OK; default: return BUS_RESET_ERROR; // should never happen } } /* search = normal and alarm */ static enum search_status DS2480_next_both(struct device_search *ds, const struct parsedname *pn) { int mismatched; BYTE sn[8]; BYTE bitpairs[16]; struct connection_in * in = pn->selected_connection ; BYTE searchon = (BYTE) ( CMD_COMM | FUNCTSEL_SEARCHON | DS2480b_speed_byte(in) ); BYTE searchoff = (BYTE) ( CMD_COMM | FUNCTSEL_SEARCHOFF | DS2480b_speed_byte(in) ); int i; if (ds->LastDevice) { return search_done; } if ( BAD( BUS_select(pn) ) ) { return search_error; } // need the reset done in BUS-select to set AnyDevices if ( in->AnyDevices == anydevices_no ) { ds->LastDevice = 1; return search_done; } // build the command stream // call a function that may add the change mode command to the buff // check if correct mode // issue the search command // change back to command mode // search mode on // change back to data mode // set the temp Last Descrep to none mismatched = -1; // add the 16 bytes of the search memset(bitpairs, 0, 16); // set the bits in the added buffer for (i = 0; i < ds->LastDiscrepancy; i++) { // before last discrepancy UT_set2bit(bitpairs, i, UT_getbit(ds->sn, i) << 1); } // at last discrepancy if (ds->LastDiscrepancy > -1) { UT_set2bit(bitpairs, ds->LastDiscrepancy, 1 << 1); } // after last discrepancy so leave zeros // flush the buffers DS2480_flush(in); // search ON // change back to command mode // send the packet // cannot use single-bit mode with search accerator // search OFF if ( BAD(BUS_send_data(&(ds->search), 1, pn)) || BAD(DS2480_sendout_cmd(&searchon, 1, in)) || BAD( DS2480_sendback_data(bitpairs, bitpairs, 16, pn) ) || BAD(DS2480_sendout_cmd(&searchoff, 1, in)) ) { return search_error; } // interpret the bit stream for (i = 0; i < 64; i++) { // get the SerialNum bit UT_setbit(sn, i, UT_get2bit(bitpairs, i) >> 1); // check LastDiscrepancy if (UT_get2bit(bitpairs, i) == SEARCH_BIT_ON ) { mismatched = i; } } if ( sn[0]==0xFF && sn[1]==0xFF && sn[2]==0xFF && sn[3]==0xFF && sn[4]==0xFF && sn[5]==0xFF && sn[6]==0xFF && sn[7]==0xFF ) { // special case for no alarm present return search_done ; } // CRC check if (CRC8(sn, 8) || (ds->LastDiscrepancy == 63) || (sn[0] == 0)) { return search_error; } // successful search // check for last one if ((mismatched == ds->LastDiscrepancy) || (mismatched == -1)) { ds->LastDevice = 1; } // copy the SerialNum to the buffer memcpy(ds->sn, sn, 8); // set the count ds->LastDiscrepancy = mismatched; LEVEL_DEBUG("SN found: " SNformat, SNvar(ds->sn)); return search_good; } //-------------------------------------------------------------------------- // Send 8 bits of communication to the 1-Wire Net and verify that the // 8 bits read from the 1-Wire Net is the same (write operation). // The parameter 'byte' least significant 8 bits are used. After the // 8 bits are sent change the level of the 1-Wire net. // Delay delay msec and return to normal // /* Returns 0=good bad = -EIO */ static GOOD_OR_BAD DS2480_PowerByte(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn) { GOOD_OR_BAD ret; struct connection_in * in = pn->selected_connection ; BYTE bits = CMD_COMM | FUNCTSEL_BIT | DS2480b_speed_byte(in) ; BYTE cmd[] = { // bit 1 ((byte & 0x01) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 2 ((byte & 0x02) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 3 ((byte & 0x04) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 4 ((byte & 0x08) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 5 ((byte & 0x10) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 6 ((byte & 0x20) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 7 ((byte & 0x40) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_FALSE, // bit 8 ((byte & 0x80) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_TRUE, }; BYTE respbits[8]; BYTE response[1]; // flush the buffers DS2480_flush(in); // send the packet // read back the 8 byte response from sending the 5V pulse ret = DS2480_sendback_cmd(cmd, respbits, 8, in); UT_delay(delay); // return to normal level DS2480_stop_pulse(response, in); resp[0] = ((respbits[7] & 1) << 7) | ((respbits[6] & 1) << 6) | ((respbits[5] & 1) << 5) | ((respbits[4] & 1) << 4) | ((respbits[3] & 1) << 3) | ((respbits[2] & 1) << 2) | ((respbits[1] & 1) << 1) | ((respbits[0] & 1)); return ret ; } //-------------------------------------------------------------------------- // Send 1 bit of communication to the 1-Wire Net and verify that the // bit read from the 1-Wire Net is the same (write operation). // Delay delay msec and return to normal // /* Returns 0=good bad = -EIO */ static GOOD_OR_BAD DS2480_PowerBit(const BYTE byte, BYTE * resp, const UINT delay, const struct parsedname *pn) { GOOD_OR_BAD ret; struct connection_in * in = pn->selected_connection ; BYTE bits = CMD_COMM | FUNCTSEL_BIT | DS2480b_speed_byte(in) ; BYTE cmd[] = { ((byte & 0x01) ? BITPOL_ONE : BITPOL_ZERO) | bits | PRIME5V_TRUE, }; BYTE respbits[1]; BYTE response[1]; // flush the buffers DS2480_flush(in); // send the packet // read back the 1 byte response from sending the 5V pulse ret = DS2480_sendback_cmd(cmd, respbits, 1, in); UT_delay(delay); // return to normal level DS2480_stop_pulse(response, in); resp[0] = (respbits[0] & 0x01); return ret ; } //-------------------------------------------------------------------------- // Send 1 bit of communication to the 1-Wire Net and verify that the // 8 bits read from the 1-Wire Net is the same (write operation). // /* Returns 0=good bad = -EIO */ static GOOD_OR_BAD DS2480_sendback_bits(const BYTE * databits, BYTE * respbits, const size_t len, const struct parsedname * pn) { struct connection_in * in = pn->selected_connection ; BYTE bits = CMD_COMM | FUNCTSEL_BIT | DS2480b_speed_byte(in) | PRIME5V_FALSE; size_t counter ; for ( counter=0 ; counter < len ; ++counter ) { BYTE cmd[] = { ((databits[counter] & 0x01) ? BITPOL_ONE : BITPOL_ZERO) | bits, }; // send the packet // read back the 1 byte response from sending the bit RETURN_BAD_IF_BAD( DS2480_sendback_cmd(cmd, &respbits[counter], 1, in) ) ; } return 0 ; } static void DS2480_flush( const struct connection_in * in ) { COM_flush( in ) ; } static void DS2480_slurp( struct connection_in * in ) { COM_slurp( in ) ; } static GOOD_OR_BAD DS2480_stop_pulse(BYTE * response, struct connection_in * in) { BYTE cmd[1] = { MODE_STOP_PULSE, }; // read back the 8 byte response from setting time limit return DS2480_sendback_cmd(cmd, response, 1, in); } /* Send a 12v 480usec pulse on the 1wire bus to program the EPROM */ // returns 0 if good static GOOD_OR_BAD DS2480_ProgramPulse(const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; GOOD_OR_BAD ret; BYTE cmd[] = { CMD_COMM | FUNCTSEL_CHMOD | BITPOL_12V | SPEEDSEL_PULSE, }; BYTE response_mask = 0xFC; BYTE command_resp[1]; BYTE stop_pulse[1] ; DS2480_flush(in); // send the packet // read back the 8 byte response from sending the 12V pilse ret = DS2480_sendback_cmd(cmd, command_resp, 1, in); if ( GOOD(ret) ) { UT_delay_us(520); } // return to normal level DS2480_stop_pulse(stop_pulse, in); RETURN_BAD_IF_BAD(ret) ; if ((command_resp[0] & response_mask) != (cmd[0] & response_mask)) { return gbBAD; } return gbGOOD; } // Write to the output -- works for tcp and COM static GOOD_OR_BAD DS2480_write(const BYTE * buf, const size_t size, struct connection_in * in) { switch( SOC(in)->type ) { case ct_telnet: return telnet_write_binary( buf, size, in) ; case ct_serial: default: return COM_write( buf, size, in ) ; } } /* Assymetric */ /* Read from DS2480 with timeout on each character */ // NOTE: from PDkit, read 1-byte at a time // NOTE: change timeout to 40msec from 10msec for LINK (emulation mode) static GOOD_OR_BAD DS2480_read(BYTE * buf, const size_t size, struct connection_in * in) { return COM_read( buf, size, in ) ; } // // DS2480_sendout_cmd // Send a command but expect no response // puts into command mode if needed. // Note most use is through DS2480_sendback_command // The only uses for this alone are the single byte search accelerators // so size checking will be done in sendback // return 0=good static GOOD_OR_BAD DS2480_sendout_cmd(const BYTE * cmd, const size_t len, struct connection_in * in) { if (in->master.serial.mode == ds2480b_command_mode ) { // already in command mode -- very easy return DS2480_write(cmd, (unsigned) len, in); } else { // need to switch to command mode // add to current string for efficiency BYTE cmd_plus[len+1] ; cmd_plus[0] = MODE_COMMAND ; memcpy( &cmd_plus[1], cmd, len ) ; // MODE_COMMAND is one of the reserved commands that does not generate a response byte // page 6 of datasheet: http://datasheets.maxim-ic.com/en/ds/DS2480B.pdf in->master.serial.mode = ds2480b_command_mode ; return DS2480_write(cmd_plus, (unsigned) len+1, in); } } // // DS2480_sendback_cmd // Send a command and return response block // puts into command mode if needed. // return 0=good static GOOD_OR_BAD DS2480_sendback_cmd(const BYTE * cmd, BYTE * resp, const size_t len, struct connection_in * in) { size_t bytes_so_far = 0 ; size_t extra_byte_for_modeshift = (in->master.serial.mode != ds2480b_command_mode) ? 1 : 0 ; while ( bytes_so_far < len ) { size_t bytes_this_segment = len - bytes_so_far ; if ( bytes_this_segment > MAX_SEND_SIZE - extra_byte_for_modeshift ) { bytes_this_segment = MAX_SEND_SIZE - extra_byte_for_modeshift ; extra_byte_for_modeshift = 0 ; } RETURN_BAD_IF_BAD( DS2480_sendout_cmd( &cmd[bytes_so_far], bytes_this_segment, in) ); RETURN_BAD_IF_BAD( DS2480_read( &resp[bytes_so_far], bytes_this_segment, in) ); bytes_so_far += bytes_this_segment ; } return gbGOOD ; } // // DS2480_sendback_data // Send data and return response block // puts into data mode if needed. // Repeat magic MODE_COMMAND byte to show true data // return 0=good static GOOD_OR_BAD DS2480_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; BYTE sendout[MAX_SEND_SIZE] ; size_t bytes_this_segment = 0 ; size_t bytes_at_segment_start = 0 ; size_t bytes_from_list = 0 ; // skip if nothing // don't even switch to data mode if ( len == 0 ) { return gbGOOD ; } // switch mode if needed if (in->master.serial.mode != ds2480b_data_mode) { // this is one of the "reserved commands" that does not generate a resonse byte // page 6 of the datasheet http://datasheets.maxim-ic.com/en/ds/DS2480B.pdf sendout[bytes_this_segment++] = MODE_DATA; // change flag to data mode in->master.serial.mode = ds2480b_data_mode; } while ( bytes_from_list < len ) { BYTE current_char = data[bytes_from_list++] ; // transfer this byte sendout[ bytes_this_segment++ ] = current_char ; // see about "doubling" if ( current_char == MODE_COMMAND ) { sendout[ bytes_this_segment++ ] = current_char ; } // Should we send off this data so far and queue up more? // need room for potentially 2 characters if ( bytes_this_segment > MAX_SEND_SIZE-2 || bytes_from_list == len ) { // write out RETURN_BAD_IF_BAD( DS2480_write(sendout, bytes_this_segment, in ) ) ; // read in // note that read and write sizes won't match because of doubled bytes and mode shift RETURN_BAD_IF_BAD( DS2480_read(&resp[bytes_at_segment_start], bytes_from_list - bytes_at_segment_start, in) ) ; // move indexes for next segment bytes_at_segment_start = bytes_from_list ; bytes_this_segment = 0 ; } } return gbGOOD ; } static void DS2480_close(struct connection_in *in) { // the standard COM_free cleans up the connection (void) in ; } owfs-2.8p15/module/owlib/src/c/ow_2450.c0000644000175000017500000005315311740076517014504 00000000000000/* $Id: ow_2450.c,v 1.93 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2450.h" /* ------- Prototypes ----------- */ /* DS2450 A/D */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_volts); READ_FUNCTION(FS_r_power); WRITE_FUNCTION(FS_w_power); READ_FUNCTION(FS_r_enable); WRITE_FUNCTION(FS_w_enable); READ_FUNCTION(FS_r_PIO); WRITE_FUNCTION(FS_w_PIO); READ_FUNCTION(FS_r_setvolt); WRITE_FUNCTION(FS_w_setvolt); READ_FUNCTION(FS_r_flag); WRITE_FUNCTION(FS_w_flag); WRITE_FUNCTION(FS_w_por); READ_FUNCTION(FS_CO2_ppm); READ_FUNCTION(FS_CO2_status); READ_FUNCTION(FS_CO2_power); /* ------- Structures ----------- */ enum V_resolution { r_5V_16bit, // 5V full scale. 16 bits is higher than hardware resolution r_2V_16bit, // actually 2.5V full scale r_5V_8bit, // 5V full scale. 16 bits is higher than hardware resolution r_2V_8bit, // actually 2.5V full scale } ; enum alarm_level { ae_low, ae_high, } ; enum V_alarm_level { V5_ae_low, V5_ae_high, V2_ae_low, V2_ae_high, } ; #define _1W_2450_PAGES 4 #define _1W_2450_PAGESIZE 8 #define _1W_2450_REGISTERS 4 static struct aggregate A2450p = { _1W_2450_PAGES, ag_numbers, ag_separate, }; static struct aggregate A2450 = { _1W_2450_REGISTERS, ag_letters, ag_separate, }; static struct aggregate A2450v = { _1W_2450_REGISTERS, ag_letters, ag_aggregate, }; static struct filetype DS2450[] = { F_STANDARD, {"memory", _1W_2450_PAGESIZE*_1W_2450_PAGES, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", _1W_2450_PAGESIZE, &A2450p, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_power, FS_w_power, VISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_YESNO, &A2450, ft_yesno, fc_stable, FS_r_PIO, FS_w_PIO, VISIBLE, {i:0}, }, {"volt", PROPERTY_LENGTH_FLOAT, &A2450v, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:r_5V_16bit}, }, {"volt2", PROPERTY_LENGTH_FLOAT, &A2450v, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:r_2V_16bit}, }, {"8bit", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"8bit/volt", PROPERTY_LENGTH_FLOAT, &A2450v, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:r_5V_8bit}, }, {"8bit/volt2", PROPERTY_LENGTH_FLOAT, &A2450v, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:r_2V_8bit}, }, {"set_alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm/volthigh", PROPERTY_LENGTH_FLOAT, &A2450, ft_float, fc_stable, FS_r_setvolt, FS_w_setvolt, VISIBLE, {i:V5_ae_high}, }, {"set_alarm/volt2high", PROPERTY_LENGTH_FLOAT, &A2450, ft_float, fc_stable, FS_r_setvolt, FS_w_setvolt, VISIBLE, {i:V2_ae_high}, }, {"set_alarm/voltlow", PROPERTY_LENGTH_FLOAT, &A2450, ft_float, fc_stable, FS_r_setvolt, FS_w_setvolt, VISIBLE, {i:V5_ae_low}, }, {"set_alarm/volt2low", PROPERTY_LENGTH_FLOAT, &A2450, ft_float, fc_stable, FS_r_setvolt, FS_w_setvolt, VISIBLE, {i:V2_ae_low}, }, {"set_alarm/high", PROPERTY_LENGTH_YESNO, &A2450, ft_yesno, fc_stable, FS_r_enable, FS_w_enable, VISIBLE, {i:ae_high}, }, {"set_alarm/low", PROPERTY_LENGTH_YESNO, &A2450, ft_yesno, fc_stable, FS_r_enable, FS_w_enable, VISIBLE, {i:ae_low}, }, {"set_alarm/unset", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_w_por, VISIBLE, NO_FILETYPE_DATA, }, {"alarm", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"alarm/high", PROPERTY_LENGTH_YESNO, &A2450, ft_yesno, fc_volatile, FS_r_flag, FS_w_flag, VISIBLE, {i:ae_high}, }, {"alarm/low", PROPERTY_LENGTH_YESNO, &A2450, ft_yesno, fc_volatile, FS_r_flag, FS_w_flag, VISIBLE, {i:ae_low}, }, {"CO2", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"CO2/ppm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_link, FS_CO2_ppm, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"CO2/Vdd", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_yesno, fc_link, FS_CO2_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"CO2/status", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_float, fc_link, FS_CO2_status, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(20, DS2450, DEV_volt | DEV_alarm | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); /* Internal properties */ Make_SlaveSpecificTag(RES, fc_stable); // resolution Make_SlaveSpecificTag(RAN, fc_stable); // range Make_SlaveSpecificTag(POW, fc_stable); // power status #define _1W_READ_MEMORY 0x44 #define _1W_WRITE_MEMORY 0x55 #define _1W_CONVERT 0x3C #define _1W_2450_POWERED 0x40 #define _1W_2450_UNPOWERED 0x00 #define _ADDRESS_CONVERSION_PAGE 0x00 #define _ADDRESS_CONTROL_PAGE 0x08 #define _ADDRESS_ALARM_PAGE 0x10 #define _ADDRESS_POWERED 0x1C #define _1W_2450_REG_A 0 #define _1W_2450_REG_B 2 #define _1W_2450_REG_C 4 #define _1W_2450_REG_D 6 #define _1W_2450_RC_MASK 0x0F // resolution mask in control page #define _1W_2450_OC 0x40 // Output control #define _1W_2450_OE 0x80 // Outout enable #define _1W_2450_IR 0x01 // Input DAC range #define _1W_2450_AEL 0x04 // Alarm low enable #define _1W_2450_AEH 0x08 // Alarm high enable #define _1W_2450_AFL 0x10 // Alarm low flag #define _1W_2450_AFH 0x20 // Alarm high flag #define _1W_2450_POR 0x80 // Power On Reset bit /* ------- Functions ------------ */ /* DS2450 */ static GOOD_OR_BAD OW_r_mem(BYTE * p, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_mem(BYTE * p, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_volts(_FLOAT * f, struct parsedname *pn); static GOOD_OR_BAD OW_convert( int simul_good, int delay, struct parsedname *pn); static GOOD_OR_BAD OW_r_pio(int *pio, struct parsedname *pn); static GOOD_OR_BAD OW_w_pio( int pio, struct parsedname *pn); static GOOD_OR_BAD OW_r_vset( _FLOAT * V, enum V_alarm_level ae, struct parsedname *pn); static GOOD_OR_BAD OW_w_vset( _FLOAT V, enum V_alarm_level ae, struct parsedname *pn) ; static GOOD_OR_BAD OW_r_enable(int *y, enum alarm_level ae, struct parsedname *pn); static GOOD_OR_BAD OW_w_enable( int y, enum alarm_level ae, struct parsedname *pn); static GOOD_OR_BAD OW_r_mask(int *y, BYTE mask, struct parsedname *pn); static GOOD_OR_BAD OW_w_mask( int y, BYTE mask, struct parsedname *pn); static GOOD_OR_BAD OW_r_flag(int *y, enum alarm_level ae, struct parsedname *pn); static GOOD_OR_BAD OW_w_flag( int y, enum alarm_level ae, struct parsedname *pn); static GOOD_OR_BAD OW_w_por( int por, struct parsedname *pn); static GOOD_OR_BAD OW_set_resolution( int resolution, struct parsedname * pn ); static GOOD_OR_BAD OW_set_range( int range, struct parsedname * pn ); static GOOD_OR_BAD OW_get_power( struct parsedname * pn ); /* read a page of memory (8 bytes) */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*_1W_2450_PAGESIZE) ; } /* write an 8-byte page */ static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { return COMMON_offset_process(FS_w_mem, owq, OWQ_pn(owq).extension*_1W_2450_PAGESIZE) ; } /* read powered flag */ static ZERO_OR_ERROR FS_r_power(struct one_wire_query *owq) { BYTE p; RETURN_ERROR_IF_BAD( OW_r_mem(&p, 1, _ADDRESS_POWERED, PN(owq)) ) ; OWQ_Y(owq) = (p == _1W_2450_POWERED); Cache_Add_SlaveSpecific(&OWQ_Y(owq), sizeof(int), SlaveSpecificTag(POW), PN(owq)); return 0; } /* write powered flag */ static ZERO_OR_ERROR FS_w_power(struct one_wire_query *owq) { BYTE p = _1W_2450_POWERED; /* powered */ BYTE q = _1W_2450_UNPOWERED; /* parasitic */ if (OW_w_mem(OWQ_Y(owq) ? &p : &q, 1, _ADDRESS_POWERED, PN(owq))) { return -EINVAL; } Cache_Add_SlaveSpecific(&OWQ_Y(owq), sizeof(int), SlaveSpecificTag(POW), PN(owq)); return 0; } /* write "unset" PowerOnReset flag */ static ZERO_OR_ERROR FS_w_por(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_por( OWQ_Y(owq), PN(owq) ) ) ; } /* read high/low voltage alarm flags */ static ZERO_OR_ERROR FS_r_enable(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E( OW_r_enable( &OWQ_Y(owq), pn->selected_filetype->data.i, pn) ) ; } /* write high/low voltage alarm flags */ static ZERO_OR_ERROR FS_w_enable(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E( OW_w_enable( OWQ_Y(owq), pn->selected_filetype->data.i, pn) ) ; } /* read high/low voltage triggered state alarm flags */ static ZERO_OR_ERROR FS_r_flag(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E( OW_r_flag( &OWQ_Y(owq), pn->selected_filetype->data.i, pn) ) ; } /* write high/low voltage triggered state alarm flags */ static ZERO_OR_ERROR FS_w_flag(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E(OW_w_flag( OWQ_Y(owq), pn->selected_filetype->data.i, pn)) ; } /* 2450 A/D */ // separate static ZERO_OR_ERROR FS_r_PIO(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_r_pio( &OWQ_Y(owq), PN(owq)) ) ; } /* 2450 A/D */ static ZERO_OR_ERROR FS_w_PIO(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_pio( OWQ_Y(owq), PN(owq)) ) ; } /* 2450 A/D */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { return GB_to_Z_OR_E(COMMON_OWQ_readwrite_paged(owq, 0, _1W_2450_PAGESIZE, COMMON_read_memory_crc16_AA)) ; } /* 2450 A/D */ static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, _1W_2450_PAGESIZE, OW_w_mem)) ; } /* 2450 A/D */ static ZERO_OR_ERROR FS_volts(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int resolution ; int range ; _FLOAT V[4] ; switch ( pn->selected_filetype->data.i ) { case r_2V_8bit: range = 2 ; resolution = 8 ; break ; case r_5V_8bit: range = 5 ; resolution = 8 ; break ; case r_2V_16bit: range = 2 ; resolution = 16 ; break ; case r_5V_16bit: default: range = 5 ; resolution = 16 ; break ; } if ( BAD( OW_set_resolution( resolution, pn ) ) ) { return -EINVAL ; } if ( BAD( OW_set_range( range, pn ) ) ) { return -EINVAL ; } // Start A/D process if needed if ( BAD( OW_convert( OWQ_SIMUL_TEST(owq), (int)(.5+.16+4.*resolution*.08), pn) )) { return -EINVAL ; } if ( BAD( OW_volts( V, pn ) )) { return -EINVAL ; } switch ( pn->selected_filetype->data.i ) { case r_2V_8bit: case r_2V_16bit: OWQ_array_F(owq, 0) = V[0]*.5; OWQ_array_F(owq, 1) = V[1]*.5; OWQ_array_F(owq, 2) = V[2]*.5; OWQ_array_F(owq, 3) = V[3]*.5; break ; case r_5V_8bit: case r_5V_16bit: default: OWQ_array_F(owq, 0) = V[0]; OWQ_array_F(owq, 1) = V[1]; OWQ_array_F(owq, 2) = V[2]; OWQ_array_F(owq, 3) = V[3]; break ; } return 0 ; } static ZERO_OR_ERROR FS_r_setvolt(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); return GB_to_Z_OR_E( OW_r_vset( &OWQ_F(owq), pn->selected_filetype->data.i, pn) ) ; } static ZERO_OR_ERROR FS_w_setvolt(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); RETURN_ERROR_IF_BAD( FS_w_sibling_Y( 0, "set_alarm/unset", owq ) ) ; return GB_to_Z_OR_E(OW_w_vset( OWQ_F(owq), pn->selected_filetype->data.i, pn)) ; } static GOOD_OR_BAD OW_r_mem(BYTE * p, size_t size, off_t offset, struct parsedname *pn) { OWQ_allocate_struct_and_pointer(owq_read); OWQ_create_temporary(owq_read, (char *) p, size, offset, pn); return COMMON_read_memory_crc16_AA(owq_read, 0, _1W_2450_PAGESIZE); } /* write to 2450 */ static GOOD_OR_BAD OW_w_mem(BYTE * p, size_t size, off_t offset, struct parsedname *pn) { // command, address(2) , data , crc(2), databack BYTE buf[6] = { _1W_WRITE_MEMORY, LOW_HIGH_ADDRESS(offset), p[0], }; BYTE echo[1]; size_t i; struct transaction_log tfirst[] = { TRXN_START, TRXN_WR_CRC16(buf, 4, 0), TRXN_READ1(echo), TRXN_COMPARE(echo, p, 1), TRXN_END, }; struct transaction_log trest[] = { // note no TRXN_START TRXN_WRITE1(buf), TRXN_READ2(&buf[1]), TRXN_READ1(echo), TRXN_END, }; //printf("2450 W mem size=%d location=%d\n",size,location) ; if (size == 0) { return gbGOOD; } /* Send the first byte (handled differently) */ RETURN_BAD_IF_BAD(BUS_transaction(tfirst, pn)) ; /* rest of the bytes */ for (i = 1; i < size; ++i) { buf[0] = p[i]; RETURN_BAD_IF_BAD( BUS_transaction(trest, pn) ) ; if ( CRC16seeded(buf, 3, offset + i) || (echo[0] != p[i]) ) { return gbBAD; } } return gbGOOD; } /* Read A/D from 2450 */ /* range adjustment made elsewhere */ static GOOD_OR_BAD OW_volts(_FLOAT * V, struct parsedname *pn) { BYTE data[_1W_2450_PAGESIZE]; // read data RETURN_BAD_IF_BAD( OW_r_mem(data, _1W_2450_PAGESIZE, _ADDRESS_CONVERSION_PAGE, pn) ) ; // data conversions V[0] = 7.8126192E-5 * ((((UINT) data[1]) << 8) | data[0]); V[1] = 7.8126192E-5 * ((((UINT) data[3]) << 8) | data[2]); V[2] = 7.8126192E-5 * ((((UINT) data[5]) << 8) | data[4]); V[3] = 7.8126192E-5 * ((((UINT) data[7]) << 8) | data[6]); return gbGOOD; } /* send A/D conversion command */ static GOOD_OR_BAD OW_convert( int simul_good, int delay, struct parsedname *pn) { BYTE convert[] = { _1W_CONVERT, 0x0F, 0x00, 0xFF, 0xFF, }; struct transaction_log tpower[] = { TRXN_START, TRXN_WR_CRC16(convert, 3, 0), TRXN_END, }; struct transaction_log tdead[] = { TRXN_START, TRXN_WRITE3(convert), TRXN_READ1(&convert[3]), TRXN_POWER( &convert[4], delay ) , TRXN_CRC16(convert, 5), TRXN_END, }; /* See if a conversion was globally triggered */ if ( GOOD(OW_get_power(pn) ) ) { if ( simul_good ) { return FS_Test_Simultaneous( simul_volt, delay, pn) ; } // Start conversion // 6 msec for 16bytex4channel (5.2) RETURN_BAD_IF_BAD(BUS_transaction(tpower, pn)); UT_delay(delay); /* don't need to hold line for conversion! */ } else { // Start conversion // 6 msec for 16bytex4channel (5.2) RETURN_BAD_IF_BAD(BUS_transaction(tdead, pn)) ; } return gbGOOD; } /* read a pio register */ static GOOD_OR_BAD OW_r_pio(int *pio, struct parsedname *pn) { BYTE p[1]; // 2 bytes per register RETURN_BAD_IF_BAD( OW_r_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension, pn) ) ; pio[0] = ((p[0] & (_1W_2450_OC|_1W_2450_OE)) != _1W_2450_OE); return gbGOOD; } /* Write a pio register */ static GOOD_OR_BAD OW_w_pio( int pio, struct parsedname *pn) { BYTE p[1]; RETURN_BAD_IF_BAD( OW_r_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension, pn) ) ; p[0] |= _1W_2450_OE | _1W_2450_OC ; if ( pio==0 ) { p[0] &= ~_1W_2450_OC ; } return OW_w_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension, pn); } static GOOD_OR_BAD OW_r_vset(_FLOAT * V, enum V_alarm_level ae, struct parsedname *pn) { BYTE p[2]; RETURN_BAD_IF_BAD( OW_r_mem(p, 2, _ADDRESS_ALARM_PAGE + 2 * pn->extension, pn) ) ; switch ( ae ) { case V2_ae_high: V[0] = .01 * p[1]; break ; case V2_ae_low: V[0] = .01 * p[0]; break ; case V5_ae_high: V[0] = .02 * p[1]; break ; case V5_ae_low: V[0] = .02 * p[0]; break ; } return gbGOOD; } static GOOD_OR_BAD OW_w_vset( _FLOAT V, enum V_alarm_level ae, struct parsedname *pn) { BYTE p[_1W_2450_PAGESIZE]; RETURN_BAD_IF_BAD( OW_r_mem(p, 2, _ADDRESS_ALARM_PAGE + 2 * pn->extension, pn) ) ; switch ( ae ) { case V2_ae_high: p[1] = 100. * V ; break ; case V2_ae_low: p[0] = 100. * V ; break ; case V5_ae_high: p[1] = 50. * V ; break ; case V5_ae_low: p[0] = 50. * V ; break ; } return OW_w_mem(p, 2, _ADDRESS_ALARM_PAGE + 2 * pn->extension, pn) ; } static GOOD_OR_BAD OW_r_enable(int *y, enum alarm_level ae, struct parsedname *pn) { switch ( ae ) { case ae_low: return OW_r_mask( y, _1W_2450_AEL, pn ) ; case ae_high: return OW_r_mask( y, _1W_2450_AEH, pn ); default: return gbBAD ; } } static GOOD_OR_BAD OW_w_enable( int y, enum alarm_level ae, struct parsedname *pn) { switch ( ae ) { case ae_low: return OW_w_mask( y, _1W_2450_AEL, pn ); case ae_high: return OW_w_mask( y, _1W_2450_AEH, pn ); default: return gbBAD ; } } static GOOD_OR_BAD OW_r_flag(int *y, enum alarm_level ae, struct parsedname *pn) { switch ( ae ) { case ae_low: return OW_r_mask( y, _1W_2450_AFL, pn ) ; case ae_high: return OW_r_mask( y, _1W_2450_AFH, pn ); default: return gbBAD ; } } static GOOD_OR_BAD OW_r_mask(int *y, BYTE mask, struct parsedname *pn) { BYTE p[1]; RETURN_BAD_IF_BAD( OW_r_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension + 1, pn) ) ; y[0] = (p[0] & mask) ? 1 : 0 ; return gbGOOD; } static GOOD_OR_BAD OW_w_mask( int y, BYTE mask, struct parsedname *pn) { BYTE p[1]; RETURN_BAD_IF_BAD( OW_r_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension + 1, pn) ) ; if ( y ) { p[0] |= mask ; } else { p[0] &= ~mask ; } // Clear POR as well p[0] &= ~_1W_2450_POR ; return OW_w_mem(p, 1, _ADDRESS_CONTROL_PAGE + 2 * pn->extension + 1, pn) ; } static GOOD_OR_BAD OW_w_flag( int y, enum alarm_level ae, struct parsedname *pn) { switch ( ae ) { case ae_low: return OW_w_mask( y, _1W_2450_AFL, pn ); case ae_high: return OW_w_mask( y, _1W_2450_AFH, pn ); default: return gbBAD ; } } // Always clear static GOOD_OR_BAD OW_w_por( int por, struct parsedname *pn) { // use a NOP mask, since OW_w_mask always clears POR (void) por ; return OW_w_mask( 1, 0x00, pn ) ; } /* Functions for the CO2 sensor */ static ZERO_OR_ERROR FS_CO2_power( struct one_wire_query *owq) { _FLOAT P = 0. ; ZERO_OR_ERROR z_or_e = FS_r_sibling_F(&P,"volt.D",owq) ; OWQ_F(owq) = P ; return z_or_e ; } static ZERO_OR_ERROR FS_CO2_ppm( struct one_wire_query *owq) { _FLOAT P = 0. ; ZERO_OR_ERROR z_or_e = FS_r_sibling_F(&P,"volt.A",owq) ; OWQ_U(owq) = P*1000. ; return z_or_e ; } static ZERO_OR_ERROR FS_CO2_status( struct one_wire_query *owq) { _FLOAT V = 0.; ZERO_OR_ERROR z_or_e = FS_r_sibling_F(&V,"volt.B",owq) ; OWQ_Y(owq) = (V>3.0) && (V<3.4) ; return z_or_e ; } static GOOD_OR_BAD OW_set_resolution( int resolution, struct parsedname * pn ) { int stored_resolution ; /* Resolution */ if ( BAD( Cache_Get_SlaveSpecific(&stored_resolution, sizeof(stored_resolution), SlaveSpecificTag(RES), pn)) || stored_resolution != resolution) { // need to set resolution BYTE p[_1W_2450_PAGESIZE]; RETURN_BAD_IF_BAD( OW_r_mem(p, _1W_2450_PAGESIZE, _ADDRESS_CONTROL_PAGE, pn) ) ; p[_1W_2450_REG_A] &= ~_1W_2450_RC_MASK ; p[_1W_2450_REG_A] |= ( resolution & _1W_2450_RC_MASK ) ; p[_1W_2450_REG_B] &= ~_1W_2450_RC_MASK ; p[_1W_2450_REG_B] |= ( resolution & _1W_2450_RC_MASK ) ; p[_1W_2450_REG_C] &= ~_1W_2450_RC_MASK ; p[_1W_2450_REG_C] |= ( resolution & _1W_2450_RC_MASK ) ; p[_1W_2450_REG_D] &= ~_1W_2450_RC_MASK ; p[_1W_2450_REG_D] |= ( resolution & _1W_2450_RC_MASK ) ; RETURN_BAD_IF_BAD( OW_w_mem(p, _1W_2450_PAGESIZE, _ADDRESS_CONTROL_PAGE, pn) ); return Cache_Add_SlaveSpecific(&resolution, sizeof(int), SlaveSpecificTag(RES), pn); } return gbGOOD ; } // range is 5=5V or 2=2.5V static GOOD_OR_BAD OW_set_range( int range, struct parsedname * pn ) { int stored_range ; /* Range */ if ( BAD( Cache_Get_SlaveSpecific(&stored_range, sizeof(stored_range), SlaveSpecificTag(RAN), pn)) || stored_range != range) { // need to set resolution BYTE p[_1W_2450_PAGESIZE]; RETURN_BAD_IF_BAD( OW_r_mem(p, _1W_2450_PAGESIZE, _ADDRESS_CONTROL_PAGE, pn) ) ; switch ( range ) { case 2: p[_1W_2450_REG_A+1] &= ~_1W_2450_IR ; p[_1W_2450_REG_B+1] &= ~_1W_2450_IR ; p[_1W_2450_REG_C+1] &= ~_1W_2450_IR ; p[_1W_2450_REG_D+1] &= ~_1W_2450_IR ; break ; case 5: default: p[_1W_2450_REG_A+1] |= _1W_2450_IR ; p[_1W_2450_REG_B+1] |= _1W_2450_IR ; p[_1W_2450_REG_C+1] |= _1W_2450_IR ; p[_1W_2450_REG_D+1] |= _1W_2450_IR ; break ; } RETURN_BAD_IF_BAD( OW_w_mem(p, _1W_2450_PAGESIZE, _ADDRESS_CONTROL_PAGE, pn) ); return Cache_Add_SlaveSpecific(&range, sizeof(int), SlaveSpecificTag(RAN), pn); } return gbGOOD ; } // good if powered. static GOOD_OR_BAD OW_get_power( struct parsedname * pn ) { int power ; /* power */ if ( BAD( Cache_Get_SlaveSpecific(&power, sizeof(power), SlaveSpecificTag(POW), pn)) ) { BYTE p[1]; /* get power flag -- to see if pullup can be avoided */ RETURN_BAD_IF_BAD( OW_r_mem(p, 1, _ADDRESS_POWERED, pn) ) ; power = (p[1]==_1W_2450_POWERED) ? 1 : 0 ; Cache_Add_SlaveSpecific(&power, sizeof(power), SlaveSpecificTag(POW), pn); } return power==1 ? gbGOOD : gbBAD ; } owfs-2.8p15/module/owlib/src/c/ow_set_telnet.c0000664000175000017500000000777111511235553016260 00000000000000/* $Id: ow_set_telnet.c,v 1.9 2011/01/06 03:47:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "telnet.h" GOOD_OR_BAD telnet_change(struct connection_in *in) { #pragma pack(push) /* Save current */ #pragma pack(1) /* byte alignment */ struct { BYTE do_sga[3] ; BYTE do_echo[3] ; BYTE i_will[3] ; BYTE you_do[3] ; BYTE pre_baud[4] ; uint32_t baud ; BYTE post_baud[2] ; BYTE pre_size[4] ; BYTE size ; BYTE post_size[2] ; BYTE pre_parity[4] ; BYTE parity ; BYTE post_parity[2] ; BYTE pre_stop[4] ; BYTE stop ; BYTE post_stop[2] ; BYTE pre_flow[4] ; BYTE flow ; BYTE post_flow[2] ; } telnet_string = { .do_sga = { TELNET_IAC, TELNET_DO, TELOPT_SGA, } , .do_echo = { TELNET_IAC, TELNET_DO, TELOPT_ECHO, } , .i_will = { TELNET_IAC, TELNET_WILL, TELOPT_COM_PORT, } , .you_do = { TELNET_IAC, TELNET_DO, TELOPT_COM_PORT, } , .pre_baud = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_BAUDRATE, } , .post_baud = {TELNET_IAC, TELNET_SE, } , .pre_size = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_DATASIZE, } , .post_size = {TELNET_IAC, TELNET_SE, } , .pre_parity = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_PARITY, } , .post_parity = {TELNET_IAC, TELNET_SE, } , .pre_stop = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_STOPSIZE, } , .post_stop = {TELNET_IAC, TELNET_SE, } , .pre_flow = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_CONTROL, } , .post_flow = {TELNET_IAC, TELNET_SE, } , } ; #pragma pack(pop) /* restore */ switch ( SOC(in)->baud ) { case B115200: telnet_string.baud = htonl( 115200 ) ; break ; case B57600: telnet_string.baud = htonl( 57600 ) ; break ; case B19200: telnet_string.baud = htonl( 19200 ) ; break ; case B9600: default: telnet_string.baud = htonl( 9600 ) ; SOC(in)->baud = B9600 ; break ; } telnet_string.size = SOC(in)->bits ; switch ( SOC(in)->parity ) { case parity_none: telnet_string.parity = 1 ; break ; case parity_odd: telnet_string.parity = 2 ; break ; case parity_even: telnet_string.parity = 3 ; break ; case parity_mark: telnet_string.parity = 4 ; break ; } switch ( SOC(in)->stop ) { case stop_1 : telnet_string.stop = 1 ; break ; case stop_2 : telnet_string.stop = 2 ; break ; case stop_15 : telnet_string.stop = 3 ; break ; } switch ( SOC(in)->flow ) { case flow_none : telnet_string.flow = 1 ; break ; case flow_soft : telnet_string.flow = 2 ; break ; case flow_hard : telnet_string.flow = 3 ; break ; } return COM_write_simple( (const BYTE *) &telnet_string, sizeof( telnet_string ) , in ) ; } GOOD_OR_BAD telnet_purge(struct connection_in *in) { #pragma pack(push) /* Save current */ #pragma pack(1) /* byte alignment */ struct { BYTE pre_purge[4] ; BYTE purge ; BYTE post_purge[2] ; } telnet_string = { .pre_purge = { TELNET_IAC, TELNET_SB, TELOPT_COM_PORT, COMOPT_PURGE, } , .post_purge = {TELNET_IAC, TELNET_SE, } , } ; #pragma pack(pop) /* restore */ /* * Purge both the access server receive data * buffer and the access server transmit data * buffer * See: http://www.ietf.org/rfc/rfc2217.txt * */ telnet_string.purge = 0x03 ; return COM_write_simple( (const BYTE *) &telnet_string, sizeof( telnet_string ) , in ) ; } GOOD_OR_BAD telnet_break(struct connection_in *in) { #pragma pack(push) /* Save current */ #pragma pack(1) /* byte alignment */ struct { BYTE send_break[2]; } telnet_string = { .send_break = { TELNET_IAC, TELNET_BREAK, } , } ; #pragma pack(pop) /* restore */ /* * See: http://www.ietf.org/rfc/rfc2217.txt * */ return COM_write_simple( (const BYTE *) &telnet_string, sizeof( telnet_string ) , in ) ; } owfs-2.8p15/module/owlib/src/c/ow_charblob.c0000664000175000017500000000566011447014637015667 00000000000000/* $Id: ow_charblob.c,v 1.9 2010/09/24 03:23:11 alfille Exp $ OW -- One-Wire filesystem version 0.4 7/2/2003 Function naming scheme: OW -- Generic call to interaface FS -- filesystem commands UT -- utility functions Written 2003 Paul H Alfille Fuse code based on "fusexmp" {GPL} by Miklos Szeredi, mszeredi@inf.bme.hu Serial code based on "xt" {GPL} by David Querbach, www.realtime.bc.ca in turn based on "miniterm" by Sven Goldt, goldt@math.tu.berlin.de GPL license This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Other portions based on Dallas Semiconductor Public Domain Kit, --------------------------------------------------------------------------- Implementation: 2006 dirblob */ #include #include "owfs_config.h" #include "ow.h" /* A "charblob" is a structure holding a list of files Most interesting, it allocates memory dynamically. */ void CharblobClear(struct charblob *cb) { SAFEFREE(cb->blob) ; cb->blob = NO_CHARBLOB ; CharblobInit(cb); } void CharblobInit(struct charblob *cb) { cb->used = 0; cb->allocated = 0; cb->blob = NO_CHARBLOB; cb->troubled = 0; } int CharblobPure(struct charblob *cb) { return !cb->troubled; } int CharblobAdd(const ASCII * a, size_t s, struct charblob *cb) { size_t incr = 1024; if (incr < s) { incr = s; } // make more room? -- blocks of 1k if (cb->used) { CharblobAddChar(',', cb); // add a comma } if (cb->used + s > cb->allocated) { int newalloc = cb->allocated + incr; ASCII *temp = owrealloc(cb->blob, newalloc); if (temp != NULL) { memset(&temp[cb->allocated], 0, incr); // set the new memory to blank cb->allocated = newalloc; cb->blob = temp; } else { // allocation failed -- keep old cb->troubled = 1; return -ENOMEM; } } memcpy(&cb->blob[cb->used], a, s); cb->used += s; return 0; } int CharblobAddChar(const ASCII a, struct charblob *cb) { // make more room? -- blocks of 1k if (cb->used + 1 > cb->allocated) { int newalloc = cb->allocated + 1024; ASCII *temp = owrealloc(cb->blob, newalloc); if (temp != NULL) { memset(&temp[cb->allocated], 0, 1024); // set the new memory to blank cb->allocated = newalloc; cb->blob = temp; } else { // allocation failed -- keep old cb->troubled = 1; return -ENOMEM; } } cb->blob[cb->used] = a; ++cb->used; return 0; } size_t CharblobLength( struct charblob * cb ) { return cb->used ; } ASCII * CharblobData(struct charblob * cb) { return cb->blob ; } owfs-2.8p15/module/owlib/src/c/ow_date.c0000664000175000017500000000143411407032307015011 00000000000000/* $Id: ow_date.c,v 1.2 2010/06/19 03:08:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" /* Uses udate to read and write date */ ZERO_OR_ERROR COMMON_r_date( struct one_wire_query * owq ) { UINT U ; ZERO_OR_ERROR read_sibling = FS_r_sibling_U( &U, PN(owq)->selected_filetype->data.a, owq ) ; OWQ_D(owq) = (_DATE) U ; return read_sibling ; } ZERO_OR_ERROR COMMON_w_date( struct one_wire_query * owq ) { UINT U = (UINT) OWQ_D(owq) ; return FS_w_sibling_U( U, PN(owq)->selected_filetype->data.a, owq) ; } owfs-2.8p15/module/owlib/src/c/ow_1954.c0000644000175000017500000001576411740076517014522 00000000000000/* $Id: ow_1954.c,v 1.20 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ // DS1954 Cryptographics iButton // DS1957 ibutton // From datasheet in the web -- hard to find info #include #include "owfs_config.h" #include "ow_1954.h" /* ------- Prototypes ----------- */ /* DS1902 ibutton memory */ READ_FUNCTION(FS_r_ipr); WRITE_FUNCTION(FS_w_ipr); READ_FUNCTION(FS_r_io); WRITE_FUNCTION(FS_w_io); READ_FUNCTION(FS_r_status); WRITE_FUNCTION(FS_w_status); WRITE_FUNCTION(FS_reset); /* ------- Structures ----------- */ static struct filetype DS1954[] = { F_STANDARD, {"ipr", 128, NON_AGGREGATE, ft_binary, fc_volatile, FS_r_ipr, FS_w_ipr, VISIBLE, NO_FILETYPE_DATA, }, {"io_buffer", 8, NON_AGGREGATE, ft_binary, fc_volatile, FS_r_io, FS_w_io, VISIBLE, NO_FILETYPE_DATA, }, {"status", 4, NON_AGGREGATE, ft_binary, fc_volatile, FS_r_status, FS_w_status, VISIBLE, NO_FILETYPE_DATA, }, {"reset", 1, NON_AGGREGATE, ft_yesno, fc_volatile, NO_READ_FUNCTION, FS_reset, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(16, DS1954, DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_IPR 0x0F #define _1W_READ_IPR 0xAA #define _1W_WRITE_IO_BUFFER 0x2D #define _1W_READ_IO_BUFFER 0x22 #define _1W_START_PROGRAM 0x77 #define _1W_CONTINUE_PROGRAM 0x87 #define _1W_RESET_MICRO 0xDD #define _1W_WRITE_STATUS 0xD2 #define _1W_READ_STATUS 0xE1 #define _1W_WRITE_RELEASE_SEQUENCE 0x9D,0xB3 #define _1W_READ_RELEASE_SEQUENCE 0x62,0x4C #define _1W_START_RELEASE_SEQUENCE 0x6D,0x43 #define _1W_CONTINUE_RELEASE_SEQUENCE 0x5D,0x73 #define _1W_RESET_RELEASE_SEQUENCE 0x92,0xBC #define _1W_STATUS_RELEASE_SEQUENCE 0x51,0x7F /* ------- Functions ------------ */ /* DS1957 */ static GOOD_OR_BAD OW_w_ipr(size_t size, BYTE * data, struct parsedname * pn); static GOOD_OR_BAD OW_r_ipr(struct one_wire_query *owq); static GOOD_OR_BAD OW_w_io(struct one_wire_query *owq); static GOOD_OR_BAD OW_r_io(struct one_wire_query *owq); static GOOD_OR_BAD OW_w_status(struct one_wire_query *owq); static GOOD_OR_BAD OW_r_status(struct one_wire_query *owq); static GOOD_OR_BAD OW_reset(struct one_wire_query *owq); /* 1954 */ static ZERO_OR_ERROR FS_w_ipr(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_w_ipr(OWQ_size(owq), (BYTE*) OWQ_buffer(owq),PN(owq)) ) ; } static ZERO_OR_ERROR FS_r_ipr(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_ipr(owq)) ; } static ZERO_OR_ERROR FS_w_io(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_io(owq)) ; } static ZERO_OR_ERROR FS_r_io(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_io(owq)) ; } static ZERO_OR_ERROR FS_w_status(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_status(owq)) ; } static ZERO_OR_ERROR FS_r_status(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_status(owq)) ; } static ZERO_OR_ERROR FS_reset(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_reset(owq)) ; } static GOOD_OR_BAD OW_w_ipr(size_t size, BYTE * data, struct parsedname * pn) { BYTE p[2 + 128 + 2] = { _1W_WRITE_IPR, BYTE_MASK(size), }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 2 + size, 0), TRXN_END, }; memcpy(&p[2],data,size) ; return BUS_transaction(t, pn); }; /* Read all 128 bytes, then transfer over what's needed */ static GOOD_OR_BAD OW_r_ipr(struct one_wire_query *owq) { BYTE p[2 + 128 + 2] = { _1W_READ_IPR, 128, }; int size = OWQ_size(owq); struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 2, 128), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq))) ; if (size > 128) { size = 128; } memcpy(OWQ_buffer(owq), &p[2], size); OWQ_length(owq) = size; return gbGOOD; }; static GOOD_OR_BAD OW_w_status(struct one_wire_query *owq) { int size = OWQ_size(owq); BYTE p[1 + 1 + 2] = { _1W_WRITE_STATUS, BYTE_MASK(size), }; BYTE release[2] = { _1W_STATUS_RELEASE_SEQUENCE, }; BYTE zero[2] = { 0x00, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1, 1), TRXN_MODIFY(release, release, 2), TRXN_COMPARE(release, zero, 2), TRXN_END, }; return BUS_transaction(t, PN(owq)); }; static GOOD_OR_BAD OW_r_status(struct one_wire_query *owq) { BYTE p[1 + 4 + 2] = { _1W_READ_STATUS, }; int size = OWQ_size(owq); struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 1, 4), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq))); if (size > 4) { size = 4; } memcpy(OWQ_buffer(owq), &p[1], size); OWQ_length(owq) = size; return gbGOOD; }; static GOOD_OR_BAD OW_w_io(struct one_wire_query *owq) { int size = OWQ_size(owq); BYTE p[2 + 8 + 2] = { _1W_WRITE_IO_BUFFER, BYTE_MASK(size), }; BYTE release[2] = { _1W_WRITE_RELEASE_SEQUENCE, }; BYTE zero[2] = { 0x00, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 2 + size, 0), TRXN_MODIFY(release, release, 2), TRXN_COMPARE(release, zero, 2), TRXN_END, }; return BUS_transaction(t, PN(owq)); }; static GOOD_OR_BAD OW_r_io(struct one_wire_query *owq) { int size = OWQ_size(owq); BYTE p[2 + 8 + 2] = { _1W_READ_IO_BUFFER, BYTE_MASK(size), }; BYTE release[2] = { _1W_READ_RELEASE_SEQUENCE, }; BYTE zero[2] = { 0x00, 0x00, }; struct transaction_log t[] = { TRXN_START, TRXN_WR_CRC16(p, 2, size), TRXN_MODIFY(release, release, 2), TRXN_COMPARE(release, zero, 2), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq))) ; memcpy(OWQ_buffer(owq), &p[2], size); OWQ_length(owq) = size; return gbGOOD; }; static GOOD_OR_BAD OW_reset(struct one_wire_query *owq) { BYTE p[] = { _1W_RESET_MICRO, }; BYTE release[2] = { _1W_RESET_RELEASE_SEQUENCE, }; BYTE zero[2] = { 0x00, 0x00, }; BYTE testbit[1]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(p), TRXN_MODIFY(release, release, 2), TRXN_COMPARE(release, zero, 2), TRXN_READ1(testbit), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, PN(owq)) ) ; if ( testbit[0] & 0x80 ) { return gbBAD; } return gbGOOD; }; owfs-2.8p15/module/owlib/src/c/ow_read.c0000644000175000017500000005550011756247317015030 00000000000000/* $Id: ow_read.c,v 1.201 2012/05/20 20:06:39 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor $ID: $ */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ static SIZE_OR_ERROR FS_r_virtual(struct one_wire_query *owq); static SIZE_OR_ERROR FS_read_real(struct one_wire_query *owq); static SIZE_OR_ERROR FS_r_given_bus(struct one_wire_query *owq); static SIZE_OR_ERROR FS_r_local(struct one_wire_query *owq); static ZERO_OR_ERROR FS_read_owq(struct one_wire_query *owq); static ZERO_OR_ERROR FS_structure(struct one_wire_query *owq); static ZERO_OR_ERROR FS_read_all_bits(struct one_wire_query *owq_byte); static ZERO_OR_ERROR FS_read_a_bit( struct one_wire_query *owq_bit ); static SIZE_OR_ERROR FS_r_simultaneous(struct one_wire_query *owq) ; static void adjust_file_size(struct one_wire_query *owq) ; static SIZE_OR_ERROR FS_read_distribute(struct one_wire_query *owq) ; static ZERO_OR_ERROR FS_read_all( struct one_wire_query *owq_all ); static ZERO_OR_ERROR FS_read_a_part( struct one_wire_query *owq_part ); static ZERO_OR_ERROR FS_read_in_parts( struct one_wire_query *owq_all ); /* Change in strategy 6/2006: Now use CheckPresence as primary method of finding correct bus Can break down cases into: 1. bad ParsedName -- no read possible 2. structure -- read from 1st bus (local) 3. specified bus (picked up in ParsedName) -- use that 4. statistics, settings, Simultaneous, Thermostat -- use first or specified 5. real -- use caced, if error, delete cache entry and try twice more. */ /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ SIZE_OR_ERROR FS_read(const char *path, char *buf, const size_t size, const off_t offset) { SIZE_OR_ERROR read_or_error; OWQ_allocate_struct_and_pointer(owq); LEVEL_CALL("path=%s size=%d offset=%d", SAFESTRING(path), (int) size, (int) offset); // Parseable path? if ( BAD( OWQ_create(path, owq) ) ) { // for read return -ENOENT; } OWQ_assign_read_buffer( buf, size, offset, owq) ; read_or_error = FS_read_postparse(owq); OWQ_destroy(owq); return read_or_error; } /* After parsing, but before sending to various devices. Will repeat 3 times if needed */ SIZE_OR_ERROR FS_read_postparse(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); SIZE_OR_ERROR read_or_error; // ServerRead jumps in here, perhaps with non-file entry if (pn->selected_device == NO_DEVICE || pn->selected_filetype == NO_FILETYPE) { return -EISDIR; } /* Normal read. Try three times */ LEVEL_DEBUG("%s", pn->path); STATLOCK; AVERAGE_IN(&read_avg); AVERAGE_IN(&all_avg); STATUNLOCK; /* First try */ STAT_ADD1(read_tries[0]); read_or_error = (pn->type == ePN_real) ? FS_read_real(owq) : FS_r_virtual(owq); STATLOCK; if (read_or_error >= 0) { ++read_success; /* statistics */ read_bytes += read_or_error; /* statistics */ } AVERAGE_OUT(&read_avg); AVERAGE_OUT(&all_avg); STATUNLOCK; LEVEL_DEBUG("%s return %d", pn->path, read_or_error); return read_or_error; } /* Read real device (Non-virtual). Will repeat 3 times if needed */ static SIZE_OR_ERROR FS_read_real(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); SIZE_OR_ERROR read_or_error; /* First try */ /* in and bus_nr already set */ read_or_error = FS_read_distribute(owq); /* Second Try */ /* if not a specified bus, relook for chip location */ if (read_or_error < 0) { //error STAT_ADD1(read_tries[1]); if (SpecifiedBus(pn)) { // this bus or bust! if ( BAD(TestConnection(pn)) ) { read_or_error = -ECONNABORTED; } else { read_or_error = FS_read_distribute(owq); // 2nd try if (read_or_error < 0) { // third try STAT_ADD1(read_tries[2]); read_or_error = FS_read_distribute(owq); } } } else if (BusIsServer(pn->selected_connection)) { int bus_nr = pn->selected_connection->index ; // current selected bus INDEX_OR_ERROR busloc_or_error = ReCheckPresence(pn) ; // special handling or remote // only repeat if the bus number is wrong // because the remote does the rereads if ( bus_nr != busloc_or_error ) { if (busloc_or_error < 0) { read_or_error = -ENOENT; } else { read_or_error = FS_read_distribute(owq); if (read_or_error < 0) { // third try STAT_ADD1(read_tries[2]); read_or_error = FS_read_distribute(owq); } } } } else { INDEX_OR_ERROR busloc_or_error = ReCheckPresence(pn); // search again if (busloc_or_error < 0) { read_or_error = -ENOENT; } else { read_or_error = FS_read_distribute(owq); if (read_or_error < 0) { // third try STAT_ADD1(read_tries[2]); read_or_error = FS_read_distribute(owq); } } } } return read_or_error; } // This function probably needs to be modified a bit... static SIZE_OR_ERROR FS_r_simultaneous(struct one_wire_query *owq) { // Device not locked. OWQ_allocate_struct_and_pointer(owq_given); if (SpecifiedBus(PN(owq))) { return FS_r_given_bus(owq); } memcpy(owq_given, owq, sizeof(struct one_wire_query)); // shallow copy // it's hard to know what we should return when reading /simultaneous/temperature SetKnownBus(0, PN(owq_given)); return FS_r_given_bus(owq_given); } /* Note on return values */ /* functions return the actual number of bytes read, */ /* or a negative value if an error */ /* negative values are of the form -EINVAL, etc */ /* the negative of a system errno */ /* Note on size and offset: */ /* Buffer length (and requested data) is size bytes */ /* reading should start after offset bytes in original data */ /* only date, binary, and ascii data support offset in single data points */ /* only binary supports offset in array data */ /* size and offset are vetted against specification data size and calls */ /* outside of this module will not have buffer overflows */ /* I.e. the rest of owlib can trust size and buffer to be legal */ /* After parsing, choose special read based on path type */ static SIZE_OR_ERROR FS_read_distribute(struct one_wire_query *owq) { // Device not locked SIZE_OR_ERROR read_or_error = 0; LEVEL_DEBUG("%s", PN(owq)->path); STATLOCK; AVERAGE_IN(&read_avg); AVERAGE_IN(&all_avg); STATUNLOCK; /* handle DeviceSimultaneous */ if (PN(owq)->selected_device == DeviceSimultaneous) { read_or_error = FS_r_simultaneous(owq); } else { read_or_error = FS_r_given_bus(owq); } STATLOCK; if (read_or_error >= 0) { ++read_success; /* statistics */ read_bytes += read_or_error; /* statistics */ } AVERAGE_OUT(&read_avg); AVERAGE_OUT(&all_avg); STATUNLOCK; LEVEL_DEBUG("%s returns %d", PN(owq)->path, read_or_error); //printf("FS_read_distribute: pid=%ld return %d\n", pthread_self(), read_or_error); return read_or_error; } // This function should return number of bytes read... not status. static SIZE_OR_ERROR FS_r_given_bus(struct one_wire_query *owq) { // Device locking occurs here struct parsedname *pn = PN(owq); SIZE_OR_ERROR read_or_error = 0; LEVEL_DEBUG("About to read <%s> extension=%d size=%d offset=%d",SAFESTRING(pn->path),(int) pn->extension,(int) OWQ_size(owq),(int) OWQ_offset(owq)); if (KnownBus(pn) && BusIsServer(pn->selected_connection)) { /* The bus is not local... use a network connection instead */ #if OW_MT LEVEL_DEBUG("pid=%ld call ServerRead", pthread_self()); #endif /* OW_MT */ // Read afar -- returns already formatted in buffer read_or_error = ServerRead(owq); LEVEL_DEBUG("back from server"); //printf("FS_r_given_bus pid=%ld r=%d\n",pthread_self(), read_or_error); } else { STAT_ADD1(read_calls); /* statistics */ if (DeviceLockGet(pn) == 0) { read_or_error = FS_r_local(owq); // this returns status DeviceLockRelease(pn); LEVEL_DEBUG("return=%d", read_or_error); if (read_or_error >= 0) { // local success -- now format in buffer read_or_error = OWQ_parse_output(owq); // this returns nr. bytes } } else { LEVEL_DEBUG("Cannot lock bus to perform read") ; read_or_error = -EADDRINUSE; } } LEVEL_DEBUG("After read is performed (bytes or error %d)", read_or_error); Debug_OWQ(owq); return read_or_error; } // This function should return number of bytes read... not status. // Works for all the virtual directories, like statistics, interface, ... // Doesn't need three-peat and bus was already set or not needed. static SIZE_OR_ERROR FS_r_virtual(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); SIZE_OR_ERROR read_status = 0; if (SpecifiedRemoteBus(pn)) { /* The bus is not local... use a network connection instead */ // Read afar -- returns already formatted in buffer read_status = ServerRead(owq); LEVEL_DEBUG("back from server"); Debug_OWQ(owq); } else { /* local bus -- any special locking needs? */ STAT_ADD1(read_calls); /* statistics */ switch (pn->type) { case ePN_structure: read_status = FS_structure(owq); break; case ePN_interface: BUSLOCK(pn); read_status = FS_r_local(owq); // this returns status BUSUNLOCK(pn); break; case ePN_statistics: // reading /statistics/read/tries.ALL // will cause a deadlock since it calls STAT_ADD1(read_array); // Should perhaps create a new mutex for this. // Comment out this STATLOCK until it's solved. // STATLOCK now done at time of actual read in ow_stats.c read_status = FS_r_local(owq); // this returns status break; default: read_status = FS_r_local(owq); // this returns status } if (read_status >= 0) { // local success -- now format in buffer read_status = OWQ_parse_output(owq); // this returns nr. bytes } } LEVEL_DEBUG("return %d", read_status); return read_status; } /* Adjusts size so that size+offset do not point past end of real file length*/ /* If offset is too large, size is set to 0 */ static void adjust_file_size(struct one_wire_query *owq) { size_t file_length = 0; /* Adjust file length -- especially important for fuse which uses 4k buffers */ /* First file filelength */ file_length = FullFileLength(PN(owq)); /* next adjust for offset */ if ((unsigned long) OWQ_offset(owq) >= (unsigned long) file_length) { // This check is done in OWQ_parse_output() too, since it's always called when this function OWQ_size(owq) = 0 ; // this is status ok... but 0 bytes were read... } else if ( OWQ_size(owq) + OWQ_offset(owq) > file_length ) { // Finally adjust buffer length OWQ_size(owq) = file_length - OWQ_offset(owq) ; } LEVEL_DEBUG("file_length=%lu offset=%lu size=%lu", (unsigned long) file_length, (unsigned long) OWQ_offset(owq), (unsigned long) OWQ_size(owq)); } /* Real read -- called from read Integrates with cache -- read not called if cached value already set */ static SIZE_OR_ERROR FS_r_local(struct one_wire_query *owq) { // Bus and device already locked struct parsedname *pn = PN(owq); struct filetype * ft = pn->selected_filetype ; /* Readable? */ if (ft->read == NO_READ_FUNCTION) { return -ENOTSUP; } // Check buffer length adjust_file_size(owq) ; if ( OWQ_size(owq) == 0 ) { // Mounting fuse with "direct_io" will cause a second read with offset // at end-of-file... Just return 0 if offset == size LEVEL_DEBUG("Call for read at very end of file") ; return 0 ; } // Special check for alias -- it's ok for fake and tester and mock as well if ( ft->read == FS_r_alias ) { return FS_read_owq(owq) ; } if (ft->change != fc_static && ft->format != ft_alias && IsRealDir(pn)) { switch (pn->selected_connection->Adapter) { case adapter_fake: /* Special case for "fake" adapter */ return FS_read_fake(owq); case adapter_tester: /* Special case for "tester" adapter */ return FS_read_tester(owq); case adapter_mock: /* Special case for "mock" adapter */ if ( GOOD( OWQ_Cache_Get(owq)) ) { // cached return 0; } return FS_read_fake(owq); default: break ; } } if ( ft->ag == NON_AGGREGATE ) { /* non array property */ return FS_read_owq(owq) ; } /* Array property * Read separately? * Read together and manually separate? */ /* array */ switch ( ft->ag->combined ) { case ag_sparse: // skip cache test and storing return (ft->read) (owq); case ag_aggregate: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Read an aggregate .BYTE %s",pn->path); return FS_read_owq(owq); case EXTENSION_ALL: LEVEL_DEBUG("Read an aggregate .ALL %s",pn->path); return FS_read_all(owq); default: LEVEL_DEBUG("Read an aggregate element %s",pn->path); return FS_read_a_part(owq); } case ag_mixed: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Read a mixed .BYTE %s",pn->path); OWQ_Cache_Del_parts(owq); return FS_read_owq(owq); case EXTENSION_ALL: LEVEL_DEBUG("Read a mixed .ALL %s",pn->path); OWQ_Cache_Del_parts(owq); return FS_read_all(owq); default: LEVEL_DEBUG("Read a mixed element %s",pn->path); OWQ_Cache_Del_ALL(owq); OWQ_Cache_Del_BYTE(owq); return FS_read_owq(owq); } case ag_separate: switch (pn->extension) { case EXTENSION_BYTE: LEVEL_DEBUG("Read a separate .BYTE %s",pn->path); return FS_read_all_bits(owq); case EXTENSION_ALL: LEVEL_DEBUG("Read a separate .ALL %s",pn->path); return FS_read_in_parts(owq); default: LEVEL_DEBUG("Read a separate element %s",pn->path); return FS_read_owq(owq); } default: return -ENOENT ; } } /* Structure file */ static ZERO_OR_ERROR FS_structure(struct one_wire_query *owq) { char structure_text[PROPERTY_LENGTH_STRUCTURE+1] ; int output_length; struct parsedname * pn = PN(owq) ; struct filetype * ftype = pn->selected_filetype ; char format_char ; char change_char ; int index_num ; int elements_num ; // TEMPORARY change type from structure->real to get real length rhather than structure length pn->type = ePN_real; /* "real" type to get return length, rather than "structure" length */ // Set property type switch ( ftype->format ) { case ft_directory: case ft_subdir: format_char = 'D' ; break ; case ft_integer: format_char = 'i' ; break ; case ft_unsigned: format_char = 'u' ; break ; case ft_float: format_char = 'f' ; break ; case ft_alias: format_char = 'l' ; break ; case ft_ascii: case ft_vascii: format_char = 'a' ; break ; case ft_binary: format_char = 'b' ; break ; case ft_yesno: case ft_bitfield: format_char = 'y' ; break ; case ft_date: format_char = 'd' ; break ; case ft_temperature: format_char = 't' ; break ; case ft_tempgap: format_char = 'g' ; break ; case ft_pressure: format_char = 'p' ; break ; case ft_unknown: default: format_char = '?' ; break ; } // Set index index_num = (ftype->ag) ? pn->extension : 0 ; // Set elements if ( ftype-> ag ) { // array if ( ftype -> ag -> combined == ag_sparse) { if ( ftype -> ag -> letters == ag_letters) { elements_num = -1 ; } else { // numbered elements_num = 0 ; } } else { // non sparse elements_num = ftype->ag->elements ; } } else { // scallar elements_num = 1 ; } // Set changability switch ( ftype->change ) { case fc_static: case fc_subdir: case fc_directory: change_char = 'f' ; break ; case fc_stable: case fc_persistent: change_char = 's' ; break ; case fc_volatile: case fc_read_stable: case fc_simultaneous_temperature: case fc_simultaneous_voltage: case fc_uncached: case fc_statistic: case fc_presence: case fc_link: case fc_page: change_char = 'v' ; break ; case fc_second: default: change_char = 't' ; break ; } UCLIBCLOCK; output_length = snprintf(structure_text, PROPERTY_LENGTH_STRUCTURE+1, "%c,%.6d,%.6d,%.2s,%.6d,%c,", format_char, index_num , elements_num, (ftype->read == NO_READ_FUNCTION) ? ((ftype->write == NO_WRITE_FUNCTION) ? "oo" : "wo") : ((ftype->write == NO_WRITE_FUNCTION) ? "ro" : "rw"), (int) FullFileLength(PN(owq)), change_char ); UCLIBCUNLOCK; LEVEL_DEBUG("length=%d", output_length); // TEMPORARY restore type from real to structure pn->type = ePN_structure; if (output_length < 0) { LEVEL_DEBUG("Problem formatting structure string"); return -EFAULT; } if ( output_length > PROPERTY_LENGTH_STRUCTURE ) { LEVEL_DEBUG("Structure string too long"); return -EINVAL ; } return OWQ_format_output_offset_and_size(structure_text,output_length,owq); } /* read without artificial separation or combination */ // Handles: ALL static ZERO_OR_ERROR FS_read_all( struct one_wire_query *owq_all) { struct parsedname * pn = PN(owq_all) ; // bitfield, convert to .BYTE format and write ( and delete cache ) as BYTE. if ( pn->selected_filetype->format == ft_bitfield ) { struct one_wire_query * owq_byte = OWQ_create_separate( EXTENSION_BYTE, owq_all ) ; int ret = -EINVAL ; if ( owq_byte != NO_ONE_WIRE_QUERY ) { if ( FS_read_owq( owq_byte ) >= 0 ) { size_t elements = pn->selected_filetype->ag->elements; size_t extension; for ( extension=0 ; extension < elements ; ++extension ) { OWQ_array_Y(owq_all,extension) = UT_getbit( (BYTE *) &OWQ_U(owq_byte), extension ) ; } ret = 0 ; } OWQ_destroy( owq_byte ) ; } return ret ; } return FS_read_owq( owq_all ) ; } /* read in native format */ /* ALL for aggregate * .n for separate * BYTE bitfield * */ static ZERO_OR_ERROR FS_read_owq(struct one_wire_query *owq) { // Bus and device already locked if ( BAD( OWQ_Cache_Get(owq)) ) { // not found ZERO_OR_ERROR read_error = (OWQ_pn(owq).selected_filetype->read) (owq); LEVEL_DEBUG("Read %s Extension %d Gives result %d",PN(owq)->path,PN(owq)->extension,read_error); if (read_error < 0) { return read_error; } OWQ_Cache_Add(owq); // Only add good attempts } else { LEVEL_DEBUG("Data obtained from cache") ; } return 0; } /* Read each array element independently, but return as one long string */ // Handles: ALL static ZERO_OR_ERROR FS_read_in_parts( struct one_wire_query *owq_all ) { struct parsedname *pn = PN(owq_all); struct filetype * ft = pn->selected_filetype ; struct one_wire_query * owq_part ; size_t elements = pn->selected_filetype->ag->elements; size_t extension; char * buffer_pointer = OWQ_buffer(owq_all) ; size_t buffer_left = OWQ_size(owq_all) ; // single for BYTE or iteration owq_part = OWQ_create_separate( 0, owq_all ) ; if ( owq_part == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } // bitfield if ( ft->format == ft_bitfield ) { OWQ_pn(owq_part).extension = EXTENSION_BYTE ; if ( FS_read_owq(owq_part) < 0 ) { OWQ_destroy( owq_part ) ; return -EINVAL ; } for (extension = 0; extension < elements; ++extension) { OWQ_array_Y(owq_all,extension) = UT_getbit( (BYTE *) &OWQ_U(owq_part), extension ) ; } OWQ_destroy( owq_part ) ; return 0 ; } if ( BAD( OWQ_allocate_read_buffer( owq_part )) ) { LEVEL_DEBUG("Can't allocate buffer space"); OWQ_destroy( owq_part ) ; return -EMSGSIZE ; } /* Loop through get data */ for (extension = 0; extension < elements; ++extension) { size_t part_length ; OWQ_pn(owq_part).extension = extension; if ( FS_read_owq(owq_part) < 0 ) { OWQ_destroy( owq_part ) ; return -EINVAL ; } // Check that there is enough space for the combined message switch ( ft->format ) { case ft_ascii: case ft_vascii: case ft_alias: case ft_binary: part_length = OWQ_length(owq_part) ; if ( buffer_left < part_length ) { OWQ_destroy( owq_part ) ; return -EMSGSIZE ; } memcpy( buffer_pointer, OWQ_buffer(owq_part), part_length ) ; OWQ_array_length(owq_all,extension) = part_length ; buffer_pointer += part_length ; buffer_left -= part_length ; break ; default: // copy object (single to mixed array) memcpy(&OWQ_array(owq_all)[extension], &OWQ_val(owq_part), sizeof(union value_object)); break; } } OWQ_destroy( owq_part ) ; return 0; } /* read a BYTE using bits */ // Handles: BYTE static ZERO_OR_ERROR FS_read_all_bits(struct one_wire_query *owq_byte) { struct one_wire_query * owq_bit = OWQ_create_separate( 0, owq_byte ) ; struct parsedname *pn = PN(owq_byte); size_t elements = pn->selected_filetype->ag->elements; size_t extension; if ( owq_bit == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } /* Loop through F_r_single, just to get data */ for (extension = 0; extension < elements; ++extension) { OWQ_pn(owq_bit).extension = extension ; if ( FS_read_owq(owq_bit) < 0 ) { OWQ_destroy(owq_bit); return -EINVAL; } UT_setbit( (BYTE *) &OWQ_U(owq_byte), extension, OWQ_Y(owq_bit) ) ; } OWQ_destroy(owq_bit); return 0; } /* read a bit from BYTE */ static ZERO_OR_ERROR FS_read_a_bit( struct one_wire_query *owq_bit ) { // Bus and device already locked struct one_wire_query * owq_byte = OWQ_create_separate( EXTENSION_BYTE, owq_bit ) ; struct parsedname *pn = PN(owq_bit); ZERO_OR_ERROR z_or_e = -ENOENT ; if ( owq_byte == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } /* read the UINT */ if ( FS_read_owq(owq_byte) >= 0) { OWQ_Y(owq_bit) = UT_getbit((void *) &OWQ_U(owq_byte), pn->extension) ; z_or_e = 0 ; } OWQ_destroy(owq_byte); return z_or_e; } /* Read just one field of an aggregate property -- but a property that is handled as one big object */ // Handles .n static ZERO_OR_ERROR FS_read_a_part( struct one_wire_query *owq_part ) { struct parsedname *pn = PN(owq_part); size_t extension = pn->extension; struct filetype * ft = pn->selected_filetype ; struct one_wire_query * owq_all ; // bitfield if ( ft->format == ft_bitfield ) { return FS_read_a_bit( owq_part ) ; } // non-bitfield owq_all = OWQ_create_aggregate( owq_part ) ; if ( owq_all == NO_ONE_WIRE_QUERY ) { return -ENOENT ; } // First fill the whole array with current values if ( FS_read_owq( owq_all ) < 0 ) { OWQ_destroy( owq_all ) ; return -EINVAL ; } // Copy ascii/binary field switch (ft->format) { case ft_binary: case ft_ascii: case ft_vascii: case ft_alias: { size_t extension_index; char *buffer_pointer = OWQ_buffer(owq_all); // All prior elements for (extension_index = 0; extension_index < extension; ++extension) { // move past their buffer position buffer_pointer += OWQ_array_length(owq_all, extension_index); } // now move current element's buffer to location OWQ_length(owq_part) = OWQ_array_length(owq_all, extension) ; memmove( OWQ_buffer(owq_part), buffer_pointer, OWQ_length(owq_part)); break; } default: // Copy value field memcpy( &OWQ_val(owq_part), &OWQ_array(owq_all)[pn->extension], sizeof(union value_object) ); break; } OWQ_destroy(owq_all); return 0 ; } /* Used in sibling reads Reads locally without locking the bus (since it's already locked) */ SIZE_OR_ERROR FS_read_local( struct one_wire_query *owq) { return FS_r_local(owq); } owfs-2.8p15/module/owlib/src/c/ow_link.c0000644000175000017500000006331611707143413015042 00000000000000/* $Id: ow_link.c,v 1.157 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" /* Telnet handling concepts from Jerry Scharf: You should request the number of bytes you expect. When you scan it, start looking for FF FA codes. If that shows up, see if the F0 is in the read buffer. If so, move the char pointer back to where the FF point was and ask for the rest of the string (expected - FF...F0 bytes.) If the F0 isn't in the read buffer, start reading byte by byte into a separate variable looking for F0. Once you find that, then do the move the pointer and read the rest piece as above. Finally, don't forget to scan the rest of the strings for more FF FA blocks. It's most sloppy when the FF is the last character of the initial read buffer... You can also scan and remove the patterns FF F1 - FF F9 as these are 2 byte commands that the transmitter can send at any time. It is also possible that you could see FF FB xx - FF FE xx 3 byte codes, but this would be in response to FF FA codes that you would send, so that seems unlikely. Handling these would be just the same as the FF FA codes above. */ /* Multimaster: * In general the link is NOT a multimaster design (only one bus master per serial or telnet port) * The LinkHubE is supposed to have separately addressable lines, but this is not implemented * None the less, all settings are assigned to the head line */ struct LINK_id { char verstring[36]; char name[30]; enum adapter_type Adapter; }; // Steven Bauer added code for the VM links struct LINK_id LINK_id_tbl[] = { {"1.0", "LinkHub-E v1.0", adapter_LINK_E}, {"1.1", "LinkHub-E v1.1", adapter_LINK_E}, {"1.0", "LINK v1.0", adapter_LINK_10}, {"1.1", "LINK v1.1", adapter_LINK_11}, {"1.2", "LINK v1.2", adapter_LINK_12}, {"VM12a", "LINK OEM v1.2a", adapter_LINK_12}, {"VM12", "LINK OEM v1.2", adapter_LINK_12}, {"1.3", "LinkUSB V1.3", adapter_LINK_13}, {"1.4", "LinkUSB V1.4", adapter_LINK_14}, {"0", "0", 0} }; #define MAX_LINK_VERSION_LENGTH 36 static RESET_TYPE LINK_reset(const struct parsedname *pn); static enum search_status LINK_next_both(struct device_search *ds, const struct parsedname *pn); static GOOD_OR_BAD LINK_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static GOOD_OR_BAD LINK_sendback_bits(const BYTE * databits, BYTE * respbits, const size_t size, const struct parsedname *pn); static GOOD_OR_BAD LINK_PowerByte(const BYTE data, BYTE * resp, const UINT delay, const struct parsedname *pn); static GOOD_OR_BAD LINK_PowerBit(const BYTE data, BYTE * resp, const UINT delay, const struct parsedname *pn); static void LINK_close(struct connection_in *in) ; static GOOD_OR_BAD LinkHubE_Control( struct connection_in * in_link ) ; static GOOD_OR_BAD Control_com( struct connection_in * in_control ) ; static void LINK_setroutines(struct connection_in *in); static void LINKE_setroutines(struct connection_in *in); static RESET_TYPE LINK_reset_in(struct connection_in * in); static GOOD_OR_BAD LINK_detect_serial(struct connection_in * in) ; static GOOD_OR_BAD LINK_detect_net(struct connection_in * in) ; static GOOD_OR_BAD LINK_version(struct connection_in * in) ; static void LINK_set_baud(struct connection_in * in) ; static GOOD_OR_BAD LINK_read(BYTE * buf, size_t size, struct connection_in * in); static GOOD_OR_BAD LINK_read_true_length(BYTE * buf, size_t size, struct connection_in *in) ; static GOOD_OR_BAD LINK_write(const BYTE * buf, size_t size, struct connection_in *in); static GOOD_OR_BAD LINK_directory(struct device_search *ds, struct connection_in * in); static GOOD_OR_BAD LINK_search_type(struct device_search *ds, struct connection_in * in) ; static GOOD_OR_BAD LINK_readback_data( BYTE * resp, const size_t size, struct connection_in * in); static GOOD_OR_BAD LinkVersion_knownstring( const char * reported_string, struct connection_in * in ) ; static GOOD_OR_BAD LinkVersion_unknownstring( const char * reported_string, struct connection_in * in ) ; static void LINK_flush( struct connection_in * in ) ; static void LINK_slurp(struct connection_in *in); static void LINK_setroutines(struct connection_in *in) { in->iroutines.detect = LINK_detect; in->iroutines.reset = LINK_reset; in->iroutines.next_both = LINK_next_both; in->iroutines.PowerByte = LINK_PowerByte; in->iroutines.PowerBit = LINK_PowerBit; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = LINK_sendback_data; in->iroutines.sendback_bits = LINK_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = LINK_close; in->iroutines.flags = ADAP_FLAG_no2409path | ADAP_FLAG_no2404delay ; in->bundling_length = LINK_FIFO_SIZE; } static void LINKE_setroutines(struct connection_in *in) { LINK_setroutines(in) ; in->bundling_length = LINKE_FIFO_SIZE; } #define LINK_string(x) ((BYTE *)(x)) static GOOD_OR_BAD LinkVersion_knownstring( const char * reported_string, struct connection_in * in ) { int version_index; // bad string if ( reported_string == NULL || reported_string[0] == '\0' ) { return LinkVersion_unknownstring(reported_string,in) ; } // loop through LINK version string table looking for a match for (version_index = 0; LINK_id_tbl[version_index].verstring[0] != '0'; version_index++) { if (strstr(reported_string, LINK_id_tbl[version_index].verstring) != NULL) { LEVEL_DEBUG("Link version Found %s", LINK_id_tbl[version_index].verstring); in->Adapter = LINK_id_tbl[version_index].Adapter; in->adapter_name = LINK_id_tbl[version_index].name; return gbGOOD; } } return LinkVersion_unknownstring(reported_string,in) ; } static GOOD_OR_BAD LinkVersion_unknownstring( const char * reported_string, struct connection_in * in ) { const char * version_pointer; // Apparently strcasestr isn't available by default, will hard code: for ( version_pointer = reported_string ; version_pointer != '\0' ; ++version_pointer ) { switch ( *version_pointer ) { case 'l': case 'L': if ( strncasecmp( "link", version_pointer, 4 ) == 0 ) { LEVEL_DEBUG("Link version is unrecognized: %s (but that's ok).", reported_string); in->Adapter = adapter_LINK_other; in->adapter_name = "Other LINK"; return gbGOOD; } break ; default: break ; } } return gbBAD; } // bus locking done at a higher level GOOD_OR_BAD LINK_detect(struct connection_in *in) { struct connection_in * head_in ; if (SOC(in)->devicename == NULL) { return gbBAD; } head_in = in->channel_info.head ; COM_set_standard( head_in ) ; // standard COM port settings switch( SOC(head_in)->type ) { case ct_telnet: // LinkHub-E SOC(head_in)->baud = B115200 ; LEVEL_DEBUG("Attempt connection to networked LINK at 115200 baud"); RETURN_GOOD_IF_GOOD( LINK_detect_net( head_in ) ); // Xport or ser2net SOC(head_in)->baud = B9600 ; LEVEL_DEBUG("Attempt connection to networked LINK at 9600 baud"); RETURN_GOOD_IF_GOOD( LINK_detect_net( head_in ) ); // Now try control port reset RETURN_BAD_IF_BAD( LinkHubE_Control( head_in ) ) ; SOC(head_in)->baud = B115200 ; LEVEL_DEBUG("Reattempt LINK connection") ; UT_delay( 5000 ) ; RETURN_GOOD_IF_GOOD( LINK_detect_net( head_in ) ); break ; case ct_serial: SOC(head_in)->baud = B9600 ; SOC(in)->flow = flow_first ; RETURN_GOOD_IF_GOOD( LINK_detect_serial(head_in) ) ; LEVEL_DEBUG("Second attempt at serial LINK setup"); SOC(head_in)->flow = flow_second ; RETURN_GOOD_IF_GOOD( LINK_detect_serial(head_in) ) ; LEVEL_DEBUG("Third attempt at serial LINK setup"); SOC(head_in)->flow = flow_first ; RETURN_GOOD_IF_GOOD( LINK_detect_serial(head_in) ) ; LEVEL_DEBUG("Fourth attempt at serial LINK setup"); SOC(head_in)->flow = flow_second ; RETURN_GOOD_IF_GOOD( LINK_detect_serial(head_in) ) ; break ; default: return gbBAD ; } return gbBAD ; } static GOOD_OR_BAD LINK_detect_serial(struct connection_in * in) { struct connection_in * head_in = in->channel_info.head ; /* Set up low-level routines */ LINK_setroutines(head_in); SOC(head_in)->timeout.tv_sec = Globals.timeout_serial ; SOC(head_in)->timeout.tv_usec = 0 ; /* Open the com port */ RETURN_BAD_IF_BAD(COM_open(head_in)) ; //COM_break( in ) ; LEVEL_DEBUG("Slurp in initial bytes"); LINK_slurp( head_in ) ; UT_delay(100) ; // based on http://morpheus.wcf.net/phpbb2/viewtopic.php?t=89&sid=3ab680415917a0ebb1ef020bdc6903ad LINK_slurp( head_in ) ; RETURN_GOOD_IF_GOOD( LINK_version(in) ) ; LEVEL_DEFAULT("LINK detection error"); COM_close(head_in) ; return gbBAD; } static GOOD_OR_BAD LINK_detect_net(struct connection_in * in) { struct connection_in * head_in = in->channel_info.head ; /* Set up low-level routines */ LINKE_setroutines(head_in); SOC(head_in)->timeout.tv_sec = 0 ; SOC(head_in)->timeout.tv_usec = 300000 ; /* Open the tcp port */ RETURN_BAD_IF_BAD( COM_open(head_in) ) ; LEVEL_DEBUG("Slurp in initial bytes"); // LINK_slurp( in ) ; UT_delay(1000) ; // based on http://morpheus.wcf.net/phpbb2/viewtopic.php?t=89&sid=3ab680415917a0ebb1ef020bdc6903ad LINK_slurp( head_in ) ; // LINK_flush(in); SOC(in)->dev.telnet.telnet_negotiated = needs_negotiation ; RETURN_GOOD_IF_GOOD( LINK_version(head_in) ) ; // second try -- send a break and line settings LEVEL_DEBUG("Second try -- send BREAK"); COM_flush(head_in) ; COM_break(head_in); telnet_change(head_in); // LINK_slurp( in ) ; RETURN_GOOD_IF_GOOD( LINK_version(in) ) ; LEVEL_DEFAULT("LINK detection error"); COM_close(head_in) ; return gbBAD; } static GOOD_OR_BAD LINK_version(struct connection_in * in) { char version_string[MAX_LINK_VERSION_LENGTH+1] ; enum { lvs_string, lvs_0d, } lvs = lvs_string ; // read state machine int version_index ; in->master.link.tmode = e_link_t_unknown ; in->master.link.qmode = e_link_t_unknown ; // clear out the buffer memset(version_string, 0, MAX_LINK_VERSION_LENGTH+1); if ( BAD( LINK_write(LINK_string(" "), 1, in) ) ) { LEVEL_DEFAULT("LINK version string cannot be requested"); return gbBAD ; } /* read the version string */ LEVEL_DEBUG("Checking LINK version"); // need to read 1 char at a time to get a short string for ( version_index=0 ; version_index but no 0x0D 0x0A",version_string) ; return gbBAD ; case lvs_0d: LEVEL_DEBUG("Found string <%s> but no 0x0A",version_string) ; return gbBAD ; default: return gbBAD ; } } switch( version_string[version_index] ) { case 0x0D: switch ( lvs ) { case lvs_string: lvs = lvs_0d ; // end of text version_string[version_index] = '\0' ; break ; case lvs_0d: LEVEL_DEBUG("Extra CR char in <%s>",version_string); return gbBAD ; } break ; case 0x0A: switch ( lvs ) { case lvs_string: LEVEL_DEBUG("No CR before LF char in <%s>",version_string); return gbBAD ; case lvs_0d: return LinkVersion_knownstring( version_string, in ) ; } default: switch ( lvs ) { case lvs_string: // add to string break ; case lvs_0d: ++in->master.serial.tcp.CRLF_size; break ; } break ; } } LEVEL_DEFAULT("LINK version string too long. <%s> greater than %d chars",version_string,MAX_LINK_VERSION_LENGTH); return gbBAD ; } static void LINK_set_baud(struct connection_in * in) { struct connection_in * head_in = in->channel_info.head ; char * speed_code ; if ( SOC(head_in)->type == ct_telnet ) { // telnet pinned at 115200 return ; } COM_BaudRestrict( &(SOC(head_in)->baud), B9600, B19200, B38400, B57600, 0 ) ; LEVEL_DEBUG("to %d",COM_BaudRate(SOC(head_in)->baud)); // Find rate parameter switch ( SOC(head_in)->baud ) { case B9600: COM_break(head_in) ; LINK_flush(in); return ; case B19200: speed_code = "," ; break ; case B38400: speed_code = "`" ; break ; #ifdef B57600 /* MacOSX support max 38400 in termios.h ? */ case B57600: speed_code = "^" ; break ; #endif default: LEVEL_DEBUG("Unrecognized baud rate"); return ; } LEVEL_DEBUG("LINK change baud string <%s>",speed_code); LINK_flush(in); if ( BAD( LINK_write(LINK_string(speed_code), 1, in) ) ) { LEVEL_DEBUG("LINK change baud error -- will return to 9600"); SOC(head_in)->baud = B9600 ; ++head_in->changed_bus_settings ; return ; } // Send configuration change LINK_flush(in); // Change OS view of rate UT_delay(5); COM_change(head_in) ; UT_delay(5); LINK_slurp(in); return ; } static void LINK_flush( struct connection_in * in ) { COM_flush(in->channel_info.head) ; } static RESET_TYPE LINK_reset(const struct parsedname *pn) { return LINK_reset_in(pn->selected_connection); } static RESET_TYPE LINK_reset_in(struct connection_in * in) { BYTE resp[1+in->master.serial.tcp.CRLF_size]; if (in->changed_bus_settings > 0) { --in->changed_bus_settings ; LINK_set_baud(in); // reset paramters } else { LINK_flush(in); } if ( BAD(LINK_write(LINK_string("r"), 1, in) || BAD( LINK_read(resp, 1, in))) ) { LEVEL_DEBUG("Error resetting LINK device"); LINK_slurp(in); return BUS_RESET_ERROR; } switch (resp[0]) { case 'P': in->AnyDevices = anydevices_yes; return BUS_RESET_OK; case 'N': in->AnyDevices = anydevices_no; return BUS_RESET_OK; case 'S': return BUS_RESET_SHORT; default: LEVEL_DEBUG("bad, Unknown LINK response %c", resp[0]); LINK_slurp(in); return BUS_RESET_ERROR; } } static enum search_status LINK_next_both(struct device_search *ds, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; //Special case for DS2409 hub, use low-level code if ( pn->ds2409_depth>0 ) { return search_error ; } if (ds->LastDevice) { return search_done; } if (ds->index == -1) { if ( BAD(LINK_directory(ds, in)) ) { return search_error; } } // LOOK FOR NEXT ELEMENT ++ds->index; LEVEL_DEBUG("Index %d", ds->index); switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) { case 0: LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn)); return search_good; case -ENODEV: default: ds->LastDevice = 1; LEVEL_DEBUG("SN finished"); return search_done; } } static void LINK_slurp(struct connection_in *in) { COM_slurp(in->channel_info.head); } static GOOD_OR_BAD LINK_read(BYTE * buf, size_t size, struct connection_in *in) { return LINK_read_true_length( buf, size+in->master.serial.tcp.CRLF_size, in ) ; } static GOOD_OR_BAD LINK_read_true_length(BYTE * buf, size_t size, struct connection_in *in) { return COM_read( buf, size, in->channel_info.head ) ; } // Write a string to the serial port // return 0=good, // -EIO = error //Special processing for the remote hub (add 0x0A) static GOOD_OR_BAD LINK_write(const BYTE * buf, size_t size, struct connection_in *in) { return COM_write( buf, size, in->channel_info.head ) ; } static GOOD_OR_BAD LINK_search_type(struct device_search *ds, struct connection_in * in) { char resp[3+in->master.serial.tcp.CRLF_size]; int response_length ; LEVEL_DEBUG("Test to see if LINK supports the tF0 command"); switch ( in->master.link.tmode ) { case e_link_t_unknown: RETURN_BAD_IF_BAD( LINK_write(LINK_string("tF0"), 3, in)); RETURN_BAD_IF_BAD(LINK_read(LINK_string(resp), 2, in)); switch ( resp[0] ) { case 'F': in->master.link.tmode = e_link_t_none ; response_length = 2 ; break; default: in->master.link.tmode = e_link_t_extra ; response_length = 3 ; LINK_slurp(in); break; } break ; case e_link_t_extra: response_length = 3 ; break ; case e_link_t_none: default: response_length = 2 ; break ; } //Depending on the search type, the LINK search function //needs to be selected //tEC -- Conditional searching //tF0 -- Normal searching // Send the configuration command and check response if (ds->search == _1W_CONDITIONAL_SEARCH_ROM) { RETURN_BAD_IF_BAD(LINK_write(LINK_string("tEC"), 3, in)) ; RETURN_BAD_IF_BAD(LINK_read(LINK_string(resp), response_length, in)) ; if (strstr(resp, "EC") == NULL) { LEVEL_DEBUG("Did not change to conditional search"); return gbBAD; } LEVEL_DEBUG("LINK set for conditional search"); } else { RETURN_BAD_IF_BAD( LINK_write(LINK_string("tF0"), 3, in)); RETURN_BAD_IF_BAD(LINK_read(LINK_string(resp), response_length, in)); if (strstr(resp, "F0") == NULL) { LEVEL_DEBUG("Did not change to normal search"); return gbBAD; } LEVEL_DEBUG("LINK set for normal search"); } return gbGOOD ; } /************************************************************************/ /* */ /* LINK_directory: searches the Directory stores it in a dirblob */ /* & stores in in a dirblob object depending if it */ /* Supports conditional searches of the bus for */ /* /alarm branch */ /* */ /* Only called for the first element, everything else comes from dirblob*/ /* returns 0 even if no elements, errors only on communication errors */ /* */ /************************************************************************/ #define DEVICE_LENGTH 16 #define COMMA_LENGTH 1 #define PLUS_LENGTH 1 static GOOD_OR_BAD LINK_directory(struct device_search *ds, struct connection_in * in) { char resp[DEVICE_LENGTH+COMMA_LENGTH+PLUS_LENGTH+in->master.serial.tcp.CRLF_size]; DirblobClear( &(ds->gulp) ); // Send the configuration command and check response RETURN_BAD_IF_BAD( LINK_search_type( ds, in )) ; // send the first search RETURN_BAD_IF_BAD(LINK_write(LINK_string("f"), 1, in)) ; //One needs to check the first character returned. //If nothing is found, the link will timeout rather then have a quick //return. This happens when looking at the alarm directory and //there are no alarms pending //So we grab the first character and check it. If not an E leave it //in the resp buffer and get the rest of the response from the LINK //device RETURN_BAD_IF_BAD(LINK_read(LINK_string(resp), 1, in)) ; switch (resp[0]) { case 'E': LEVEL_DEBUG("LINK returned E: No devices in alarm"); // pass through case 'N': // remove extra 2 bytes LEVEL_DEBUG("LINK returned E or N: Empty bus"); if (ds->search != _1W_CONDITIONAL_SEARCH_ROM) { in->AnyDevices = anydevices_no; } return gbGOOD ; default: break ; } if ( BAD(LINK_read(LINK_string(&resp[1+in->master.serial.tcp.CRLF_size]), DEVICE_LENGTH+COMMA_LENGTH+PLUS_LENGTH-1-in->master.serial.tcp.CRLF_size, in)) ) { return gbBAD; } // Check if we should start scanning switch (resp[0]) { case '-': case '+': if (ds->search != _1W_CONDITIONAL_SEARCH_ROM) { in->AnyDevices = anydevices_yes; } break; default: LEVEL_DEBUG("LINK_search unrecognized case"); return gbBAD; } /* Join the loop after the first query -- subsequent handled differently */ while ((resp[0] == '+') || (resp[0] == '-')) { BYTE sn[SERIAL_NUMBER_SIZE]; sn[7] = string2num(&resp[2]); sn[6] = string2num(&resp[4]); sn[5] = string2num(&resp[6]); sn[4] = string2num(&resp[8]); sn[3] = string2num(&resp[10]); sn[2] = string2num(&resp[12]); sn[1] = string2num(&resp[14]); sn[0] = string2num(&resp[16]); LEVEL_DEBUG("SN found: " SNformat, SNvar(sn)); // CRC check if (CRC8(sn, SERIAL_NUMBER_SIZE) || (sn[0] == 0x00)) { LEVEL_DEBUG("BAD family or CRC8"); return gbBAD; } DirblobAdd(sn, &(ds->gulp) ); switch (resp[0]) { case '+': // get next element if ( BAD(LINK_write(LINK_string("n"), 1, in))) { return gbBAD; } if ( BAD(LINK_read(LINK_string((resp)), DEVICE_LENGTH+COMMA_LENGTH+PLUS_LENGTH, in)) ) { return gbBAD; } break; case '-': return gbGOOD; default: break; } } return gbGOOD; } static void LINK_close(struct connection_in *in) { // the standard COM_free routine cleans up the connection (void) in ; } static GOOD_OR_BAD LINK_PowerByte(const BYTE data, BYTE * resp, const UINT delay, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; ASCII buf[3] = "pxx"; BYTE respond[2+in->master.serial.tcp.CRLF_size] ; num2string(&buf[1], data); RETURN_BAD_IF_BAD(LINK_write(LINK_string(buf), 3, in) ) ; // delay UT_delay(delay); // flush the buffers RETURN_BAD_IF_BAD(LINK_write(LINK_string("\r"), 1, in) ) ; RETURN_BAD_IF_BAD( LINK_readback_data( LINK_string(respond), 2, in) ) ; resp[0] = string2num((const ASCII *) respond); return gbGOOD ; } // _sendback_bits // Send data and return response block // return 0=good static GOOD_OR_BAD LINK_PowerBit(const BYTE data, BYTE * resp, const UINT delay, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; BYTE buf[2+1+1+in->master.serial.tcp.CRLF_size] ; buf[0] = '~'; //put in power bit mode buf[1] = data ? '1' : '0' ; // send to LINK (wait for final CR) RETURN_BAD_IF_BAD(LINK_write(buf, 2, in) ) ; // delay UT_delay(delay); // // take out of power bit mode RETURN_BAD_IF_BAD(LINK_write(LINK_string("\r"), 1, in) ) ; // read back RETURN_BAD_IF_BAD( LINK_readback_data(buf, 1, in) ) ; // place data (converted back to hex) in resp resp[0] = (buf[0]=='0') ? 0x00 : 0xFF ; return gbGOOD; } // _sendback_data // Send data and return response block // return 0=good #define LINK_SEND_SIZE 32 static GOOD_OR_BAD LINK_sendback_data(const BYTE * data, BYTE * resp, const size_t size, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; size_t left = size; size_t location = 0 ; BYTE buf[1+LINK_SEND_SIZE*2+1+1+in->master.serial.tcp.CRLF_size] ; if (size == 0) { return gbGOOD; } //Debug_Bytes( "ELINK sendback send", data, size) ; while (left > 0) { // Loop through taking only 32 bytes at a time size_t this_length = (left > LINK_SEND_SIZE) ? LINK_SEND_SIZE : left; size_t this_length2 = 2 * this_length ; // doubled for switch from hex to ascii buf[0] = 'b'; //put in byte mode bytes2string((char *) &buf[1], &data[location], this_length); // load in data as ascii data buf[1+this_length2] = '\r'; // take out of byte mode // send to LINK RETURN_BAD_IF_BAD(LINK_write(buf, 1+this_length2+1, in) ) ; // read back RETURN_BAD_IF_BAD( LINK_readback_data(buf, this_length2, in) ) ; // place data (converted back to hex) in resp string2bytes((char *) buf, &resp[location], this_length); left -= this_length; location += this_length ; } //Debug_Bytes( "ELINK sendback get", resp, size) ; return gbGOOD; } // _sendback_bits // Send data and return response block // return 0=good static GOOD_OR_BAD LINK_sendback_bits(const BYTE * databits, BYTE * respbits, const size_t size, const struct parsedname *pn) { struct connection_in * in = pn->selected_connection ; size_t left = size; size_t location = 0 ; BYTE buf[1+LINK_SEND_SIZE+1+1+in->master.serial.tcp.CRLF_size] ; if (size == 0) { return gbGOOD; } Debug_Bytes( "ELINK sendback bits send", databits, size) ; while (left > 0) { // Loop through taking only 32 bytes at a time size_t this_length = (left > LINK_SEND_SIZE) ? LINK_SEND_SIZE : left; size_t i ; buf[0] = 'j'; //put in bit mode for ( i=0 ; imaster.link.qmode ) { case e_link_t_extra: qmode_extra = 1 ; break ; case e_link_t_unknown: case e_link_t_none: default: qmode_extra = 0 ; break ; } // read back RETURN_BAD_IF_BAD( LINK_read(buf, size+qmode_extra, in) ) ; // see if we've yet tested the extra '?' "feature" if ( in->master.link.qmode == e_link_t_unknown ) { if ( buf[size] != 0x0D ) { in->master.link.qmode = e_link_t_extra ; LINK_slurp(in) ; } else { in->master.link.qmode = e_link_t_none ; } } return gbGOOD; } // use the Xport control port to reset static GOOD_OR_BAD LinkHubE_Control( struct connection_in * in_link ) { struct connection_in * in_control = AllocIn( NO_CONNECTION ) ; if ( SOC(in_link)->dev.tcp.host == NULL ) { LEVEL_DEBUG("No Xport control on local machine"); return gbBAD ; } if ( in_control != NO_CONNECTION ) { GOOD_OR_BAD ret ; SOC(in_control)->type = ct_telnet ; SOC(in_control)->devicename = owstrdup( SOC(in_link)->dev.tcp.host ) ; in_control->busmode = bus_xport_control ; SOC(in_control)->timeout.tv_sec = 1 ; SOC(in_control)->timeout.tv_usec = 0 ; ret = Control_com( in_control ) ; RemoveIn( in_control ) ; return ret ; } return gbBAD ; } static GOOD_OR_BAD Control_com( struct connection_in * in_control ) { RETURN_BAD_IF_BAD( COM_open( in_control ) ) ; COM_slurp( in_control ) ; RETURN_BAD_IF_BAD( COM_write_simple( (BYTE *) "\r", 1, in_control ) ) ; COM_slurp( in_control ) ; RETURN_BAD_IF_BAD( COM_write_simple( (BYTE *) "9\r", 2, in_control ) ) ; COM_slurp( in_control ) ; return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_w1_scan.c0000644000175000017500000000465011673500050015430 00000000000000/* $Id: ow_w1_scan.c,v 1.22 2011/12/19 00:07:04 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" void * w1_master_command(void * v) { struct netlink_parse * nlp = v ; // This is a structure that was allocated in Dispatch_Packet() // It needs to be destroyed before this (detached) thread is finished. DETACH_THREAD; if ( nlp->nlm->nlmsg_pid != 0 ) { LEVEL_DEBUG("Netlink packet PID not from kernel"); } else if (nlp->w1m) { int bus_master = nlp->w1m->id.mst.id ; switch (nlp->w1m->type) { case W1_LIST_MASTERS: LEVEL_DEBUG("Netlink (w1) list all bus masters"); w1_parse_master_list( nlp ); break; case W1_MASTER_ADD: LEVEL_DEBUG("Netlink (w1) add a bus master"); AddW1Bus(bus_master) ; break; case W1_MASTER_REMOVE: LEVEL_DEBUG("Netlink (w1) remove a bus master"); RemoveW1Bus(bus_master) ; break; case W1_SLAVE_ADD: case W1_SLAVE_REMOVE: // ignored since there is no bus attribution and real use will discover the change. // at some point we could make the w1 master lists static and only changed when triggered by one of these messages. LEVEL_DEBUG("Netlink (w1) Slave announcements (ignored)"); break ; default: LEVEL_DEBUG("Netlink (w1) Other command."); break ; } } owfree(nlp) ; return VOID_RETURN ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_sibling_yesno.c0000664000175000017500000000407111447211130016735 00000000000000/* $Id: ow_sibling_yesno.c,v 1.2 2010/09/24 21:04:24 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" ZERO_OR_ERROR FS_r_sibling_Y(INT *Y, const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; SIZE_OR_ERROR sib_status ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } sib_status = FS_read_local(owq_sibling) ; Y[0] = OWQ_Y(owq_sibling) ; OWQ_destroy(owq_sibling) ; return sib_status >= 0 ? 0 : -EINVAL ; } ZERO_OR_ERROR FS_w_sibling_Y(INT Y, const char * sibling, struct one_wire_query *owq) { ZERO_OR_ERROR write_error; struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } OWQ_Y(owq_sibling) = Y ; write_error = FS_write_local(owq_sibling) ; OWQ_destroy(owq_sibling) ; return write_error ; } owfs-2.8p15/module/owlib/src/c/ow_fstat.c0000664000175000017500000000707611545477026015243 00000000000000/* $Id: ow_fstat.c,v 1.47 2011/04/02 01:38:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" ZERO_OR_ERROR FS_fstat(const char *path, struct stat *stbuf) { struct parsedname pn; ZERO_OR_ERROR ret = 0; LEVEL_CALL("path=%s", SAFESTRING(path)); /* Bad path */ if (FS_ParsedName(path, &pn) != 0 ) { ret = -ENOENT; } else { ret = FS_fstat_postparse(stbuf, &pn); } FS_ParsedName_destroy(&pn); return ret; } /* Fstat with parsedname already done */ ZERO_OR_ERROR FS_fstat_postparse(struct stat *stbuf, const struct parsedname *pn) { memset(stbuf, 0, sizeof(struct stat)); LEVEL_CALL("ATTRIBUTES path=%s", SAFESTRING(pn->path)); if (KnownBus(pn) && pn->known_bus == NULL) { /* check for presence of first in-device at least since FS_ParsedName * doesn't do it yet. */ return -ENOENT; } else if (pn->selected_device == NO_DEVICE) { /* root directory */ int nr = 0; //printf("FS_fstat root\n"); stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; // plus number of sub-directories nr = -1; // make it 1 /* If calculating NSUB is hard, the filesystem can set st_nlink of directories to 1, and find will still work. This is not documented behavior of find, and it's not clear whether this is intended or just by accident. But for example the NTFS filesysem relies on this, so it's unlikely that this "feature" will go away. */ stbuf->st_nlink += nr; stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = StateInfo.start_time; } else if (pn->selected_filetype == NO_FILETYPE) { int nr = 0; //printf("FS_fstat pn.selected_filetype == NULL (1-wire device)\n"); stbuf->st_mode = S_IFDIR | 0777; stbuf->st_nlink = 2; // plus number of sub-directories nr = -1; // make it 1 //printf("FS_fstat seem to be %d entries (%d dirs) in device\n", pn.selected_device->nft, nr); stbuf->st_nlink += nr; FSTATLOCK; stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = StateInfo.dir_time; FSTATUNLOCK; } else if (pn->selected_filetype->format == ft_directory || pn->selected_filetype->format == ft_subdir) { /* other directory */ int nr = 0; //printf("FS_fstat other dir inside device\n"); stbuf->st_mode = S_IFDIR | 0777; stbuf->st_nlink = 2; // plus number of sub-directories nr = -1; // make it 1 //printf("FS_fstat seem to be %d entries (%d dirs) in device\n", NFT(pn.selected_filetype)); stbuf->st_nlink += nr; FSTATLOCK; stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = StateInfo.dir_time; FSTATUNLOCK; } else { /* known 1-wire filetype */ stbuf->st_mode = S_IFREG; if (pn->selected_filetype->read != NO_READ_FUNCTION) { stbuf->st_mode |= 0444; } if (!Globals.readonly && (pn->selected_filetype->write != NO_WRITE_FUNCTION)) { stbuf->st_mode |= 0222; } stbuf->st_nlink = 1; switch (pn->selected_filetype->change) { case fc_volatile: case fc_second: case fc_statistic: stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = NOW_TIME; break; case fc_stable: FSTATLOCK; stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = StateInfo.dir_time; FSTATUNLOCK; break; default: stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = StateInfo.start_time; break; } //printf("FS_fstat file\n"); } stbuf->st_size = FullFileLength(pn); return 0; } owfs-2.8p15/module/owlib/src/c/ow_buslock.c0000644000175000017500000000321211707143413015534 00000000000000/* $Id: ow_buslock.c,v 1.8 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* locks are to handle multithreading */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" void BUS_lock(const struct parsedname *pn) { if (pn) { struct connection_in * in = pn->selected_connection ; OW_channel_lock(in) ; BUS_lock_in(in); } } void BUS_unlock(const struct parsedname *pn) { if (pn) { struct connection_in * in = pn->selected_connection ; BUS_unlock_in(in); OW_channel_unlock(in) ; } } void BUS_lock_in(struct connection_in *in) { if (!in) { return; } _MUTEX_LOCK(in->bus_mutex); if (in->busmode == bus_i2c && in->master.i2c.channels > 1) { _MUTEX_LOCK(in->master.i2c.head->master.i2c.all_channel_lock); } timernow( &(in->last_lock) ); /* for statistics */ STAT_ADD1_BUS(e_bus_locks, in); } void BUS_unlock_in(struct connection_in *in) { struct timeval tv; if (!in) { return; } timernow( &tv ); if ( timercmp( &tv, &(in->last_lock), <) ) { LEVEL_DEBUG("System clock moved backward"); timernow( &(in->last_lock) ); } timersub( &tv, &(in->last_lock), &tv ) ; STATLOCK; timeradd( &tv, &(in->bus_time), &(in->bus_time) ) ; ++in->bus_stat[e_bus_unlocks]; STATUNLOCK; if (in->busmode == bus_i2c && in->master.i2c.channels > 1) { _MUTEX_UNLOCK(in->master.i2c.head->master.i2c.all_channel_lock); } _MUTEX_UNLOCK(in->bus_mutex); } owfs-2.8p15/module/owlib/src/c/ow_1977.c0000644000175000017500000002444711740076517014525 00000000000000/* $Id: ow_1977.c,v 1.54 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1977.h" /* ------- Prototypes ----------- */ /* DS1977 counter */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_ver); READ_FUNCTION(FS_r_pwd); WRITE_FUNCTION(FS_w_pwd); WRITE_FUNCTION(FS_set); #if OW_CACHE WRITE_FUNCTION(FS_use); #endif /* OW_CACHE */ /* ------- Structures ----------- */ enum _ds1977_passwords { _ds1977_full, _ds1977_read, _ds1977_control } ; off_t _ds1977_pwd_loc[] = { 0x7FC0, 0x7FC8, 0x7FD0, } ; static struct aggregate A1977 = { 511, ag_numbers, ag_separate, }; static struct filetype DS1977[] = { F_STANDARD, {"memory", 32704, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 64, &A1977, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"version", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_ver, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_password", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"set_password/read", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_set, VISIBLE, {i:_ds1977_full}, }, {"set_password/full", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_set, VISIBLE, {i:_ds1977_read}, }, {"set_password/enabled", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_pwd, FS_w_pwd, VISIBLE, NO_FILETYPE_DATA, }, #if OW_CACHE {"use_password", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"use_password/read", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_use, VISIBLE, {i:_ds1977_full}, }, {"use_password/full", 8, NON_AGGREGATE, ft_binary, fc_stable, NO_READ_FUNCTION, FS_use, VISIBLE, {i:_ds1977_read}, }, #endif /*OW_CACHE */ }; DeviceEntryExtended(37, DS1977, DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD_WITH_PASSWORD 0x99 #define _1W_READ_MEMORY_WITH_PASSWORD 0xC3 #define _1W_VERIFY_PASSWORD 0x69 #define _1W_READ_VERSION 0xCC #define _DS1977_PASSWORD_OK 0xAA /* Persistent storage */ Make_SlaveSpecificTag(REA, fc_persistent); Make_SlaveSpecificTag(FUL, fc_persistent); /* ------- Functions ------------ */ /* DS2423 */ static GOOD_OR_BAD OW_w_mem( BYTE * data, size_t size, off_t offset, struct parsedname *pn) ; static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_version(UINT * u, struct parsedname *pn); static GOOD_OR_BAD OW_verify(BYTE * pwd, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_mem_with_password( BYTE * pwd, BYTE * data, size_t size, off_t offset, struct parsedname *pn) ; /* 1977 password */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 64; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 64; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 64; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_r_mem)) ; } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 64; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } static ZERO_OR_ERROR FS_ver(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_version(&OWQ_U(owq), PN(owq)) ); } static ZERO_OR_ERROR FS_r_pwd(struct one_wire_query *owq) { BYTE p; RETURN_ERROR_IF_BAD( OW_r_mem(&p, 1, _ds1977_pwd_loc[_ds1977_control], PN(owq)) ) ; OWQ_Y(owq) = (p == _DS1977_PASSWORD_OK); return 0; } static ZERO_OR_ERROR FS_w_pwd(struct one_wire_query *owq) { BYTE p = OWQ_Y(owq) ? 0x00 : _DS1977_PASSWORD_OK; return GB_to_Z_OR_E( OW_w_mem(&p, 1, _ds1977_pwd_loc[_ds1977_control], PN(owq)) ); } static ZERO_OR_ERROR FS_set(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; if (OWQ_size(owq) < 8) { return -ERANGE; } /* Write */ RETURN_ERROR_IF_BAD( OW_w_mem((BYTE *) OWQ_buffer(owq), 8, _ds1977_pwd_loc[pn->selected_filetype->data.i],pn) ) ; /* Verify */ RETURN_ERROR_IF_BAD(OW_verify((BYTE *) OWQ_buffer(owq), _ds1977_pwd_loc[pn->selected_filetype->data.i], pn) ) ; #if OW_CACHE switch ( pn->selected_filetype->data.i) { case _ds1977_full: Cache_Add_SlaveSpecific((BYTE *) OWQ_buffer(owq), 8, SlaveSpecificTag(FUL) , pn) ; break ; case _ds1977_read: default: Cache_Add_SlaveSpecific((BYTE *) OWQ_buffer(owq), 8, SlaveSpecificTag(REA) , pn) ; break ; } return FS_use(owq); #else return 0 ; #endif /* OW_CACHE */ } #if OW_CACHE static ZERO_OR_ERROR FS_use(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; if (OWQ_size(owq) < 8) { return -ERANGE; } switch ( pn->selected_filetype->data.i) { case _ds1977_full: return Cache_Add_SlaveSpecific((BYTE *) OWQ_buffer(owq), 8, SlaveSpecificTag(FUL) , pn)==0 ? 0 : -EINVAL ; case _ds1977_read: return Cache_Add_SlaveSpecific((BYTE *) OWQ_buffer(owq), 8, SlaveSpecificTag(REA) , pn)==0 ? 0 : -EINVAL ; } return -EINVAL; } #endif /* OW_CACHE */ static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE pwd[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; #if OW_CACHE if ( GOOD( Cache_Get_SlaveSpecific((void *) pwd, sizeof(pwd), SlaveSpecificTag(REA), pn)) ) { RETURN_GOOD_IF_GOOD( OW_r_mem_with_password( pwd, data,size,offset,pn) ) ; } if ( GOOD( Cache_Get_SlaveSpecific((void *) pwd, sizeof(pwd), SlaveSpecificTag(FUL), pn)) ) { RETURN_GOOD_IF_GOOD( OW_r_mem_with_password( pwd, data,size,offset,pn) ) ; } #endif /* OW_CACHE */ return OW_r_mem_with_password(pwd, data, size, offset, pn); } static GOOD_OR_BAD OW_version(UINT * u, struct parsedname *pn) { BYTE p[] = { _1W_READ_VERSION, 0x00, 0x00 }; struct transaction_log t[] = { TRXN_START, TRXN_MODIFY(p,p,3), TRXN_COMPARE(&p[1],&p[2],1), TRXN_END, } ; RETURN_BAD_IF_BAD( BUS_transaction(t,pn) ) ; u[0] = p[1]; return gbGOOD; } static GOOD_OR_BAD OW_w_mem( BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[1 + 2 + 1+ 64 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; BYTE passwd[8] ; // altered size_t rest = 64 - (offset & 0x3F); BYTE post[1] ; struct transaction_log t_nocrc[] = { TRXN_START, TRXN_WRITE(p,3+size), TRXN_END, }; struct transaction_log t_crc[] = { TRXN_START, TRXN_WR_CRC16(p,3+size,0), TRXN_END, }; struct transaction_log t_read[] = { TRXN_START, TRXN_WR_CRC16(p,1,3+rest), TRXN_COMPARE(&p[4],data,size), TRXN_END, }; struct transaction_log t_copy[] = { TRXN_START, TRXN_WRITE(p,4), TRXN_MODIFY(passwd,passwd, 8-1), TRXN_POWER(&passwd[7],10), // 10ms TRXN_READ1(post), TRXN_END, }; // set up transfer if ( size>rest ) { return gbBAD ; } memcpy(&p[3],data,size) ; // Write to scratchpad (possibly with CRC16) if ( size==rest ) { RETURN_BAD_IF_BAD( BUS_transaction( t_crc, pn ) ) ; } else { RETURN_BAD_IF_BAD( BUS_transaction( t_nocrc, pn ) ) ; } // Read back from scratch pad to prime next step and confirm data /* Note that we tacitly shift the data one byte down for the E/S byte */ p[0] = _1W_READ_SCRATCHPAD ; RETURN_BAD_IF_BAD( BUS_transaction( t_read, pn ) ) ; // Copy scratchpad to memory if ( BAD( Cache_Get_SlaveSpecific((void *) passwd, 8, SlaveSpecificTag(FUL), pn)) ) { /* Full passwd */ memset( passwd, 0xFF, 8 ) ; } p[0] = _1W_COPY_SCRATCHPAD_WITH_PASSWORD ; RETURN_BAD_IF_BAD( BUS_transaction( t_copy, pn ) ) ; return (post[0]==0xFF) ? gbBAD : gbGOOD ; } static GOOD_OR_BAD OW_r_mem_with_password( BYTE * pwd, BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[1 + 2 + 64 + 2] = { _1W_READ_MEMORY_WITH_PASSWORD, LOW_HIGH_ADDRESS(offset), }; BYTE passwd[8] ; // altered size_t rest = 64 - (offset & 0x3F); struct transaction_log t[] = { TRXN_START, TRXN_WRITE(p,3), TRXN_MODIFY(passwd,passwd, 8-1), TRXN_POWER(&passwd[7],5), // 5ms TRXN_READ(&p[3],rest+2), { p, NULL, 3+rest+2, trxn_crc16, }, TRXN_END, }; // set up transfer if ( size>rest ) { return gbBAD ; } memcpy(passwd,pwd,8) ; RETURN_BAD_IF_BAD( BUS_transaction(t,pn) ) ; memcpy(data,&p[3],size) ; return gbGOOD ; } static GOOD_OR_BAD OW_verify(BYTE * pwd, off_t offset, struct parsedname *pn) { BYTE p[1 + 2] = { _1W_READ_MEMORY_WITH_PASSWORD, LOW_HIGH_ADDRESS(offset), }; BYTE passwd[8] ; // altered BYTE post[1] ; struct transaction_log t[] = { TRXN_START, TRXN_WRITE(p,3), TRXN_MODIFY(passwd,passwd, 8-1), TRXN_POWER(&passwd[7],5), // 5ms TRXN_READ1(post), TRXN_END, }; memcpy(passwd,pwd,8) ; RETURN_BAD_IF_BAD( BUS_transaction(t,pn) ) ; return post[0]==0xFF ? gbBAD : gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_fake.c0000664000175000017500000002316011611434674015014 00000000000000/* $Id: ow_fake.c,v 1.67 2011/07/20 02:13:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_codes.h" /* All the remaining_device_list of the program sees is the Fake_detect and the entry in iroutines */ static RESET_TYPE Fake_reset(const struct parsedname *pn); static GOOD_OR_BAD Fake_ProgramPulse(const struct parsedname *pn); static GOOD_OR_BAD Fake_sendback_bits(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void Fake_close(struct connection_in *in); static enum search_status Fake_next_both(struct device_search *ds, const struct parsedname *pn); static const ASCII *namefind(const char *name); static void Fake_setroutines(struct connection_in *in); static GOOD_OR_BAD Fake_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn); static void GetNextByte( const ASCII ** strpointer, BYTE default_byte, BYTE * sn ) ; static void GetDeviceName(const ASCII ** strpointer, struct connection_in * in) ; static void GetDefaultDeviceName(BYTE * dn, const BYTE * sn, const struct connection_in * in) ; static void GetAllDeviceNames( ASCII * remaining_device_list, struct connection_in * in ) ; static void SetConninData( int indx, const char * name, struct connection_in *in ) ; static void Fake_setroutines(struct connection_in *in) { in->iroutines.detect = Fake_detect; in->iroutines.reset = Fake_reset; in->iroutines.next_both = Fake_next_both; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = Fake_ProgramPulse; in->iroutines.sendback_data = Fake_sendback_data; in->iroutines.sendback_bits = Fake_sendback_bits; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = Fake_close; in->iroutines.flags = ADAP_FLAG_no2409path | ADAP_FLAG_presence_from_dirblob | ADAP_FLAG_no2404delay ; DirblobInit( &(in->master.fake.main) ); DirblobInit( &(in->master.fake.alarm) ); } static GOOD_OR_BAD Fake_sendback_data(const BYTE * data, BYTE * resp, const size_t len, const struct parsedname *pn) { (void) pn; (void) data; (void) resp; (void) len; return gbGOOD; } static void GetNextByte( const ASCII ** strpointer, BYTE default_byte, BYTE * sn ) { if ( (*strpointer)[0] == '.' ) { ++*strpointer ; } if ( isxdigit((*strpointer)[0]) && isxdigit((*strpointer)[1]) ) { *sn = string2num(*strpointer) ; *strpointer += 2 ; } else { *sn = default_byte ; } } // set up default device ID static void GetDefaultDeviceName(BYTE * dn, const BYTE * sn, const struct connection_in * in) { switch (in->busmode) { case bus_tester: // "bus number" dn[1] = BYTE_MASK(in->master.tester.index >> 0) ; dn[2] = BYTE_MASK(in->master.tester.index >> 8) ; // repeat family code dn[3] = sn[0] ; // family code complement dn[4] = BYTE_INVERSE(sn[0]) ; // "device" number dn[5] = BYTE_MASK(DirblobElements(&(in->master.fake.main)) >> 0) ; dn[6] = BYTE_MASK(DirblobElements(&(in->master.fake.main)) >> 8) ; break ; case bus_fake: case bus_mock: default: // only for compiler warning dn[1] = BYTE_MASK(rand()) ; dn[2] = BYTE_MASK(rand()) ; dn[3] = BYTE_MASK(rand()) ; dn[4] = BYTE_MASK(rand()) ; dn[5] = BYTE_MASK(rand()) ; dn[6] = BYTE_MASK(rand()) ; break ; } } static void GetDeviceName(const ASCII ** strpointer, struct connection_in * in) { BYTE sn[SERIAL_NUMBER_SIZE] ; BYTE dn[SERIAL_NUMBER_SIZE] ; if ( isxdigit((*strpointer)[0]) && isxdigit((*strpointer)[1]) ) { // family code specified sn[0] = string2num(*strpointer); *strpointer += 2; GetDefaultDeviceName( dn, sn, in ) ; // Choice of default or specified ID GetNextByte(strpointer,dn[1],&sn[1]); GetNextByte(strpointer,dn[2],&sn[2]); GetNextByte(strpointer,dn[3],&sn[3]); GetNextByte(strpointer,dn[4],&sn[4]); GetNextByte(strpointer,dn[5],&sn[5]); GetNextByte(strpointer,dn[6],&sn[6]); } else { const ASCII * name_to_familycode = namefind((*strpointer)) ; if ( name_to_familycode != NULL) { // device name specified (e.g. DS2401) sn[0] = string2num(name_to_familycode); GetDefaultDeviceName( dn, sn, in ) ; sn[1] = dn[1] ; sn[2] = dn[2] ; sn[3] = dn[3] ; sn[4] = dn[4] ; sn[5] = dn[5] ; sn[6] = dn[6] ; } else { // Bad device name LEVEL_DEFAULT("Device %d <%s> not recognized for %s %d -- ignored",DirblobElements(&(in->master.fake.main))+1,*strpointer,in->adapter_name,in->master.fake.index); return ; } } sn[SERIAL_NUMBER_SIZE-1] = CRC8compute(sn, SERIAL_NUMBER_SIZE-1, 0); DirblobAdd(sn, &(in->master.fake.main)); // Ignore bad return } static void GetAllDeviceNames( ASCII * remaining_device_list, struct connection_in * in ) { while (remaining_device_list != NULL) { const ASCII *current_device_start; for (current_device_start = strsep(&remaining_device_list, " ,"); current_device_start[0] != '\0'; ++current_device_start) { // note that strsep updates "remaining_device_list" pointer if (current_device_start[0] != ' ' && current_device_start[0] != ',') { break; } } GetDeviceName( ¤t_device_start, in ) ; } in->AnyDevices = (DirblobElements(&(in->master.fake.main)) > 0) ? anydevices_yes : anydevices_no ; } static void SetConninData( int indx, const char * name, struct connection_in *in ) { ASCII *oldname = SOC(in)->devicename; // destructively parsed and deleted at the end. char newname[20] ; SOC(in)->file_descriptor = indx; SOC(in)->type = ct_none ; in->master.fake.index = indx; in->master.fake.templow = Globals.templow; in->master.fake.temphigh = Globals.temphigh; LEVEL_CONNECT("Setting up %s Bus Master (%d)", in->adapter_name, indx); UCLIBCLOCK ; snprintf(newname, 18, "%s.%d", name, indx); UCLIBCUNLOCK ; GetAllDeviceNames( oldname, in ) ; SAFEFREE(oldname) ; SOC(in)->devicename = owstrdup(newname); } /* Device-specific functions */ /* Since this is simulated bus master, it's creation cannot fail */ /* in->name starts with a list of devices which is destructovely parsed and freed */ /* in->name end with a name-index format */ GOOD_OR_BAD Fake_detect(struct connection_in *in) { Fake_setroutines(in); // set up close, reconnect, reset, ... in->iroutines.detect = Fake_detect; in->adapter_name = "Simulated-Random"; in->Adapter = adapter_fake; SetConninData( Inbound_Control.next_fake++, "fake", in ); return gbGOOD; } /* Device-specific functions */ /* Since this is simulated bus master, it's creation cannot fail */ /* in->name starts with a list of devices which is destructovely parsed and freed */ /* in->name end with a name-index format */ GOOD_OR_BAD Mock_detect(struct connection_in *in) { Fake_setroutines(in); // set up close, reconnect, reset, ... in->iroutines.detect = Mock_detect; in->adapter_name = "Simulated-Mock"; in->Adapter = adapter_mock; SetConninData( Inbound_Control.next_mock++, "mock", in ); return gbGOOD; } /* Device-specific functions */ /* Since this is simulated bus master, it's creation cannot fail */ /* in->name starts with a list of devices which is destructovely parsed and freed */ /* in->name end with a name-index format */ GOOD_OR_BAD Tester_detect(struct connection_in *in) { Fake_setroutines(in); // set up close, reconnect, reset, ... in->iroutines.detect = Tester_detect; in->adapter_name = "Simulated-Computed"; in->Adapter = adapter_tester; SetConninData( Inbound_Control.next_tester++, "tester", in ); return gbGOOD; } static RESET_TYPE Fake_reset(const struct parsedname *pn) { (void) pn; return BUS_RESET_OK; } static GOOD_OR_BAD Fake_ProgramPulse(const struct parsedname *pn) { (void) pn; return gbGOOD; } static GOOD_OR_BAD Fake_sendback_bits(const BYTE * data, BYTE * resp, const size_t length, const struct parsedname *pn) { (void) pn; (void) data; (void) resp; (void) length; return gbGOOD; } static void Fake_close(struct connection_in *in) { DirblobClear( &(in->master.fake.main) ); DirblobClear( &(in->master.fake.alarm) ); } static enum search_status Fake_next_both(struct device_search *ds, const struct parsedname *pn) { if (ds->search == _1W_CONDITIONAL_SEARCH_ROM) { // alarm not supported ds->LastDevice = 1; return search_done; } if (DirblobGet(++ds->index, ds->sn, &(pn->selected_connection->master.fake.main))) { ds->LastDevice = 1; return search_done; } return search_good; } /* Need to lock struct global_namefind_struct since twalk requires global data -- can't pass void pointer */ /* Except all *_detect routines are done sequentially, not concurrently */ struct { const ASCII *readable_name; const ASCII *ret; } global_namefind_struct; static void Namefindaction(const void *nodep, const VISIT which, const int depth) { const struct device *p = *(struct device * const *) nodep; (void) depth; //printf("Comparing %s|%s with %s\n",p->name ,p->code , Namefindname ) ; switch (which) { case leaf: case postorder: if (strcasecmp(p->readable_name, global_namefind_struct.readable_name) == 0 || strcasecmp(p->family_code, global_namefind_struct.readable_name) == 0) { global_namefind_struct.ret = p->family_code; } case preorder: case endorder: break; } } static const ASCII *namefind(const char *name) { const ASCII *ret; NAMEFINDLOCK; global_namefind_struct.readable_name = name; global_namefind_struct.ret = NULL; twalk(Tree[ePN_real], Namefindaction); ret = global_namefind_struct.ret; NAMEFINDUNLOCK; return ret; } owfs-2.8p15/module/owlib/src/c/ow_parse_external.c0000644000175000017500000004352011742352454017122 00000000000000/* $Id: ow_parse_external.c,v 1.20 2012/04/14 19:51:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_parse_external -- read the SENSOR and PROPERTY lines */ /* in general the lines are comma separated tokens * with backslash escaping and * quote and double quote matching * */ #include #include "owfs_config.h" #include "ow.h" #include "ow_external.h" static char * string_parse( char * text_string, char delim, char ** last_char ); static char * trim_parse( char * raw_string ); static char * unquote_parse( char * raw_string ); static int LastParam( char * input_string ) ; static void create_just_print( char * s_prop, char * s_family, char * s_data ); static void create_subdirs( char * s_prop, char * s_family ); static void AddFamilyToTree( char * s_family ) ; static struct family_node * create_family_node( char * s_family ) ; static void AddSensorToTree( char * s_name, char * s_family, char * s_description, char * data ) ; static struct sensor_node * create_sensor_node( char * s_name, char * s_family, char * s_description, char * s_data ) ; static void AddPropertyToTree( char * s_property, char * s_family, enum ft_format s_format, size_t s_array, enum ag_combined s_combined, enum ag_index s_index_type, size_t s_length, enum fc_change s_change, char * s_read, char * s_write, char * s_data, char * s_other, enum external_type et ) ; static struct property_node * create_property_node( char * s_property, char * s_family, enum ft_format s_format, size_t s_array, enum ag_combined s_combined, enum ag_index s_index_type, size_t s_length, enum fc_change s_change, char * s_read, char * s_write, char * s_data, char * s_other, enum external_type et ) ; void * property_tree = NULL ; void * family_tree = NULL ; void * sensor_tree = NULL ; // ForAddSensor and AddProperty // uses the various tools to get a string into s_name (name is given) // start_pointer (a char *) is used and updated. #define GetQuotedString( name ) do { \ char * end_pointer ; \ s_##name = string_parse( start_pointer, ',', &end_pointer ) ; \ start_pointer = end_pointer ; \ if ( ! LastParam( s_##name ) ) { \ ++ start_pointer ; \ } \ s_##name = unquote_parse( trim_parse( s_##name ) ) ; \ } while (0) ; // Look through text_string, ignore backslash and match quoting varibles // allocates a new string with the token static char * string_parse( char * text_string, char delim, char ** last_char ) { char * copy_string ; char * old_string_pointer = text_string ; char * new_string_pointer ; //printf("->>>STRING (%c) PARSE <%s>\n",delim,text_string); if ( text_string == NULL ) { *last_char = text_string ; return owstrdup("") ; } new_string_pointer = copy_string = owstrdup( text_string ) ; // more than enough room if ( copy_string == NULL ) { *last_char = text_string ; return NULL ; } while ( 1 ) { char current_char = old_string_pointer[0] ; new_string_pointer[0] = current_char ; // default copy if ( current_char == '\0' ) { // end of string *last_char = old_string_pointer ; //printf("<<<-STRING (%c) PARSE <%s>, end:<%s>\n",delim,copy_string,*last_char); return copy_string ; } else if ( current_char == '\\' ) { // backslash, use next char literally if ( old_string_pointer[1] ) { new_string_pointer[0] = old_string_pointer[1] ; ++ new_string_pointer ; old_string_pointer += 2 ; } else { // unless there is no next char *last_char = old_string_pointer + 1 ; //printf("<<<-STRING (%c) PARSE <%s>, end:<%s>\n",delim,copy_string,*last_char); return copy_string ; } } else if ( current_char == delim ) { // found delimitter match // point to it, and null terminate *last_char = old_string_pointer ; new_string_pointer[1] = '\0' ; //printf("<<<-STRING (%c) PARSE <%s>, end:<%s>\n",delim,copy_string,*last_char); return copy_string ; } else if ( current_char == '"' || current_char == '\'' ) { // quotation -- find matching end char * quote_last_char ; char * quoted_string = string_parse( old_string_pointer+1, current_char, "e_last_char ) ; //printf("----STRING (%c) PARSE Quote <%s> end:<%s>\n",delim,quoted_string,quote_last_char); if ( quoted_string ) { strcpy( new_string_pointer+1, quoted_string ) ; new_string_pointer += strlen( quoted_string ) + 1 ; if ( quote_last_char[0] == current_char ) { quote_last_char[0] = '\0' ; // clear trailing quote old_string_pointer = quote_last_char + 1 ; } else { old_string_pointer = quote_last_char ; } owfree( quoted_string ) ; } else { new_string_pointer[1] = '\0' ; *last_char = old_string_pointer ; //printf("<<<-STRING (%c) PARSE <%s>, end:<%s>\n",delim,copy_string,*last_char); return copy_string ; } } else { ++ old_string_pointer ; ++ new_string_pointer ; } } } static char * trim_parse( char * raw_string ) { char * start_position ; char * end_position ; char * return_string ; for ( start_position = raw_string ; start_position[0] ; ++ start_position ) { if ( start_position[0] != ' ' ) { break ; } } return_string = owstrdup ( start_position ) ; owfree( raw_string ) ; for ( end_position = return_string + strlen( return_string ) ; end_position >= return_string ; -- end_position ) { if ( end_position[0] == '\0' ) { continue ; } else if ( end_position[0] != ' ' ) { break ; } else { end_position[0] = '\0' ; } } return return_string ; } static char * unquote_parse( char * raw_string ) { if ( raw_string == NULL ) { return NULL ; } switch ( raw_string[0] ) { case '"': case '\'': if ( raw_string[1] == '\0' ) { owfree( raw_string ) ; return owstrdup("") ; } else { char * unquoted = owstrdup( raw_string+1 ) ; char * unquoted_end = unquoted + strlen(unquoted) -1 ; if ( unquoted_end[0] == raw_string[0] ) { unquoted_end[0] = '\0' ; } owfree( raw_string ) ; return unquoted ; } break ; default: return raw_string ; } } static int LastParam( char * input_string ) { if ( input_string == NULL ) { return 1 ; } else { int len = strlen(input_string) ; if ( len == 0 ) { return 1 ; } if ( input_string[len-1] != ',' ) { return 1 ; } input_string[len-1] = '\0' ; return 0 ; } } // Gets a string with property,family,structure,read_function,write_function,property_data,extra // write, data and extra are optional /* * property * family * structure * read * write * data * other * */ void AddProperty( char * input_string, enum external_type et ) { char * s_family = NULL ; char * s_property = NULL ; char * s_dummy ; ssize_t s_array ; enum ag_combined s_combined ; enum ag_index s_index_type ; enum ft_format s_format ; ssize_t s_length ; enum fc_change s_change ; char * s_read = NULL ; char * s_write = NULL ; char * s_data = NULL ; char * s_other = NULL; char * start_pointer = input_string ; if ( input_string == NULL ) { return ; } if ( ! Globals.allow_external ) { LEVEL_DEBUG("External prgroams not supported by %s",Globals.progname) ; return ; } // property GetQuotedString( property ) ; // family GetQuotedString( family ) ; // type GetQuotedString( dummy ) ; switch ( s_dummy[0] ) { case 'D': s_length = PROPERTY_LENGTH_DIRECTORY ; s_format = ft_directory ; break ; case 'i': s_length = PROPERTY_LENGTH_INTEGER ; s_format = ft_integer ; break ; case 'u': s_length = PROPERTY_LENGTH_UNSIGNED ; s_format = ft_unsigned ; break ; case 'f': s_length = PROPERTY_LENGTH_FLOAT ; s_format = ft_float ; break ; case 'a': s_length = 1 ; s_format = ft_ascii ; break ; case 'b': s_length = 1 ; s_format = ft_binary ; break ; case 'y': s_length = PROPERTY_LENGTH_YESNO ; s_format = ft_yesno ; break ; case 'd': s_length = PROPERTY_LENGTH_DATE ; s_format = ft_date ; break ; case 't': s_length = PROPERTY_LENGTH_TEMP ; s_format = ft_temperature ; break ; case 'g': s_length = PROPERTY_LENGTH_TEMPGAP ; s_format = ft_tempgap ; break ; case 'p': s_length = PROPERTY_LENGTH_PRESSURE ; s_format = ft_pressure ; break ; default: LEVEL_DEFAULT("Unrecognized variable type <%s> for property <%s> family <%s>",s_dummy,s_property,s_family); s_format = ft_unknown ; return ; } if ( s_dummy[1] ) { int temp_length ; temp_length = strtol( &s_dummy[1], NULL, 0 ) ; if ( temp_length < 1 ) { LEVEL_DEFAULT("Unrecognized variable length <%s> for property <%s> family <%s>",s_dummy,s_property,s_family); return ; } s_length = temp_length ; } // array GetQuotedString( dummy ) ; switch ( s_dummy[0] ) { case '1': case '0': case '\0': s_combined = ag_separate ; s_index_type = ag_numbers ; s_array = 1 ; break ; case '-': s_array = 1 ; switch ( s_dummy[1] ) { case '1': s_combined = ag_sparse ; s_index_type = ag_numbers ; break ; default: s_combined = ag_sparse ; s_index_type = ag_letters ; break ; } break ; case '+': if ( isalpha(s_dummy[1]) ) { s_array = toupper(s_dummy[1]) - 'A' ; s_combined = ag_aggregate ; s_index_type = ag_letters ; } else { s_array = strtol( s_dummy, NULL, 0 ) ; s_combined = ag_aggregate ; s_index_type = ag_numbers ; } break ; default: if ( isalpha(s_dummy[0]) ) { s_array = toupper(s_dummy[0]) - 'A' ; s_combined = ag_separate ; s_index_type = ag_letters ; } else { s_array = strtol( s_dummy, NULL, 0 ) ; s_combined = ag_separate ; s_index_type = ag_numbers ; } break ; } if ( s_array < 1 ) { LEVEL_DEFAULT("Unrecognized array type <%s> for property <%s> family <%s>",s_dummy,s_property,s_family); return ; } // persistance GetQuotedString( dummy ) ; switch ( s_dummy[0] ) { case 'f': s_change = fc_static ; break ; case 's': s_change = fc_stable ; break ; case 'v': s_change = fc_volatile ; break ; case 't': s_change = fc_second ; break ; case 'u': s_change = fc_uncached ; break ; default: LEVEL_DEFAULT("Unrecognized persistance <%s> for property <%s> family <%s>",s_dummy,s_property,s_family); return ; } // read GetQuotedString( read ) ; // write GetQuotedString( write ) ; // data GetQuotedString( data ) ; // other GetQuotedString( other ) ; // test minimums if ( strlen( s_family ) > 0 && strlen( s_property ) > 0 ) { // Actually add AddFamilyToTree( s_family ) ; AddPropertyToTree( s_property, s_family, s_format, s_array, s_combined, s_index_type, s_length, s_change, s_read, s_write, s_data, s_other, et ) ; create_subdirs( s_property, s_family ) ; } // Clean up owfree( s_property ) ; owfree( s_family ) ; owfree( s_read ) ; owfree( s_write ) ; owfree( s_data ) ; owfree( s_other ) ; } // Gets a string with name,family, and description // description is optional /* * name * family * description * */ void AddSensor( char * input_string ) { char * s_name = NULL ; char * s_family = NULL ; char * s_description = NULL ; char * s_data = NULL ; char * start_pointer = input_string ; if ( input_string == NULL ) { return ; } if ( ! Globals.allow_external ) { LEVEL_DEBUG("External prgroams not supported by %s",Globals.progname) ; return ; } // name GetQuotedString( name ) ; // family GetQuotedString( family ) ; // description GetQuotedString( description ) ; // data GetQuotedString( data ) ; if ( strlen(s_name) > 0 && strlen(s_family) > 0 ) { // Actually add AddFamilyToTree( s_family ) ; AddSensorToTree( s_name, s_family, s_description, s_data ) ; create_just_print( "family", s_family, s_family ) ; create_just_print( "type", s_family, "external" ) ; } // Clean up owfree( s_name ); owfree( s_family ) ; owfree( s_description ) ; owfree( s_data ) ; } static struct sensor_node * create_sensor_node( char * s_name, char * s_family, char * s_description, char * s_data ) { int l_name = strlen(s_name)+1; int l_family = strlen(s_family)+1; int l_description = strlen(s_description)+1; int l_data = strlen(s_data)+1; struct sensor_node * s = owmalloc( sizeof(struct sensor_node) + l_name + l_family + l_description + l_data ) ; if ( s==NULL) { return NULL ; } memset( s, 0, sizeof(struct sensor_node) + l_name + l_family + l_description + l_data ) ; s->name = s->payload ; strcpy( s->name, s_name ) ; s->family = s->name + l_name ; strcpy( s->family, s_family ) ; s->description = s->family + l_family ; strcpy( s->description, s_description ) ; s->data = s->description + l_description ; strcpy( s->data, s_data ) ; return s ; } static struct family_node * create_family_node( char * s_family ) { int l_family = strlen(s_family)+1; struct family_node * s = owmalloc( sizeof(struct family_node) + l_family ) ; if ( s==NULL) { return NULL ; } memset( s, 0, sizeof(struct family_node) + l_family ) ; s->family = s->payload ; strcpy( s->family, s_family ) ; // fill some of device fields s->dev.count_of_filetypes = 0 ; // until known s->dev.family_code = s->family ; s->dev.readable_name = s->family ; s->dev.filetype_array = NULL ; // until known s->dev.flags = 0 ; s->dev.g_read = NULL ; s->dev.g_write = NULL ; return s ; } static struct property_node * create_property_node( char * s_property, char * s_family, enum ft_format s_format, size_t s_array, enum ag_combined s_combined, enum ag_index s_index_type, size_t s_length, enum fc_change s_change, char * s_read, char * s_write, char * s_data, char * s_other, enum external_type et ) { int l_property = strlen( s_property )+1 ; int l_family = strlen( s_family )+1 ; int l_read = strlen( s_read )+1 ; int l_write = strlen( s_write )+1 ; int l_data = strlen( s_data )+1 ; int l_other = strlen( s_other )+1 ; struct property_node * s = owmalloc( sizeof(struct property_node) + l_property + l_family + l_read + l_write + l_data + l_other ) ; if ( s==NULL) { return NULL ; } memset( s, 0, sizeof(struct property_node) + l_property + l_family + l_read + l_write + l_data + l_other ) ; s->property = s->payload ; strcpy( s->property, s_property ) ; s->family = s->property + l_property ; strcpy( s->family, s_family ) ; s->read = s->family + l_family ; strcpy( s->read, s_read ) ; s->write = s->read + l_read ; strcpy( s->write, s_write ) ; s->data = s->write + l_write ; strcpy( s->data, s_data ) ; s->other = s->data + l_data ; strcpy( s->other, s_other ) ; s->et = et ; // Fill in the filetype structure s->ft.name = s->property ; s->ft.suglen = s_length ; s->ft.ag = &(s->ag) ; s->ft.format = s_format ; s->ft.change = s_change ; s->ft.visible = VISIBLE ; s->ft.read = NO_READ_FUNCTION ; s->ft.write = NO_WRITE_FUNCTION ; s->ft.data.a = s->data ; // Check read function if ( s_read != NULL && strlen(s_read) > 0 ) { s->ft.read = FS_r_external ; } // Check write function if ( s_write != NULL && strlen(s_write) > 0 ) { s->ft.write = FS_w_external ; } // Fill in aggregate structure s->ag.elements = s_array ; s->ag.letters = s_index_type ; s->ag.combined = s_combined ; // Flag scalars if ( s_array == 1 ) { s->ft.ag = NON_AGGREGATE ; } return s ; } static void AddSensorToTree( char * s_name, char * s_family, char * s_description, char * s_data ) { struct sensor_node * n = create_sensor_node( s_name, s_family, s_description, s_data ) ; struct { struct sensor_node * key ; char other[0] ; } * opaque = tsearch( (void *) n, &sensor_tree, sensor_compare ) ; if ( opaque->key != n ) { // already exists LEVEL_DEBUG("Duplicate sensor entry: %s,%s,%s,%s",s_name,s_family,s_description,s_data); owfree( n ) ; } else { LEVEL_DEBUG("New sensor entry: %s,%s,%s,%s",s_name,s_family,s_description,s_data); } } static void AddFamilyToTree( char * s_family ) { struct family_node * n = create_family_node( s_family ) ; struct { struct family_node * key ; char other[0] ; } * opaque = tsearch( (void *) n, &family_tree, family_compare ) ; if ( opaque->key != n ) { // already exists LEVEL_DEBUG("Duplicate family entry: %s",s_family); owfree( n ) ; } else { ARG_External(NULL); LEVEL_DEBUG("New family entry: %s",s_family); } } static void AddPropertyToTree( char * s_property, char * s_family, enum ft_format s_format, size_t s_array, enum ag_combined s_combined, enum ag_index s_index_type, size_t s_length, enum fc_change s_change, char * s_read, char * s_write, char * s_data, char * s_other, enum external_type et ) { struct property_node * n = create_property_node( s_property, s_family, s_format, s_array, s_combined, s_index_type, s_length, s_change, s_read, s_write, s_data, s_other, et ) ; struct { struct property_node * key ; char other[0] ; } * opaque = tsearch( (void *) n, &property_tree, property_compare ) ; if ( opaque->key != n ) { // already exists LEVEL_DEBUG("Duplicate property entry: %s,%s,%s,%s,%s,%s",s_property,s_family,s_read,s_write,s_data,s_other); owfree( n ) ; } else { LEVEL_DEBUG("New property entry: %s,%s,%s,%s,%s,%s",s_property,s_family,s_read,s_write,s_data,s_other); } } static void create_just_print( char * s_prop, char * s_family, char * s_data ) { AddPropertyToTree( s_prop, s_family, ft_ascii, 1, ag_separate, ag_numbers, strlen(s_data), fc_static, "just_print_data", "", s_data, "", et_internal ) ; } static void create_subdirs( char * s_prop, char * s_family ) { char * slash ; char * subdir = owstrdup( s_prop ) ; if ( subdir == NULL ) { return ; } while ( (slash = strrchr( subdir, '/' )) != NULL ) { slash[0] = '\0' ; AddPropertyToTree( subdir, s_family, ft_subdir, 1, ag_separate, ag_numbers, 0, fc_subdir, "", "", "", "", et_none ) ; } owfree(subdir) ; } owfs-2.8p15/module/owlib/src/c/ow_find_external.c0000644000175000017500000000401411741156523016721 00000000000000/* $Id: ow_find_external.c,v 1.3 2012/04/11 01:24:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_external.h" int sensor_compare( const void * a , const void * b ) { const struct sensor_node * na = a ; const struct sensor_node * nb = b ; return strcmp( na->name, nb->name ) ; } struct sensor_node * Find_External_Sensor( char * sensor ) { struct sensor_node sense_key = { .name = sensor, } ; // find sensor node struct { struct sensor_node * key ; char other[0] ; } * opaque = tfind( (void *) (&sense_key), &sensor_tree, sensor_compare ) ; return opaque==NULL ? NULL : opaque->key ; } int property_compare( const void * a , const void * b ) { const struct property_node * na = a ; const struct property_node * nb = b ; int c = strcmp( na->family, nb->family ) ; if ( c==0 ) { return strcmp( na->property, nb->property ) ; } return c ; } struct property_node * Find_External_Property( char * family, char * property ) { struct property_node property_key = { .family = family , .property = property , } ; // find property node struct { struct property_node * key ; char other[0] ; } * opaque = tfind( (void *) (&property_key), &property_tree, property_compare ) ; return opaque==NULL ? NULL : opaque->key ; } int family_compare( const void * a , const void * b ) { const struct family_node * na = a ; const struct family_node * nb = b ; return strcmp( na->family, nb->family ) ; } struct family_node * Find_External_Family( char * family ) { struct family_node family_key = { .family = family, } ; // find family node struct { struct family_node * key ; char other[0] ; } * opaque = tfind( (void *) (&family_key), &family_tree, family_compare ) ; return opaque==NULL ? NULL : opaque->key ; } owfs-2.8p15/module/owlib/src/c/ow_help.c0000644000175000017500000002474311751565563015053 00000000000000/* $Id: ow_help.c,v 1.60 2012/05/06 21:21:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #include #include "owfs_config.h" #include "ow.h" void ow_help_general(void) { switch (Globals.program_type) { case program_type_filesystem: printf("Syntax: %s [options] device mountpoint\n", SAFESTRING(Globals.progname)); break; case program_type_httpd: case program_type_server: case program_type_external: printf("Syntax: %s [options] device clientport\n", SAFESTRING(Globals.progname)); break; case program_type_ftpd: default: printf("Syntax: %s [options] device\n", SAFESTRING(Globals.progname)); break; } printf("\n" "Help resources:\n" " %s --help This page\n" " %s --help=device Bus master device options\n" " %s --help=error List of error return codes\n" " %s --help=program Program services (mountpoint, port)\n" " %s --help=cache Cache and communication timing\n" " %s --help=job Job control and debugging\n" " %s --help=temperature Temperature scale and device format options\n" "\n" " man %s man page for this program\n" " and man pages for individual 1-wire devices e.g. 'man DS2409'\n", SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname), SAFESTRING(Globals.progname) ); } void ow_help_job(void) { printf("Job Control and Information Help\n" "\n" " Information\n" " --error_level n Choose verbosity of error/debugging reports 0=low 9=high\n" " --error_print n Where debug info is placed 0-mixed 1-syslog 2-console\n" " --debug Shortcut for --error_level=9 --foreground\n" " -V --version Program and library versions\n" "\n" " Control\n" " --foreground\n" " --background\n" " --pid_file name file to store pid number (for control scripts)\n" "\n" " Configuration\n" " -c --configuration filename\n" " file to use as additional source of configuration\n" "\n" " Alias\n" " -a --alias filename\n" " file containing device to friendly_name pairs\n" " --unaliased No substitution of alias names in return data\n" " --aliased Substitute alias names in return (Default action)\n" "\n" " Permission\n" " -r --readonly Don't allow writing to 1-wire devices\n" " -w --write Allow writing to 1-wire\n" " --safemode Even more restrictive: readonly, no uncached, ...\n" "\n" ); } void ow_help_temperature(void) { printf("Temperature and Display Help\n" "\n" " 1-wire address format (for display, all will be accepted for input)\n" " f (family code) = 2 hex digits\n" " i (ID) = 12 hex digits\n" " c (crc8) = 2 hex digits\n" " -f --format f[.]i[[.]c]\n" "\n" " Temperature scale\n" " -C --Celsius Celsius(default) temperature scale\n" " -F --Fahrenheit Fahrenheit temperature scale\n" " -K --Kelvin Kelvin temperature scale\n" " -R --Rankine Rankine temperature scale\n" "\n" " Pressure scale\n" " --atm --mbar --inHg --mmHg --Pa --psi (mbar is the default)\n" ); } void ow_help_cache(void) { printf("Cache and Timing Help\n" "\n" " Caching (temporary storage of data in program memory for efficiency)\n" " --uncached Implicit /uncached in all requests\n" " --cached Explicit /uncached needed. (Default action)\n" " --cache_size n Size in bytes of max cache memory. 0 for no limit.\n" "\n" " Cache timing [default] (in seconds)\n" " --timeout_volatile [%3d] Expiration time for changing data (e.g. temperature)\n" " --timeout_stable [%3d] Expiration time for stable data (e.g. temperature limit)\n" " --timeout_directory [%3d] Expiration of directory lists\n" " --timeout_presence [%3d] Expiration of known 1-wire device location\n" " \n" " Communication timing [default] (in seconds)\n" " --timeout_serial [%3d] Timeout for serial port\n" " --timeout_usb [%3d] Timeout for USB transaction\n" " --timeout_network [%3d] Timeout for each network transaction\n" " --timeout_server [%3d] Timeout for first server connection\n" " --timeout_ftp [%3d] Timeout for FTP session\n" " --timeout_ha7 [%3d] Timeout for HA7Net bus master\n" " --timeout_w1 [%3d] Timeout for w1 kernel netlink\n" , Globals.timeout_volatile , Globals.timeout_stable , Globals.timeout_directory , Globals.timeout_presence , Globals.timeout_serial , Globals.timeout_usb , Globals.timeout_network , Globals.timeout_server , Globals.timeout_ftp , Globals.timeout_ha7 , Globals.timeout_w1 ); } void ow_help_error(void) { int return_code ; printf("Error return codes Help\n"); for ( return_code=0 ; return_code < N_RETURN_CODES ; ++return_code ) { printf("%3d. %s\n",return_code,return_code_strings[return_code]); } } void ow_help_program(void) { printf("Program-Specific Help\n" "\n" " owfs (FUSE-based filesystem)\n" " -m --mountpoint path Where to mount virtual 1-wire file system\n" " --fuse_open_opt args Special arguments to pass to FUSE (Quoted and escaped)\n" " --allow_other Allow other users to see owfs file system\n" " needs /etc/fuse.conf setting\n" "\n" " owhttpd (web server)\n" " -p --port [ip:]port TCP address and port number for access\n" " --zero Announce service via zeroconf\n" " --announce name Name for service given in zeroconf broadcast\n" " --nozero Don't announce service via zeroconf\n" "\n" " owserver (OWFS server)\n" " -p --port [ip:]port TCP address and port number for access\n" " --max_connections [%3d] Nr of allowed concurrent connections\n" "\n" " Development tests (owserver only)\n" " --pingcrazy Add lots of keep-alive messages to the owserver protocol\n" " --no_dirall DIRALL fails, drops back to older DIR (individual entries)\n" " --no_get GET fails, drops back to DIRALL and READ\n" " --no_persistence persistent connections refused, drops back to non-persistent\n" "\n" " owftpd (ftp server)\n" " -p --port [ip:]port TCP address and port number for access\n" " has default port 22 (root only)\n" " --zero Announce service via zeroconf\n" " --announce name Name for service given in zeroconf broadcast\n" " --nozero Don't announce service via zeroconf\n" "\n" , Globals.concurrent_connections ); } void ow_help_device(void) { printf("Device Help\n" " More than one device (1-wire bus master) can be specified. All will be used.\n" "\n" " Serial devices (dev is port name, e.g. /dev/ttyS0)\n" " -d dev DS9097U or DS9097 bus master (or LINK in emulation mode)\n" " --8bit Open 8bit (instead of 6) serial-port with DS9097\n" " --baud=1200|9600|19200|38400|57600|115200 Speed of communication to bus master\n" " --serial_flextime | --serial_regulartime (timing adjustments for DS2480B)\n" " --straight_polarity | --reverse_polarity (for DS2480B based bus master)\n" " --LINK=dev Serial LINK bus master (non-emulation)\n" " --HA3=dev Serial HA3 bus master\n" " --HA4B=dev Serial HA4B bus master\n" " --HA5=dev:ah Serial HA5 bus master Channel a and h ( of a-z))\n" " --HA7E=dev Serial HA7E bus master\n" " --HA7S=dev Serial HA7S bus master\n" " --checksum | --no_checksum for HA5\n" " --hard | --no_hard Hardware flow control for serial line\n" "\n" " i2c devices\n" " -d dev DS2482-x00 bus master (dev is /dev/i2c-0)\n" " --i2c=dev DS2482-x00 bus master (dev is /dev/i2c-0)\n" " --i2c=dev:0 DS2482-x00 bus master address 0 of 0-7\n" " --i2c=ALL:ALL DS2482-x00 bus master ALL is wildcard\n" " --ActivePullUp | --no_ActivePullUp See datasheet on APU\n" " --PresencePulseMasking | --no_PresencePulseMasking See datasheet on PPM\n" "\n" "USB\n" " -u --USB DS9490R or PuceBaboon bus master\n" " -uall --USB=all Find and use all DS9490-type bus masters\n" " -u3:4 --USB=3:4 Specific USB location (bus 3, device 4)\n" " -uscan --USB_scan=n Keep looking for new USB adapters (every n seconds; default 10)\n" " -d /dev/ttyUSB0 ECLO USB bus master\n" " --altUSB Change some settings for DS9490 bus master (especially for AAG and DS2423)\n" " --usb_flextime | --usb_regulartime Needed for Louis Swart's LCD module\n" "\n" " Network (address is form [ip:]port, ip DNS name or n.n.n.n, port is port number)\n" " -s address owserver\n" " --LINK=address LINK-HUB-E network LINK\n" " --HA7NET=address HA7NET bus master\n" " --HA7NET HA7NET bus master address auto-discovered\n" " --ENET=address OWServer-Enet bus master\n" " --etherweather=address EtherWeather\n" " --autoserver Find owserver using zeroconf\n" "\n" " Simulated\n" " --fake=list List of devices to simulate (random ID, random data)\n" " use family codes in hex\n" " e.g. 1F,10,21 for DS2409,DS18S20,DS1921\n" " --tester=list List of devices to simulate (non-random ID, non-random data)\n" " --temperature_low=0.0 --temperature_high=100.0 temperature range for fake readings\n" "\n" " Linux Kernel Device\n" " --w1 Scan for kernel-managed bus masters\n" "\n" " --external Allow external scripts to be called\n" " --no_external Do not allow external scripts to be called\n" "\n" " 1-wire device selection\n" " --one-device Only single device on bus, use ROM SKIP command\n"); } void FS_help(const char *arg) { printf("1-WIRE access programs by Paul H Alfille and others.\n" "\n"); if (arg) { switch (arg[0]) { case 'd': case 'D': ow_help_device(); break; case 'e': case 'E': ow_help_error(); break; case 'p': case 'P': ow_help_program(); break; case 'j': case 'J': ow_help_job(); break; case 'c': case 'C': ow_help_cache(); break; case 't': case 'T': ow_help_temperature(); break; default: ow_help_general(); } } else { ow_help_general(); } printf("\n" "Copyright 2003-8 GPLv2 by Paul Alfille. See http://www.owfs.org for support, downloads\n"); } owfs-2.8p15/module/owlib/src/c/getline.c0000664000175000017500000000671011343252221015016 00000000000000/* $Id: getline.c,v 1.3 2010/03/02 18:10:25 alfille Exp $ */ /* getdelim.c --- Implementation of replacement getdelim function. Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Ported from glibc by Simon Josefsson. */ /* modified very slightly for OWFS proect by Paul Alfille * original code, but combine getline and getdelim in same file * Code obtained 3/1/2010 from * http://www.koders.com/c/fid7449041983F5893CBF13458C88271146BA685037.aspx?s=printf * */ #include #include "owfs_config.h" #include "ow.h" #ifndef HAVE_GETLINE #include #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif #if !HAVE_FLOCKFILE # undef flockfile # define flockfile(x) ((void) 0) #endif #if !HAVE_FUNLOCKFILE # undef funlockfile # define funlockfile(x) ((void) 0) #endif static ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) ; ssize_t getline (char **lineptr, size_t *n, FILE *stream) { return getdelim (lineptr, n, '\n', stream); } /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *N characters of space. It is realloc'ed as necessary. Returns the number of characters read (not including the null terminator), or -1 on error or EOF. */ static ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) { ssize_t result; size_t cur_len = 0; if (lineptr == NULL || n == NULL || fp == NULL) { errno = EINVAL; return -1; } flockfile (fp); if (*lineptr == NULL || *n == 0) { *n = 120; *lineptr = (char *) malloc (*n); if (*lineptr == NULL) { result = -1; goto unlock_return; } } for (;;) { int i; i = getc (fp); if (i == EOF) { result = -1; break; } /* Make enough space for len+1 (for final NUL) bytes. */ if (cur_len + 1 >= *n) { size_t needed_max = SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; size_t needed = 2 * *n + 1; /* Be generous. */ char *new_lineptr; if (needed_max < needed) needed = needed_max; if (cur_len + 1 >= needed) { result = -1; goto unlock_return; } new_lineptr = (char *) realloc (*lineptr, needed); if (new_lineptr == NULL) { result = -1; goto unlock_return; } *lineptr = new_lineptr; *n = needed; } (*lineptr)[cur_len] = i; cur_len++; if (i == delimiter) break; } (*lineptr)[cur_len] = '\0'; result = cur_len ? cur_len : result; unlock_return: funlockfile (fp); return result; } #endif /* HAVE_GETLINE */ owfs-2.8p15/module/owlib/src/c/ow_com_read.c0000644000175000017500000000663511707143413015657 00000000000000/* $Id: ow_com_read.c,v 1.25 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif static SIZE_OR_ERROR COM_read_get_size( BYTE * data, size_t length, struct connection_in *connection ) ; // read length bytes. // return BAD if any error or timeout before full length /* Called on head of multibus group */ GOOD_OR_BAD COM_read( BYTE * data, size_t length, struct connection_in *connection) { if ( length == 0 ) { return gbGOOD ; } if ( connection == NO_CONNECTION || data == NULL ) { // bad parameters return gbBAD ; } // unlike write or open, a closed connection isn't automatically opened. // the reason is that reopening won't have the data waiting. We really need // to restart the transaction from the "write" portion if ( FILE_DESCRIPTOR_NOT_VALID( SOC(connection)->file_descriptor ) ) { return gbBAD ; } switch ( SOC(connection)->type ) { // test the type of connection case ct_unknown: case ct_none: LEVEL_DEBUG("Unknown type"); break ; case ct_telnet: return telnet_read( data, length, connection ) ; case ct_tcp: // network is ok return COM_read_get_size( data, length, connection ) == (ssize_t) length ? gbGOOD : gbBAD ; case ct_i2c: case ct_netlink: case ct_usb: LEVEL_DEBUG("Unimplemented"); break ; case ct_serial: // serial is ok // printf("Serial read fd=%d length=%d\n",SOC(connection)->file_descriptor, (int) length); { ssize_t actual = COM_read_get_size( data, length, connection ) ; if ( FILE_DESCRIPTOR_VALID( SOC(connection)->file_descriptor ) ) { // tcdrain only works on serial conections tcdrain( SOC(connection)->file_descriptor ); return actual == (ssize_t) length ? gbGOOD : gbBAD ; } break ; } } return gbBAD ; } // try to read bytes and return number actually read. // Timeout ok /* Called on head of multibus group */ SIZE_OR_ERROR COM_read_with_timeout( BYTE * data, size_t length, struct connection_in *connection) { if ( length == 0 ) { return 0 ; } if ( connection == NO_CONNECTION || data == NULL ) { // bad parameters return -EIO ; } // unlike write or open, a closed connection isn't automatically opened. // the reason is that reopening won't have the data waiting. We really need // to restart the transaction from the "write" portion if ( FILE_DESCRIPTOR_NOT_VALID( SOC(connection)->file_descriptor ) ) { return -EBADF ; } else { size_t actual_size ; ZERO_OR_ERROR zoe = tcp_read( SOC(connection)->file_descriptor, data, length, &(SOC(connection)->timeout), &actual_size ) ; if ( zoe == -EBADF ) { COM_close(connection) ; return zoe ; } else { return actual_size ; } } } // Read only if no errors // Returns actual read size /* Called on head of multibus group */ static SIZE_OR_ERROR COM_read_get_size( BYTE * data, size_t length, struct connection_in *connection ) { size_t actual_size ; ZERO_OR_ERROR zoe = tcp_read( SOC(connection)->file_descriptor, data, length, &(SOC(connection)->timeout), &actual_size ) ; if ( zoe < 0 ) { COM_close(connection) ; return zoe ; } else { return actual_size ; } } owfs-2.8p15/module/owlib/src/c/ow_sibling_uint.c0000664000175000017500000000407111444574647016605 00000000000000/* $Id: ow_sibling_uint.c,v 1.2 2010/09/17 05:16:23 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" ZERO_OR_ERROR FS_r_sibling_U(UINT *U, const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; SIZE_OR_ERROR sib_status ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } sib_status = FS_read_local(owq_sibling) ; U[0] = OWQ_U(owq_sibling) ; OWQ_destroy(owq_sibling) ; return sib_status >= 0 ? 0 : -EINVAL; } ZERO_OR_ERROR FS_w_sibling_U(UINT U, const char * sibling, struct one_wire_query *owq) { ZERO_OR_ERROR write_error; struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } OWQ_U(owq_sibling) = U ; write_error = FS_write_local(owq_sibling) ; OWQ_destroy(owq_sibling) ; return write_error ; } owfs-2.8p15/module/owlib/src/c/error.c0000644000175000017500000002047011662272302014523 00000000000000/* $Id: error.c,v 1.39 2011/11/20 21:44:34 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* error.c stolen nearly verbatim from "Unix Network Programming Volume 1 The Sockets Networking API (3rd Ed)" by W. Richard Stevens, Bill Fenner, Andrew M Rudoff Addison-Wesley Professional Computing Series Addison-Wesley, Boston 2003 http://www.unpbook.com * * Although it's been considerably modified over time -- don't blame the authors'' */ #include #include "owfs_config.h" #include "ow.h" #include #ifdef HAVE_SYS_UIO_H #include #endif /* module/ownet/c/src/c/error.c & module/owlib/src/c/error.c are identical */ #if OW_MT const char mutex_init_failed[] = "mutex_init failed rc=%d [%s]\n"; const char mutex_destroy_failed[] = "mutex_destroy failed rc=%d [%s]\n"; const char mutex_lock_failed[] = "mutex_lock failed rc=%d [%s]\n"; const char mutex_unlock_failed[] = "mutex_unlock failed rc=%d [%s]\n"; const char mutexattr_init_failed[] = "mutexattr_init failed rc=%d [%s]\n"; const char mutexattr_destroy_failed[] = "mutexattr_destroy failed rc=%d [%s]\n"; const char mutexattr_settype_failed[] = "mutexattr_settype failed rc=%d [%s]\n"; const char rwlock_init_failed[] = "rwlock_init failed rc=%d [%s]\n"; const char rwlock_read_lock_failed[] = "rwlock_read_lock failed rc=%d [%s]\n"; const char rwlock_read_unlock_failed[] = "rwlock_read_unlock failed rc=%d [%s]\n"; const char cond_timedwait_failed[] = "cond_timedwait failed rc=%d [%s]\n"; const char cond_signal_failed[] = "cond_signal failed rc=%d [%s]\n"; const char cond_wait_failed[] = "cond_wait failed rc=%d [%s]\n"; const char cond_init_failed[] = "cond_init failed rc=%d [%s]\n"; const char cond_destroy_failed[] = "cond_destroy failed rc=%d [%s]\n"; #endif static void err_format(char * format, int errno_save, const char * level_string, const char * file, int line, const char * func, const char * fmt); static void hex_print( const char * buf, int length ) ; static void ascii_print( const char * buf, int length ) ; /* See man page for explanation */ int log_available = 0; /* Limits for prettier byte printing */ #define HEX_PRINT_BYTES_PER_LINE 16 #define HEX_PRINT_MAX_LINES 4 /* Print message and return to caller * Caller specifies "errnoflag" and "level" */ #define MAXLINE 1023 void err_msg(enum e_err_type errnoflag, enum e_err_level level, const char * file, int line, const char * func, const char *fmt, ...) { int errno_save = (errnoflag==e_err_type_error)?errno:0; /* value caller might want printed */ char format[MAXLINE + 3]; char buf[MAXLINE + 3]; enum e_err_print sl; // 2=console 1=syslog va_list ap; const char * level_string ; switch (level) { case e_err_default: level_string = "DEFAULT: "; break; case e_err_connect: level_string = "CONNECT: "; break; case e_err_call: level_string = " CALL: "; break; case e_err_data: level_string = " DATA: "; break; case e_err_detail: level_string = " DETAIL: "; break; case e_err_debug: case e_err_beyond: default: level_string = " DEBUG: "; break; } /* Print where? */ switch (Globals.error_print) { case e_err_print_mixed: sl = Globals.now_background ? e_err_print_syslog : e_err_print_console; break; case e_err_print_syslog: sl = e_err_print_syslog; break; case e_err_print_console: sl = e_err_print_console; break; default: return; } //printf("About to format an error \n"); va_start(ap, fmt); err_format( format, errno_save, level_string, file, line, func, fmt) ; //printf("About to print an error\n"); UCLIBCLOCK; /* Create output string */ #ifdef HAVE_VSNPRINTF vsnprintf(buf, MAXLINE, format, ap); /* safe */ #else vsprintf(buf, format, ap); /* not safe */ #endif UCLIBCUNLOCK; va_end(ap); //printf("About to output an error \n"); if (sl == e_err_print_syslog) { /* All output to syslog */ if (!log_available) { openlog("OWFS", LOG_PID, LOG_DAEMON); log_available = 1; } syslog(level <= e_err_default ? LOG_INFO : LOG_NOTICE, "%s\n", buf); } else { fflush(stdout); /* in case stdout and stderr are the same */ fputs(buf, stderr); fputs("\n", stderr); fflush(stderr); } //printf("About to leave an error \n"); return; } /* Purely a debugging routine -- print an arbitrary buffer of bytes */ void _Debug_Bytes(const char *title, const unsigned char *buf, int length) { /* title line */ fprintf(stderr,"Byte buffer %s, length=%d", title ? title : "anonymous", (int) length); if (length < 0) { fprintf(stderr,"\n-- Attempt to write with bad length\n"); return; } else if ( length == 0 ) { fprintf(stderr,"\n"); return ; } if (buf == NULL) { fprintf(stderr,"\n-- NULL buffer\n"); return; } hex_print( (const char *) buf, length ) ; ascii_print( (const char *) buf, length ) ; } void fatal_error(const char * file, int line, const char * func, const char *fmt, ...) { va_list ap; char format[MAXLINE + 1]; char buf[MAXLINE + 1]; enum e_err_print sl; // 2=console 1=syslog va_start(ap, fmt); err_format( format, 0, "FATAL ERROR: ", file, line, func, fmt) ; #ifdef OWNETC_OW_DEBUG { fprintf(stderr, "%s:%d ", file, line); #ifdef HAVE_VSNPRINTF vsnprintf(buf, MAXLINE, format, ap); #else vsprintf(buf, fmt, ap); #endif fprintf(stderr, buf); } #else /* OWNETC_OW_DEBUG */ if(Globals.fatal_debug) { #ifdef HAVE_VSNPRINTF vsnprintf(buf, MAXLINE, format, ap); #else vsprintf(buf, format, ap); #endif /* Print where? */ switch (Globals.error_print) { case e_err_print_mixed: sl = Globals.now_background ? e_err_print_syslog : e_err_print_console; break; case e_err_print_syslog: sl = e_err_print_syslog; break; case e_err_print_console: sl = e_err_print_console; break; default: return; } if (sl == e_err_print_syslog) { /* All output to syslog */ if (!log_available) { openlog("OWFS", LOG_PID, LOG_DAEMON); log_available = 1; } syslog(LOG_USER|LOG_INFO, "%s\n", buf); } else { fflush(stdout); /* in case stdout and stderr are the same */ fputs(buf, stderr); fprintf(stderr,"\n"); fflush(stderr); } } if(Globals.fatal_debug_file != NULL) { FILE *fp; char filename[64]; sprintf(filename, "%s.%d", Globals.fatal_debug_file, getpid()); if((fp = fopen(filename, "a")) != NULL) { if(!Globals.fatal_debug) { #ifdef HAVE_VSNPRINTF vsnprintf(buf, MAXLINE, format, ap); #else vsprintf(buf, format, ap); #endif } fprintf(fp, "%s:%d %s\n", file, line, buf); fclose(fp); } } #endif /* OWNETC_OW_DEBUG */ va_end(ap); } static void err_format(char * format, int errno_save, const char * level_string, const char * file, int line, const char * func, const char * fmt) { UCLIBCLOCK; /* Create output string */ #ifdef HAVE_VSNPRINTF if (errno_save) { snprintf(format, MAXLINE, "%s%s:%s(%d) [%s] %s", level_string,file,func,line,strerror(errno_save),fmt); /* safe */ } else { snprintf(format, MAXLINE, "%s%s:%s(%d) %s", level_string,file,func,line,fmt); /* safe */ } #else if (errno_save) { sprintf(format, "%s%s:%s(%d) [%s] %s", level_string,file,func,line,strerror(errno_save),fmt); /* not safe */ } else { sprintf(format, "%s%s:%s(%d) %s", level_string,file,func,line,fmt); /* not safe */ } #endif UCLIBCUNLOCK; /* Add CR at end */ } static void hex_print( const char * buf, int length ) { int i = 0 ; /* hex lines */ for (i = 0; i < length; ++i) { if ((i % HEX_PRINT_BYTES_PER_LINE) == 0) { // switch lines fprintf(stderr,"\n--%3.3d:",i); } fprintf(stderr," %.2X", (unsigned char)buf[i]); if( i >= ( HEX_PRINT_BYTES_PER_LINE * HEX_PRINT_MAX_LINES -1 ) ) { /* Sorry for this, but I think it's better to strip off all huge 8192 packages in the debug-output. */ fprintf(stderr,"\n--%3.3d: == abridged ==",i); break; } } } static void ascii_print( const char * buf, int length ) { int i ; /* char line -- printable or . */ fprintf(stderr,"\n <"); for (i = 0; i < length; ++i) { char c = buf[i]; fprintf(stderr,"%c", isprint(c) ? c : '.'); if(i >= ( HEX_PRINT_BYTES_PER_LINE * HEX_PRINT_MAX_LINES -1 )) { /* Sorry for this, but I think it's better to strip off all huge 8192 packages in the debug-output. */ break; } } fprintf(stderr,">\n"); } owfs-2.8p15/module/owlib/src/c/globals.c0000644000175000017500000000660611751565563015037 00000000000000/* $Id: globals.c,v 1.71 2012/05/06 21:21:55 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_devices.h" /* Globals for port and bus communication */ /* connections globals stored in ow_connect.c */ /* i.e. connection_in * Inbound_Control.head ... */ /* char * pid_file in ow_opt.c */ // some improbably sub-absolute-zero number #define GLOBAL_UNTOUCHED_TEMP_LIMIT (-999.) /* State information, sent to remote or kept locally */ /* cacheenabled, presencecheck, tempscale, devform */ int32_t LocalControlFlags ; // This structure is defined in ow_global.h // These are all the tunable constants and flags. Usually they have // 1 A command line entry (ow_opt.h) // 2 A help entry (ow_help.c) // An entry in /settings (ow_settings.c) struct global Globals = { .announce_off = 0, .announce_name = NULL, .program_type = program_type_swig, .progname = NULL, // "One Wire File System" , Can't allocate here since it's freed .allow_other = 0 , // for fuse .temp_scale = temp_celsius, .pressure_scale = pressure_mbar, .format = fdi, .uncached = 0, .unaliased = 0, .want_background = 1, .now_background = 0, .error_level = e_err_default, .error_print = e_err_print_mixed, .fatal_debug = 0, .fatal_debug_file = NULL, .concurrent_connections = 10, .readonly = 0, .max_clients = 250, .cache_size = 0, .one_device = 0, .altUSB = 0, .usb_flextime = 1, .serial_flextime = 1, .serial_reverse = 0, // 1 is "reverse" polarity .serial_hardflow = 0, // hardware flow control .timeout_volatile = 15, .timeout_stable = 300, .timeout_directory = 60, .timeout_presence = 120, .timeout_serial = 5, // serial read and write use the same timeout currently .timeout_usb = 5, // 5 seconds .timeout_network = 1, .timeout_server = 10, .timeout_ftp = 900, .timeout_ha7 = 60, .timeout_w1 = 30, .timeout_persistent_low = 600, .timeout_persistent_high = 3600, .clients_persistent_low = 10, .clients_persistent_high = 20, .usb_scan_interval = DEFAULT_USB_SCAN_INTERVAL, .pingcrazy = 0, .no_dirall = 0, .no_get = 0, .no_persistence = 0, .eightbit_serial = 0, .zero = zero_unknown , .i2c_APU = 1 , .i2c_PPM = 1 , .baud = B9600 , .templow = GLOBAL_UNTOUCHED_TEMP_LIMIT, .temphigh = GLOBAL_UNTOUCHED_TEMP_LIMIT, // .allow_external = 1 , // for testing .allow_external = 0 , // unless program == owexternal }; // generic value for ignorable function returns int ignore_result ; /* Statistics globals are stored in ow_stats.c */ /* State information, sent to remote or kept locally */ /* cacheenabled, presencecheck, tempscale, devform */ void SetLocalControlFlags( void ) { CONTROLFLAGSLOCK; // Clear LocalControlFlags = 0 ; // Device format LocalControlFlags |= (Globals.format) << DEVFORMAT_BIT ; // Pressure scale LocalControlFlags |= (Globals.pressure_scale) << PRESSURESCALE_BIT ; // Temperature scale LocalControlFlags |= (Globals.temp_scale) << TEMPSCALE_BIT ; // Uncached LocalControlFlags |= Globals.uncached ? UNCACHED : 0 ; // Unaliased LocalControlFlags |= Globals.unaliased ? 0 : ALIAS_REQUEST ; // OWNet flag or Presence check LocalControlFlags |= OWNET ; CONTROLFLAGSUNLOCK; } owfs-2.8p15/module/owlib/src/c/owlib.c0000644000175000017500000001540111742352454014512 00000000000000/* $Id: owlib.c,v 1.187 2012/04/14 19:51:08 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_devices.h" #include "ow_pid.h" static void IgnoreSignals(void); static void SetupTemperatureLimits( void ); static void SetupInboundConnections(void); static GOOD_OR_BAD SetupSingleInboundConnection( struct connection_in * in ) ; /* Start the owlib process -- already in background */ GOOD_OR_BAD LibStart(void) { /* Build device and filetype arrays (including externals) */ DeviceSort(); Globals.zero = zero_none ; #if OW_ZERO #if OW_MT // Avahi only implementd with multithreading if ( GOOD( OW_Load_avahi_library()) ) { Globals.zero = zero_avahi ; //OW_Load_dnssd_library() ; // until avahi browse implemented } else #endif if ( OW_Load_dnssd_library() == 0 ) { Globals.zero = zero_bonjour ; } #endif /* Initialize random number generator, make sure fake devices get the same * id each time */ srand(1); SetupTemperatureLimits() ; MONITOR_WLOCK ; SetupInboundConnections(); MONITOR_WUNLOCK ; // Signal handlers IgnoreSignals(); if ( Inbound_Control.head == NO_CONNECTION ) { LEVEL_DEFAULT("No valid 1-wire buses found"); return gbBAD ; } return gbGOOD ; } // only changes FAKE and MOCK temp limits // do it here after options are parsed to allow correction forr temperature scale static void SetupTemperatureLimits( void ) { struct parsedname pn; FS_ParsedName_Placeholder(&pn); // minimal parsename -- no destroy needed if ( Globals.templow < GLOBAL_UNTOUCHED_TEMP_LIMIT + 1 ) { Globals.templow = 0. ; // freezing point } else { Globals.templow = fromTemperature(Globals.templow,&pn) ; // internal scale } if ( Globals.temphigh < GLOBAL_UNTOUCHED_TEMP_LIMIT + 1 ) { Globals.temphigh = 100. ; // boiling point } else { Globals.temphigh = fromTemperature(Globals.temphigh,&pn) ; // internal scale } LEVEL_DEBUG("Globals temp limits %gC %gC (for simulated adapters)",Globals.templow,Globals.temphigh); } static void SetupInboundConnections(void) { struct connection_in *in = Inbound_Control.head; // cycle through connections analyzing them while (in != NO_CONNECTION) { struct connection_in * next = in->next ; if ( BAD( SetupSingleInboundConnection(in) ) ) { /* flag that that the adapter initiation was unsuccessful */ STAT_ADD1_BUS(e_bus_detect_errors, in); RemoveIn( in ) ; } in = next ; } } static GOOD_OR_BAD SetupSingleInboundConnection( struct connection_in * in ) { switch (get_busmode(in)) { case bus_zero: if ( BAD( Zero_detect(in) )) { LEVEL_CONNECT("Cannot open server at %s", SOC(in)->devicename); return gbBAD ; } break; case bus_server: if (BAD( Server_detect(in)) ) { LEVEL_CONNECT("Cannot open server at %s -- first attempt.", SOC(in)->devicename); sleep(5); // delay to allow owserver to open it's listen socket if ( GOOD( Server_detect(in)) ) { break ; } LEVEL_CONNECT("Cannot open server at %s -- second (and final) attempt.", SOC(in)->devicename); return gbBAD ; } break; case bus_serial: /* Set up DS2480/LINK interface */ if ( BAD( DS2480_detect(in) )) { LEVEL_CONNECT("Cannot detect DS2480 or LINK interface on %s.", SOC(in)->devicename); } else { return gbGOOD ; } // Fall Through in->adapter_name = "DS9097"; // need to set adapter name for this approach to passive adapter case bus_passive: if ( BAD( DS9097_detect(in) )) { LEVEL_DEFAULT("Cannot detect DS9097 (passive) interface on %s.", SOC(in)->devicename); return gbBAD ; } break; case bus_xport: if ( BAD( DS2480_detect(in) )) { LEVEL_DEFAULT("Cannot detect DS2480B via telnet interface on %s.", SOC(in)->devicename); return gbBAD ; } break; case bus_i2c: #if OW_I2C if ( BAD( DS2482_detect(in) )) { LEVEL_CONNECT("Cannot detect an i2c DS2482-x00 on %s", SOC(in)->devicename); return gbBAD ; } #endif /* OW_I2C */ break; case bus_ha7net: #if OW_HA7 if ( BAD( HA7_detect(in) )) { LEVEL_CONNECT("Cannot detect an HA7net server on %s", SOC(in)->devicename); return gbBAD ; } #endif /* OW_HA7 */ break; case bus_enet: #if OW_HA7 if ( BAD( OWServer_Enet_detect(in) )) { LEVEL_CONNECT("Cannot detect an OWServer_Enet on %s", SOC(in)->devicename); return gbBAD ; } #endif /* OW_HA7 */ break; case bus_ha5: if ( BAD( HA5_detect(in) )) { LEVEL_CONNECT("Cannot detect an HA5 on %s", SOC(in)->devicename); return gbBAD ; } break; case bus_ha7e: if ( BAD( HA7E_detect(in) )) { LEVEL_CONNECT("Cannot detect an HA7E/HA7S on %s", SOC(in)->devicename); return gbBAD ; } break; case bus_parallel: #if OW_PARPORT if ( BAD( DS1410_detect(in) )) { LEVEL_DEFAULT("Cannot detect the DS1410E parallel bus master"); return gbBAD ; } #endif /* OW_PARPORT */ break; case bus_usb: #if OW_USB /* in->master.usb.ds1420_address should be set to identify the * adapter just in case it's disconnected. It's done in the * DS9490_next_both() if not set. */ if ( BAD( DS9490_detect(in) )) { LEVEL_DEFAULT("Cannot open USB bus master"); return gbBAD ; } #endif /* OW_USB */ break; case bus_link: if ( BAD( LINK_detect(in) )) { LEVEL_CONNECT("Cannot open LINK bus master at %s", SOC(in)->devicename); return gbBAD ; } break; case bus_etherweather: if ( BAD( EtherWeather_detect(in) )) { LEVEL_CONNECT("Cannot detect an EtherWeather server on %s", SOC(in)->devicename); return gbBAD ; } break; case bus_browse: RETURN_BAD_IF_BAD( Browse_detect(in) ) ; break; case bus_fake: Fake_detect(in); // never fails break; case bus_tester: Tester_detect(in); // never fails break; case bus_mock: Mock_detect(in); // never fails break; case bus_w1_monitor: RETURN_BAD_IF_BAD( W1_monitor_detect(in) ) ; break; case bus_usb_monitor: RETURN_BAD_IF_BAD( USB_monitor_detect(in) ) ; break; case bus_w1: /* w1 is different: it is a dynamic list of adapters */ /* the scanning starts with "W1_Browse" in LibStart and continues in it's own thread */ /* No connection_in entries should have been created for w1 yet */ break ; case bus_external: RETURN_BAD_IF_BAD( External_detect(in) ) ; break; case bus_bad: default: return gbBAD ; break; } return gbGOOD ; } static void IgnoreSignals(void) { struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sigemptyset(&(sa.sa_mask)); sa.sa_flags = 0; sa.sa_handler = SIG_IGN; if (sigaction(SIGPIPE, &sa, NULL) == -1) { LEVEL_DEFAULT("Cannot ignore SIGPIPE"); exit(0); } } owfs-2.8p15/module/owlib/src/c/ow_2415.c0000644000175000017500000002174711740076517014511 00000000000000/* $Id: ow_2415.c,v 1.49 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2415.h" /* ------- Prototypes ----------- */ /* DS2415/DS1904 Digital clock in a can */ READ_FUNCTION(FS_r_counter); WRITE_FUNCTION(FS_w_counter); READ_FUNCTION(FS_r_run); WRITE_FUNCTION(FS_w_run); READ_FUNCTION(FS_r_enable); WRITE_FUNCTION(FS_w_enable); READ_FUNCTION(FS_r_interval); WRITE_FUNCTION(FS_w_interval); READ_FUNCTION(FS_r_itime); WRITE_FUNCTION(FS_w_itime); READ_FUNCTION(FS_r_control); WRITE_FUNCTION(FS_w_control); READ_FUNCTION(FS_r_user); WRITE_FUNCTION(FS_w_user); /* ------- Structures ----------- */ static struct aggregate A2415 = { 4, ag_numbers, ag_aggregate, }; static struct filetype DS2415[] = { F_STANDARD, {"ControlRegister", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_control, FS_w_control, INVISIBLE, NO_FILETYPE_DATA, }, {"user", PROPERTY_LENGTH_UNSIGNED, &A2415, ft_bitfield, fc_link, FS_r_user, FS_w_user, VISIBLE, NO_FILETYPE_DATA, }, {"running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_run, FS_w_run, VISIBLE, NO_FILETYPE_DATA, }, {"udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, NO_FILETYPE_DATA, }, {"date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"udate"}, }, }; DeviceEntry(24, DS2415, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS2417[] = { F_STANDARD, {"ControlRegister", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_control, FS_w_control, INVISIBLE, NO_FILETYPE_DATA, }, {"enable", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_enable, FS_w_enable, VISIBLE, NO_FILETYPE_DATA, }, {"interval", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_link, FS_r_interval, FS_w_interval, VISIBLE, NO_FILETYPE_DATA, }, {"itime", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_integer, fc_link, FS_r_itime, FS_w_itime, VISIBLE, NO_FILETYPE_DATA, }, {"running", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_link, FS_r_run, FS_w_run, VISIBLE, NO_FILETYPE_DATA, }, {"udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, NO_FILETYPE_DATA, }, {"date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"udate"}, }, }; DeviceEntry(27, DS2417, NO_GENERIC_READ, NO_GENERIC_WRITE); static int itimes[] = { 1, 4, 32, 64, 2048, 4096, 65536, 131072, }; #define _1W_READ_CLOCK 0x66 #define _1W_WRITE_CLOCK 0x99 #define _MASK_DS2415_USER 0xF0 #define _MASK_DS2415_OSC 0x0C #define _MASK_DS2417_IE 0x80 #define _MASK_DS2417_IS 0x70 /* ------- Functions ------------ */ /* DS2415/DS1904 Digital clock in a can */ /* DS2415 & DS2417 */ static GOOD_OR_BAD OW_r_udate(UINT * U, const struct parsedname *pn); static GOOD_OR_BAD OW_r_control(BYTE * cr, const struct parsedname *pn); static GOOD_OR_BAD OW_w_udate(UINT control_reg, UINT U, const struct parsedname * pn); static GOOD_OR_BAD OW_w_control(const BYTE cr, const struct parsedname *pn); /* DS2417 interval */ static ZERO_OR_ERROR FS_r_interval(struct one_wire_query *owq) { UINT U = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_U(owq) = ( U & _MASK_DS2417_IS ) >> 4 ; return z_or_e ; } static ZERO_OR_ERROR FS_w_interval(struct one_wire_query *owq) { UINT U = ( OWQ_U(owq) << 4 ) & _MASK_DS2417_IS ; // Move to upper nibble return FS_w_sibling_bitwork( U, _MASK_DS2417_IS, "ControlRegister", owq ) ; } /* DS2415 User bits */ static ZERO_OR_ERROR FS_r_user(struct one_wire_query *owq) { UINT U = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_U(owq) = ( U & _MASK_DS2415_USER ) >> 4 ; return z_or_e ; } static ZERO_OR_ERROR FS_w_user(struct one_wire_query *owq) { UINT U = ( OWQ_U(owq) << 4 ) & _MASK_DS2415_USER ; // Move to upper nibble return FS_w_sibling_bitwork( U, _MASK_DS2415_USER, "ControlRegister", owq ) ; } /* DS2415-DS2417 Oscillator control */ static ZERO_OR_ERROR FS_r_run(struct one_wire_query *owq) { UINT U = 0; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_Y(owq) = ( ( U & _MASK_DS2415_OSC ) != 0 ) ; return z_or_e ; } static ZERO_OR_ERROR FS_w_run(struct one_wire_query *owq) { UINT U = OWQ_Y(owq) ? _MASK_DS2415_OSC : 0 ; return FS_w_sibling_bitwork( U, _MASK_DS2415_OSC, "ControlRegister", owq ) ; } /* DS2417 interrupt enable */ static ZERO_OR_ERROR FS_r_enable(struct one_wire_query *owq) { UINT U = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &U, "ControlRegister", owq ) ; OWQ_Y(owq) = ( ( U & _MASK_DS2417_IE ) != 0 ) ; return z_or_e ; } static ZERO_OR_ERROR FS_w_enable(struct one_wire_query *owq) { UINT U = OWQ_Y(owq) ? _MASK_DS2417_IE : 0 ; return FS_w_sibling_bitwork( U, _MASK_DS2417_IE, "ControlRegister", owq ) ; } /* DS1915 Control Register */ static ZERO_OR_ERROR FS_r_control(struct one_wire_query *owq) { BYTE cr ; if ( OW_r_control( &cr, PN(owq) ) ) { return -EINVAL ; } OWQ_U(owq) = cr ; return 0 ; } static ZERO_OR_ERROR FS_w_control(struct one_wire_query *owq) { return OW_w_control( OWQ_U(owq) & 0xFF, PN(owq) ) ? -EINVAL : 0 ; } /* DS2415 - DS2417 couter verions of date */ static ZERO_OR_ERROR FS_r_counter(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_r_udate( &(OWQ_U(owq)), PN(owq) ) ) ; } static ZERO_OR_ERROR FS_w_counter(struct one_wire_query *owq) { UINT control_reg ; // included in write /* read in existing control byte to preserve bits 4-7 */ if ( FS_r_sibling_U( &control_reg, "ControlRegister", owq) != 0 ) { return gbBAD; } return GB_to_Z_OR_E( OW_w_udate( control_reg, OWQ_U(owq), PN(owq) ) ) ; } /* DS2417 interval time (in seconds) */ static ZERO_OR_ERROR FS_w_itime(struct one_wire_query *owq) { UINT IS ; int I = OWQ_I(owq); if (I == 0) { /* Special case -- 0 time equivalent to disable */ return FS_w_sibling_Y( 0, "enable", owq ) ; } else if (I == 1) { IS = 0 ; // 1 sec } else if (I <= 4) { IS = 1 ; // 4 sec } else if (I <= 32) { IS = 2 ; // 32 sec } else if (I <= 64) { IS = 3 ; // 64 sec ~1 min } else if (I <= 2048) { IS = 4 ; // 2048 sec ~30 min } else if (I <= 4096) { IS = 5 ; // 4096 sec ~1 hr } else if (I <= 65536) { IS = 6 ; // 65536 sec ~18 hr } else { IS = 7 ; // 131072 sec ~36 hr } /* Set interval */ if ( FS_w_sibling_U( IS, "interval", owq ) != 0 ) { return -EINVAL ; } /* Enable as well */ return FS_w_sibling_Y( 1, "enable", owq) ; } static ZERO_OR_ERROR FS_r_itime(struct one_wire_query *owq) { UINT interval = 0; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &interval, "interval", owq) ; OWQ_I(owq) = itimes[interval]; return z_or_e ; } /* 1904 clock-in-a-can */ static GOOD_OR_BAD OW_r_control(BYTE * cr, const struct parsedname *pn) { BYTE r[1] = { _1W_READ_CLOCK, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(r), TRXN_READ1(cr), TRXN_END, }; return BUS_transaction(t, pn) ; } /* 1904 clock-in-a-can */ static GOOD_OR_BAD OW_r_udate(UINT * U, const struct parsedname *pn) { BYTE r[1] = { _1W_READ_CLOCK, }; BYTE data[5]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(r), TRXN_READ(data, 5), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; U[0] = UT_int32(&data[1]); return gbGOOD; } static GOOD_OR_BAD OW_w_udate(UINT control_reg, UINT U, const struct parsedname *pn) { BYTE w[6] = { _1W_WRITE_CLOCK, }; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(w, 6), TRXN_END, }; w[1] = control_reg & 0xFF ; UT_uint32_to_bytes( U, &w[2] ); return BUS_transaction(twrite, pn) ; } static GOOD_OR_BAD OW_w_control(const BYTE cr, const struct parsedname *pn) { BYTE w[2] = { _1W_WRITE_CLOCK, cr, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(w), TRXN_END, }; /* read in existing control byte to preserve bits 4-7 */ return BUS_transaction(t, pn) ; } owfs-2.8p15/module/owlib/src/c/ow_rwlock.c0000664000175000017500000000326011371330656015404 00000000000000/* $Id: ow_rwlock.c,v 1.12 2010/05/08 18:47:10 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* locks are to handle multithreading */ #include #include "owfs_config.h" #include "ow.h" #if OW_MT void my_rwlock_init(my_rwlock_t * my_rwlock) { _MUTEX_INIT(my_rwlock->protect_reader_count); sem_init(&(my_rwlock->allow_readers), 0, 1); sem_init(&(my_rwlock->no_processes), 0, 1); my_rwlock->reader_count = 1; } inline void my_rwlock_write_lock(my_rwlock_t * my_rwlock) { sem_wait(&(my_rwlock->allow_readers)); sem_wait(&(my_rwlock->no_processes)); } inline void my_rwlock_write_unlock(my_rwlock_t * my_rwlock) { sem_post(&(my_rwlock->allow_readers)); sem_post(&(my_rwlock->no_processes)); } inline void my_rwlock_read_lock(my_rwlock_t * my_rwlock) { sem_wait(&(my_rwlock->allow_readers)); sem_post(&(my_rwlock->allow_readers)); _MUTEX_LOCK(my_rwlock->protect_reader_count); if (++my_rwlock->reader_count == 1) { sem_wait(&(my_rwlock->no_processes)); } _MUTEX_UNLOCK(my_rwlock->protect_reader_count); } inline void my_rwlock_read_unlock(my_rwlock_t * my_rwlock) { _MUTEX_LOCK(my_rwlock->protect_reader_count); if (--my_rwlock->reader_count == 0) { sem_post(&(my_rwlock->no_processes)); } _MUTEX_UNLOCK(my_rwlock->protect_reader_count); } void my_rwlock_destroy(my_rwlock_t * my_rwlock) { _MUTEX_DESTROY(my_rwlock->protect_reader_count); sem_destroy(&(my_rwlock->allow_readers)); sem_destroy(&(my_rwlock->no_processes)); } #endif /* OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_avahi_browse.c0000644000175000017500000001757111704646270016566 00000000000000/* $Id: ow_avahi_browse.c,v 1.22 2012/01/15 22:01:28 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #ifdef HAVE_STDLIB_H #include "stdlib.h" // need this for NULL #endif /* HAVE_STDLIB_H */ #if OW_ZERO && OW_MT && ! OW_CYGWIN #include "ow_connection.h" #ifdef HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #ifdef HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ /* Prototypes */ static int AvahiBrowserNetName( const AvahiAddress *address, int port, struct connection_in * in ) ; static void resolve_callback( AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interface, AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *address, uint16_t port, void *txt, AvahiLookupResultFlags flags, void* v) ; static void browse_callback( AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void* v) ; static void client_callback(AvahiClient *c, AvahiClientState state, void * v) ; /* Code */ /* Resolve callback -- a new owserver was found and resolved, add it to the list */ static void resolve_callback( AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interface, AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *address, uint16_t port, void *txt, AvahiLookupResultFlags flags, void* v) { struct connection_in * in = v; (void) host_name ; (void) txt ; (void) flags ; /* Called whenever a service has been resolved successfully or timed out */ switch (event) { case AVAHI_RESOLVER_FAILURE: LEVEL_DEBUG( "Failed to resolve service '%s' of type '%s' in domain '%s': %s", name, type, domain, avahi_strerror(avahi_client_errno(in->master.browse.avahi_client))); break; case AVAHI_RESOLVER_FOUND: LEVEL_DEBUG( "Service '%s' of type '%s' in domain '%s'", name, type, domain); if ( AvahiBrowserNetName( address, port, in ) ) { break ; } ZeroAdd( name, type, domain, in->master.browse.avahi_host, in->master.browse.avahi_service ) ; break ; } avahi_service_resolver_free(r); } static int AvahiBrowserNetName( const AvahiAddress *address, int port, struct connection_in * in ) { memset(in->master.browse.avahi_host,0,sizeof(in->master.browse.avahi_host)) ; memset(in->master.browse.avahi_service,0,sizeof(in->master.browse.avahi_service)) ; UCLIBCLOCK ; snprintf(in->master.browse.avahi_service, sizeof(in->master.browse.avahi_service),"%d",port) ; UCLIBCUNLOCK ; switch (address->proto) { case AVAHI_PROTO_INET: /**< IPv4 */ if ( inet_ntop( AF_INET, (const void *)&(address->data.ipv4), in->master.browse.avahi_host, sizeof(in->master.browse.avahi_host)) != NULL ) { LEVEL_DEBUG( "Address '%s' Port %d", in->master.browse.avahi_host, port); return 0 ; } break ; #if __HAS_IPV6__ case AVAHI_PROTO_INET6: /**< IPv6 */ if ( inet_ntop( AF_INET6, (const void *)&(address->data.ipv6), in->master.browse.avahi_host, sizeof(in->master.browse.avahi_host)) != NULL ) { LEVEL_DEBUG( "Address '%s' Port %d", in->master.browse.avahi_host, port); return 0 ; } break ; #endif /* __HAS_IPV6__ */ default: strncpy(in->master.browse.avahi_host,"Unknown address",sizeof(in->master.browse.avahi_host)) ; LEVEL_DEBUG( "Unknown internet protocol"); break ; } return 1 ; } static void browse_callback( AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void* v) { struct connection_in * in = v; in->master.browse.avahi_browser = b ; /* Called whenever a new services becomes available on the LAN or is removed from the LAN */ switch (event) { case AVAHI_BROWSER_FAILURE: LEVEL_DEBUG( "%s", avahi_strerror(avahi_client_errno(in->master.browse.avahi_client))); avahi_simple_poll_quit(in->master.browse.avahi_poll); break; case AVAHI_BROWSER_NEW: LEVEL_DEBUG( "NEW: service '%s' of type '%s' in domain '%s' protocol %d", name, type, domain, (int) protocol); /* We ignore the returned resolver object. In the callback function we free it. If the server is terminated before the callback function is called the server will free the resolver for us. */ if (!(avahi_service_resolver_new(in->master.browse.avahi_client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, in))) { LEVEL_DEBUG( "Failed to resolve service '%s': %s", name, avahi_strerror(avahi_client_errno(in->master.browse.avahi_client))); } break; case AVAHI_BROWSER_REMOVE: LEVEL_DEBUG( "REMOVE: service '%s' of type '%s' in domain '%s'", name, type, domain); ZeroDel(name, type, domain ) ; break; case AVAHI_BROWSER_ALL_FOR_NOW: LEVEL_DEBUG( "ALL_FOR_NOW" ); break; case AVAHI_BROWSER_CACHE_EXHAUSTED: LEVEL_DEBUG( "CACHE_EXHAUSTED" ); break; } } static void client_callback(AvahiClient *c, AvahiClientState state, void * v) { struct connection_in * in = v; in->master.browse.avahi_client = c ; /* Called whenever the client or server state changes */ if (state == AVAHI_CLIENT_FAILURE) { LEVEL_DEBUG( "Server connection failure: %s", avahi_strerror(avahi_client_errno(c))); avahi_simple_poll_quit(in->master.browse.avahi_poll); } } void * OW_Avahi_Browse(void * v) { struct connection_in * in = v ; int error; DETACH_THREAD; /* Create main loop object */ in->master.browse.avahi_client = NULL ; in->master.browse.avahi_browser = NULL ; in->master.browse.avahi_poll = avahi_simple_poll_new() ; /* Check whether creating the loop object succeeded */ if (in->master.browse.avahi_poll!=NULL) { const AvahiPoll * simple_poll = avahi_simple_poll_get(in->master.browse.avahi_poll) ; /* Create a new client */ in->master.browse.avahi_client = avahi_client_new( simple_poll, AVAHI_CLIENT_NO_FAIL, client_callback, (void *) in, &error ); /* Check whether creating the client object succeeded */ if (in->master.browse.avahi_client!=NULL) { /* Create a new browser */ in->master.browse.avahi_browser = avahi_service_browser_new(in->master.browse.avahi_client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_owserver._tcp", NULL, 0, browse_callback, (void *) in); /* Check whether creating the browser object succeeded */ if (in->master.browse.avahi_browser!=NULL) { /* Run the main loop */ MONITOR_RLOCK ; avahi_simple_poll_loop(in->master.browse.avahi_poll); MONITOR_RUNLOCK ; /* Free the browser object */ avahi_service_browser_free(in->master.browse.avahi_browser); in->master.browse.avahi_browser = NULL ; } else { LEVEL_DEBUG( "Failed to create service browser: %s", avahi_strerror(avahi_client_errno(in->master.browse.avahi_client))); } /* Free the client object */ avahi_client_free(in->master.browse.avahi_client); in->master.browse.avahi_client = NULL ; } else { LEVEL_DEBUG( "Failed to create client: %s", avahi_strerror(error)); } /* Free the loop object */ avahi_simple_poll_free(in->master.browse.avahi_poll); in->master.browse.avahi_poll = NULL ; } else { LEVEL_DEBUG( "Failed to create simple poll object."); } return VOID_RETURN; } #else /* OW_ZERO && OW_MT && ! OW_CYGWIN */ void * OW_Avahi_Browse(void * v) { (void) v ; return VOID_RETURN ; } #endif /* OW_ZERO && OW_MT && ! OW_CYGWIN */ owfs-2.8p15/module/owlib/src/c/ow_fs_crc8.c0000664000175000017500000000320311352033033015413 00000000000000/* $Id: ow_fs_crc8.c,v 1.3 2010/03/23 03:31:39 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" /* ------- Prototypes ------------ */ /* ------- Functions ------------ */ ZERO_OR_ERROR FS_crc8(struct one_wire_query *owq) { ASCII crc[2]; struct parsedname *pn = PN(owq); num2string(crc, pn->sn[7]); return OWQ_format_output_offset_and_size(crc, 2, owq); } owfs-2.8p15/module/owlib/src/c/ow_parseobject.c0000664000175000017500000002326711756246276016430 00000000000000/* $Id: ow_parseobject.c,v 1.60 2011/04/05 19:03:37 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" static GOOD_OR_BAD OWQ_allocate_array( struct one_wire_query * owq ) ; static GOOD_OR_BAD OWQ_parsename(const char *path, struct one_wire_query *owq); static GOOD_OR_BAD OWQ_parsename_plus(const char *path, const char * file, struct one_wire_query *owq); #define OWQ_DEFAULT_READ_BUFFER_SIZE 1 /* Create the Parsename structure and create the buffer */ struct one_wire_query * OWQ_create_from_path(const char *path) { int sz = sizeof( struct one_wire_query ) + OWQ_DEFAULT_READ_BUFFER_SIZE; struct one_wire_query * owq = owmalloc( sz ); LEVEL_DEBUG("%s", path); if ( owq== NO_ONE_WIRE_QUERY) { LEVEL_DEBUG("No memory to create object for path %s",path) ; return NO_ONE_WIRE_QUERY ; } memset(owq, 0, sz); OWQ_cleanup(owq) = owq_cleanup_owq ; if ( GOOD( OWQ_parsename(path,owq) ) ) { if ( GOOD( OWQ_allocate_array(owq)) ) { /* Add a 1 byte buffer by default. This distinguishes from filesystem calls at end of buffer */ /* Read bufer is provided by OWQ_assign_read_buffer or OWQ_allocate_read_buffer */ OWQ_buffer(owq) = (char *) (& owq[1]) ; // point just beyond the one_wire_query struct OWQ_size(owq) = OWQ_DEFAULT_READ_BUFFER_SIZE ; return owq ; } OWQ_destroy(owq); } return NO_ONE_WIRE_QUERY ; } /* Create the Parsename structure and load the relevant fields */ struct one_wire_query * OWQ_create_sibling(const char *sibling, struct one_wire_query *owq_original) { char path[PATH_MAX] ; struct parsedname * pn_original = PN(owq_original) ; int dirlength = pn_original->dirlength ; struct one_wire_query * owq_sib ; strncpy(path, pn_original->path,dirlength) ; strcpy(&path[dirlength],sibling) ; if ( pn_original->selected_filetype == NO_FILETYPE ) { if ( pn_original->subdir == NO_SUBDIR ) { // not a filetype or a subdir return NO_ONE_WIRE_QUERY ; } // Add extension only if original property is aggregate } else if ( pn_original->selected_filetype->ag != NON_AGGREGATE ) { // search for sibling in the filetype array struct filetype * sib_filetype = bsearch(sibling, pn_original->selected_device->filetype_array, (size_t) pn_original->selected_device->count_of_filetypes, sizeof(struct filetype), filetype_cmp) ; // see if sibling is also an aggregate property LEVEL_DEBUG("Path %s is an agggregate",SAFESTRING(pn_original->path)); if ( sib_filetype != NO_FILETYPE && sib_filetype->ag != NON_AGGREGATE ) { char * aggregate_point = path + strlen(path) ; LEVEL_DEBUG("Sibling is also an aggregate",sibling); if (pn_original->extension == EXTENSION_BYTE ) { strcpy( aggregate_point, ".BYTE" ) ; } else if (pn_original->extension == EXTENSION_ALL ) { strcpy( aggregate_point, ".ALL" ) ; } else if (sib_filetype->ag->letters == ag_letters) { UCLIBCLOCK; snprintf(aggregate_point, OW_FULLNAME_MAX, ".%c", pn_original->extension + 'A'); UCLIBCUNLOCK; } else { UCLIBCLOCK; snprintf(aggregate_point, OW_FULLNAME_MAX, ".%d", pn_original->extension ); UCLIBCUNLOCK; } } } LEVEL_DEBUG("Create sibling %s from %s as %s", sibling, pn_original->path,path); owq_sib = OWQ_create_from_path(path) ; if ( owq_sib != NO_ONE_WIRE_QUERY ) { // Sib has no offset OWQ_offset(owq_sib) = 0 ; // Make uncached as restrictive as original // Make unaliased as restrictive as original PN(owq_sib)->state |= (pn_original->state & (ePS_uncached|ePS_unaliased) ) ; return owq_sib ; } return NO_ONE_WIRE_QUERY ; } /* Use an aggregate OWQ as a template for a single element */ struct one_wire_query * OWQ_create_separate( int extension, struct one_wire_query * owq_aggregate ) { int sz = sizeof( struct one_wire_query ) + OWQ_DEFAULT_READ_BUFFER_SIZE; struct one_wire_query * owq_sep = owmalloc( sz ); LEVEL_DEBUG("%s with extension %d", PN(owq_aggregate)->path,extension); if ( owq_sep== NO_ONE_WIRE_QUERY) { LEVEL_DEBUG("No memory to create object for extension %d",extension) ; return NO_ONE_WIRE_QUERY ; } memset(owq_sep, 0, sz); OWQ_cleanup(owq_sep) = owq_cleanup_owq ; memcpy( PN(owq_sep), PN(owq_aggregate), sizeof(struct parsedname) ) ; PN(owq_sep)->extension = extension ; OWQ_buffer(owq_sep) = (char *) (& owq_sep[1]) ; // point just beyond the one_wire_query struct OWQ_size(owq_sep) = OWQ_DEFAULT_READ_BUFFER_SIZE ; OWQ_offset(owq_sep) = 0 ; return owq_sep ; } /* Use an single OWQ as a template for the aggregate one */ struct one_wire_query * OWQ_create_aggregate( struct one_wire_query * owq_single ) { int sz = sizeof( struct one_wire_query ) + OWQ_DEFAULT_READ_BUFFER_SIZE; struct one_wire_query * owq_all = owmalloc( sz ); LEVEL_DEBUG("%s with extension ALL", PN(owq_single)->path); if ( owq_all == NO_ONE_WIRE_QUERY) { LEVEL_DEBUG("No memory to create object for extension ALL") ; return NO_ONE_WIRE_QUERY ; } memset(owq_all, 0, sz); OWQ_cleanup(owq_all) = owq_cleanup_owq ; memcpy( PN(owq_all), PN(owq_single), sizeof(struct parsedname) ) ; PN(owq_all)->extension = EXTENSION_ALL ; OWQ_buffer(owq_all) = (char *) (& owq_all[1]) ; // point just beyond the one_wire_query struct OWQ_size(owq_all) = OWQ_DEFAULT_READ_BUFFER_SIZE ; OWQ_offset(owq_all) = 0 ; if ( BAD( OWQ_allocate_array(owq_all)) ) { OWQ_destroy(owq_all); return NO_ONE_WIRE_QUERY ; } return owq_all ; } /* Create the Parsename structure and load the relevant fields */ GOOD_OR_BAD OWQ_create(const char *path, struct one_wire_query *owq) { LEVEL_DEBUG("%s", path); if ( GOOD( OWQ_parsename(path,owq) ) ) { if ( GOOD( OWQ_allocate_array(owq)) ) { return gbGOOD ; } OWQ_destroy(owq); } return gbBAD ; } /* Create the Parsename structure (using path and file) and load the relevant fields */ /* Starts with a statically allocated owq space */ GOOD_OR_BAD OWQ_create_plus(const char *path, const char *file, struct one_wire_query *owq) { LEVEL_DEBUG("%s + %s", path, file); OWQ_cleanup(owq) = owq_cleanup_none ; if ( GOOD( OWQ_parsename_plus(path,file,owq) ) ) { if ( GOOD( OWQ_allocate_array(owq)) ) { return gbGOOD ; } OWQ_destroy(owq); } return gbBAD ; } /* Create the Parsename structure in owq */ static GOOD_OR_BAD OWQ_parsename(const char *path, struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if ( FS_ParsedName(path, pn) != 0 ) { return gbBAD ; } OWQ_cleanup(owq) |= owq_cleanup_pn ; return gbGOOD ; } static GOOD_OR_BAD OWQ_parsename_plus(const char *path, const char * file, struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if ( FS_ParsedNamePlus(path, file, pn) != 0 ) { return gbBAD ; } OWQ_cleanup(owq) |= owq_cleanup_pn ; return gbGOOD ; } static GOOD_OR_BAD OWQ_allocate_array( struct one_wire_query * owq ) { struct parsedname * pn = PN(owq) ; if (pn->extension == EXTENSION_ALL && pn->type != ePN_structure) { OWQ_array(owq) = owcalloc((size_t) pn->selected_filetype->ag->elements, sizeof(union value_object)); if (OWQ_array(owq) == NO_ONE_WIRE_QUERY) { return gbBAD ; } OWQ_cleanup(owq) |= owq_cleanup_array ; } else { OWQ_I(owq) = 0; } return gbGOOD ; } void OWQ_assign_read_buffer(char *buffer, size_t size, off_t offset, struct one_wire_query *owq) { OWQ_buffer(owq) = buffer; //OWQ_read_buffer(owq) = NULL ; //OWQ_write_buffer(owq) = NULL ; OWQ_size(owq) = size; OWQ_offset(owq) = offset; } void OWQ_assign_write_buffer(const char *buffer, size_t size, off_t offset, struct one_wire_query *owq) { OWQ_buffer(owq) = buffer; //OWQ_read_buffer(owq) = NULL ; //OWQ_write_buffer(owq) = NULL ; OWQ_size(owq) = size; OWQ_offset(owq) = offset; } // create the buffer of size filesize GOOD_OR_BAD OWQ_allocate_read_buffer(struct one_wire_query * owq ) { struct parsedname * pn = PN(owq) ; size_t size = FullFileLength(pn); if ( size > 0 ) { char * buffer = owmalloc(size+1) ; if ( buffer == NULL ) { return gbBAD ; } memset(buffer,0,size+1) ; OWQ_buffer(owq) = buffer ; OWQ_size(owq) = size ; OWQ_offset(owq) = 0 ; OWQ_cleanup(owq) |= owq_cleanup_buffer ; } return gbGOOD; } GOOD_OR_BAD OWQ_allocate_write_buffer( const char * write_buffer, size_t buffer_length, off_t offset, struct one_wire_query * owq ) { char * buffer_copy ; if ( buffer_length == 0 ) { // Buffer size is zero. Allowed, but make it NULL and no cleanup needed. OWQ_size(owq) = 0 ; OWQ_offset(owq) = 0 ; return gbGOOD ; } buffer_copy = owmalloc( buffer_length+1) ; if ( buffer_copy == NULL) { // cannot allocate space for buffer LEVEL_DEBUG("Cannot allocate %ld bytes for buffer", buffer_length) ; OWQ_size(owq) = 0 ; OWQ_offset(owq) = 0 ; return gbBAD ; } memcpy( buffer_copy, write_buffer, buffer_length) ; buffer_copy[buffer_length] = '\0' ; // make sure it's zero-ended OWQ_buffer(owq) = buffer_copy ; OWQ_size(owq) = buffer_length ; OWQ_length(owq) = buffer_length ; OWQ_offset(owq) = offset ; OWQ_cleanup(owq) |= owq_cleanup_buffer ; // buffer needs cleanup return gbGOOD ; } void OWQ_destroy(struct one_wire_query *owq) { if ( owq == NO_ONE_WIRE_QUERY) { return ; } if ( OWQ_cleanup(owq) & owq_cleanup_buffer ) { owfree(OWQ_buffer(owq)) ; } if ( OWQ_cleanup(owq) & owq_cleanup_rbuffer ) { //owfree(OWQ_read_buffer(owq)) ; } if ( OWQ_cleanup(owq) & owq_cleanup_array ) { owfree(OWQ_array(owq)) ; } if ( OWQ_cleanup(owq) & owq_cleanup_pn ) { FS_ParsedName_destroy(PN(owq)) ; } if ( OWQ_cleanup(owq) & owq_cleanup_owq ) { owfree(owq) ; } else { OWQ_cleanup(owq) = owq_cleanup_none ; } } owfs-2.8p15/module/owlib/src/c/ow_delay.c0000664000175000017500000000377711440235033015204 00000000000000/* $Id: ow_delay.c,v 1.10 2010/09/03 18:10:35 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" //-------------------------------------------------------------------------- // Description: // Delay for at least 'len' ms // void UT_delay(const UINT len) { UT_delay_us( len * 1000 ) ; } //-------------------------------------------------------------------------- // Description: // Delay for at least 'len' us // void UT_delay_us(const unsigned long len) { #ifdef DELAY_BUSY_WHILE /* Just a test to create a busy-while-loop and trace wait time. */ struct timeval rem = { len / 1000000, len % 1000000 } ; struct timeval tv, tvnow; int i, j = 0; if (len == 0) { return; } timernow( &tv ); timeradd( &tv, &rem, &tv ); do { timernow( &tvnow ); for (i = 0; i < 10; i++) { j += i; } } while ( timercmp( &tvnow, &tv, < ) ) ; #else /* DELAY_BUSY_WHILE */ #ifdef HAVE_NANOSLEEP struct timespec s; struct timespec rem = { len / 1000000, 1000 * (len % 1000000) } ; if (len == 0) { return; } while (1) { s.tv_sec = rem.tv_sec; s.tv_nsec = rem.tv_nsec; if (nanosleep(&s, &rem) < 0) { if (errno != EINTR) { break; } /* was interupted... continue sleeping... */ //printf("UT_delay: EINTR s=%ld.%ld r=%ld.%ld: %s\n", s.tv_sec, s.tv_nsec, rem.tv_sec, rem.tv_nsec, strerror(errno)); #ifdef __UCLIBC__ errno = 0; // clear errno every time in uclibc at least #endif /* __UCLIBC__ */ } else { /* completed sleeping */ break; } } #ifdef __UCLIBC__ errno = 0; // clear errno in uclibc at least #endif /* __UCLIBC__ */ #else /* HAVE_NANOSLEEP */ usleep((unsigned long) len); #endif /* HAVE_NANOSLEEP */ #endif /* DELAY_BUSY_WHILE */ } owfs-2.8p15/module/owlib/src/c/ow_crc.c0000664000175000017500000000676611026222111014647 00000000000000/* $Id: ow_crc.c,v 1.19 2008/06/18 15:05:45 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" /* ---------------------------------------------- */ /* CRC and Hex utility functions */ /* ---------------------------------------------- */ /* CRC stuff from PDKit */ static BYTE crc8_table[] = { 0x00, 0x5E, 0xBC, 0xE2, 0x61, 0x3F, 0xDD, 0x83, 0xC2, 0x9C, 0x7E, 0x20, 0xA3, 0xFD, 0x1F, 0x41, 0x9D, 0xC3, 0x21, 0x7F, 0xFC, 0xA2, 0x40, 0x1E, 0x5F, 0x01, 0xE3, 0xBD, 0x3E, 0x60, 0x82, 0xDC, 0x23, 0x7D, 0x9F, 0xC1, 0x42, 0x1C, 0xFE, 0xA0, 0xE1, 0xBF, 0x5D, 0x03, 0x80, 0xDE, 0x3C, 0x62, 0xBE, 0xE0, 0x02, 0x5C, 0xDF, 0x81, 0x63, 0x3D, 0x7C, 0x22, 0xC0, 0x9E, 0x1D, 0x43, 0xA1, 0xFF, 0x46, 0x18, 0xFA, 0xA4, 0x27, 0x79, 0x9B, 0xC5, 0x84, 0xDA, 0x38, 0x66, 0xE5, 0xBB, 0x59, 0x07, 0xDB, 0x85, 0x67, 0x39, 0xBA, 0xE4, 0x06, 0x58, 0x19, 0x47, 0xA5, 0xFB, 0x78, 0x26, 0xC4, 0x9A, 0x65, 0x3B, 0xD9, 0x87, 0x04, 0x5A, 0xB8, 0xE6, 0xA7, 0xF9, 0x1B, 0x45, 0xC6, 0x98, 0x7A, 0x24, 0xF8, 0xA6, 0x44, 0x1A, 0x99, 0xC7, 0x25, 0x7B, 0x3A, 0x64, 0x86, 0xD8, 0x5B, 0x05, 0xE7, 0xB9, 0x8C, 0xD2, 0x30, 0x6E, 0xED, 0xB3, 0x51, 0x0F, 0x4E, 0x10, 0xF2, 0xAC, 0x2F, 0x71, 0x93, 0xCD, 0x11, 0x4F, 0xAD, 0xF3, 0x70, 0x2E, 0xCC, 0x92, 0xD3, 0x8D, 0x6F, 0x31, 0xB2, 0xEC, 0x0E, 0x50, 0xAF, 0xF1, 0x13, 0x4D, 0xCE, 0x90, 0x72, 0x2C, 0x6D, 0x33, 0xD1, 0x8F, 0x0C, 0x52, 0xB0, 0xEE, 0x32, 0x6C, 0x8E, 0xD0, 0x53, 0x0D, 0xEF, 0xB1, 0xF0, 0xAE, 0x4C, 0x12, 0x91, 0xCF, 0x2D, 0x73, 0xCA, 0x94, 0x76, 0x28, 0xAB, 0xF5, 0x17, 0x49, 0x08, 0x56, 0xB4, 0xEA, 0x69, 0x37, 0xD5, 0x8B, 0x57, 0x09, 0xEB, 0xB5, 0x36, 0x68, 0x8A, 0xD4, 0x95, 0xCB, 0x29, 0x77, 0xF4, 0xAA, 0x48, 0x16, 0xE9, 0xB7, 0x55, 0x0B, 0x88, 0xD6, 0x34, 0x6A, 0x2B, 0x75, 0x97, 0xC9, 0x4A, 0x14, 0xF6, 0xA8, 0x74, 0x2A, 0xC8, 0x96, 0x15, 0x4B, 0xA9, 0xF7, 0xB6, 0xE8, 0x0A, 0x54, 0xD7, 0x89, 0x6B, 0x35 }; static UINT crc16_table[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; BYTE CRC8compute(const BYTE * bytes, const size_t length, const UINT seed) { BYTE crc = seed; size_t i = 0; while (i < length) { crc = crc8_table[crc ^ bytes[i++]]; } return crc; } /* wrap CRC8 calculation in statistics */ BYTE CRC8(const BYTE * bytes, const size_t length) { return CRC8seeded(bytes, length, 0); } /* wrap CRC8 calculation in statistics */ BYTE CRC8seeded(const BYTE * bytes, const size_t length, const UINT seed) { BYTE r = CRC8compute(bytes, length, seed); STATLOCK; ++CRC8_tries; /* statistics */ if (r) { ++CRC8_errors; /* statistics */ } STATUNLOCK; return r; } /* Returns 0 for good match */ /* Standard -- seed = 0 */ int CRC16(const BYTE * bytes, const size_t length) { return CRC16seeded(bytes, length, 0); } /* Returns 0 for good match */ int CRC16seeded(const BYTE * bytes, const size_t length, const UINT seed) { UINT sd = seed; int ret; size_t i; for (i = 0; i < length; ++i) { UINT c = (bytes[i] ^ (sd & 0xFF)) & 0xFF; sd >>= 8; if (crc16_table[c & 0x0F] ^ crc16_table[c >> 4]) { sd ^= 0xC001; } sd ^= (c <<= 6); sd ^= (c << 1); } STATLOCK; ++CRC16_tries; /* statistics */ if (sd == 0xB001) { ret = 0; /* good */ } else { ret = -1; /* error */ ++CRC16_errors; /* statistics */ } STATUNLOCK; return ret; } owfs-2.8p15/module/owlib/src/c/ow_com_write.c0000644000175000017500000001204311707143413016064 00000000000000/* $Id: ow_com_write.c,v 1.25 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif static GOOD_OR_BAD COM_write_once( const BYTE * data, size_t length, struct connection_in *connection) ; /* Called on head of multibus group */ GOOD_OR_BAD COM_write( const BYTE * data, size_t length, struct connection_in *connection) { if ( connection == NO_CONNECTION ) { return gbBAD ; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("Bad bus type for writing %s",SAFESTRING(SOC(connection)->devicename)); return gbBAD ; case ct_i2c: case ct_usb: // usb and i2c use their own write logic currently LEVEL_DEBUG("Unimplemented write %s",SAFESTRING(SOC(connection)->devicename)); return gbBAD ; case ct_telnet: // telnet gets special processing to send communication parameters (in band) if ( SOC(connection)->dev.telnet.telnet_negotiated == needs_negotiation ) { #if OW_SHOW_TRAFFIC LEVEL_DEBUG("TELNET: Do negotiation"); #endif /* OW_SHOW_TRAFFIC */ RETURN_BAD_IF_BAD( telnet_change( connection ) ) ; SOC(connection)->dev.telnet.telnet_negotiated = completed_negotiation ; } break ; case ct_tcp: case ct_serial: case ct_netlink: // These protocols need no special pre-processing break ; } // is connection thought to be open? RETURN_BAD_IF_BAD( COM_test(connection) ) ; if ( length == 0 || data == NULL ) { return gbGOOD ; } // try the write RETURN_GOOD_IF_GOOD( COM_write_once( data, length, connection ) ); LEVEL_DEBUG("Trouble writing to %s", SAFESTRING(SOC(connection)->devicename) ) ; if ( SOC(connection)->file_descriptor == FILE_DESCRIPTOR_BAD ) { // connection was bad, now closed, try again LEVEL_DEBUG("Need to reopen %s", SAFESTRING(SOC(connection)->devicename) ) ; RETURN_BAD_IF_BAD( COM_test(connection) ) ; LEVEL_DEBUG("Reopened %s, now slurp", SAFESTRING(SOC(connection)->devicename) ) ; COM_slurp(connection) ; LEVEL_DEBUG("Write again to %s", SAFESTRING(SOC(connection)->devicename) ) ; return COM_write_once( data, length, connection ) ; } // Can't open or another type of error return gbBAD ; } // No retries, let the upper level handle problems. GOOD_OR_BAD COM_write_simple( const BYTE * data, size_t length, struct connection_in *connection) { if ( length == 0 || data == NULL ) { return gbGOOD ; } if ( connection == NO_CONNECTION ) { return gbBAD ; } switch ( SOC(connection)->type ) { case ct_unknown: case ct_none: LEVEL_DEBUG("ERROR!!! ----------- ERROR!"); return gbBAD ; case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented!!!"); return gbBAD ; case ct_telnet: case ct_tcp: case ct_serial: case ct_netlink: break ; } if ( SOC(connection)->file_descriptor == FILE_DESCRIPTOR_BAD ) { LEVEL_DEBUG("Writing to closed device %d",SAFESTRING(SOC(connection)->devicename)); return gbBAD ; } return COM_write_once( data, length, connection ) ; } /* Called on head of multibus group */ static GOOD_OR_BAD COM_write_once( const BYTE * data, size_t length, struct connection_in *connection) { ssize_t to_be_written = length ; FILE_DESCRIPTOR_OR_ERROR fd = SOC(connection)->file_descriptor ; while (to_be_written > 0) { int select_result ; fd_set writeset; // use same timeout as read for write struct timeval tv = { Globals.timeout_serial, 0 } ; /* Initialize readset */ FD_ZERO(&writeset); FD_SET( fd, &writeset); /* Read if it doesn't timeout first */ select_result = select( fd + 1, NULL, &writeset, NULL, &tv); if (select_result > 0) { ssize_t write_result ; if (FD_ISSET( fd, &writeset) == 0) { ERROR_CONNECT("Select no FD found on write to %s", SAFESTRING(SOC(connection)->devicename)); STAT_ADD1_BUS(e_bus_write_errors, connection); return gbBAD; /* error */ } TrafficOut("write", &data[length - to_be_written], to_be_written, connection ); write_result = write( fd, &data[length - to_be_written], to_be_written); /* write bytes */ if (write_result < 0) { if (errno != EWOULDBLOCK && errno != EAGAIN) { ERROR_CONNECT("Trouble writing to %s", SAFESTRING(SOC(connection)->devicename)); COM_close(connection) ; STAT_ADD1_BUS(e_bus_write_errors, connection); return gbBAD; } /* write() was interrupted, try again */ STAT_ADD1_BUS(e_bus_timeouts, connection); } else { to_be_written -= write_result ; } } else { /* timed out or select error */ ERROR_CONNECT("Select/timeout error writing to %s", SAFESTRING(SOC(connection)->devicename)); STAT_ADD1_BUS(e_bus_timeouts, connection); if ( errno == EBADF ) { LEVEL_DEBUG("Close file descriptor -- EBADF"); COM_close(connection) ; } return gbBAD; } } tcdrain( fd ); return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_parse_address.c0000664000175000017500000000632611605331556016730 00000000000000/* $Id: ow_parse_address.c,v 1.6 2011/07/07 13:23:58 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: paul.alfille@gmail.com Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" static void Init_Address( struct address_pair * ap ) ; static void Parse_Single_Address( struct address_entry * ae ) ; static void Parse_Single_Address( struct address_entry * ae ) { int q1,q2,q3,q4 ; if ( ae->alpha == NULL ) { // null entry ae->type = address_none ; } else if ( ae->alpha[0] == '\0' ) { // blank entry (actually no trim or whitespace) ae->type = address_none ; } else if ( strncasecmp( ae->alpha, "all", 3 ) == 0 ) { ae->type = address_all ; } else { switch( sscanf( ae->alpha, "%i.%i.%i.%i", &q1, &q2, &q3, &q4 ) ) { case 4: ae->type = address_dottedquad ; ae->number = q1 ; break ; case 3: case 2: ae->number = q1 ; ae->type = address_alpha ; break ; case 1: ae->type = address_numeric ; ae->number = q1 ; break ; case 0: default: ae->type = address_alpha ; break ; } } } /* Search for a ":" in the name Change it to a null,and parse the remaining text as either null, a number, or nothing */ void Parse_Address( char * address, struct address_pair * ap ) { char * colon ; char * colon2 ; // Set up address structure into previously allocated structure if ( ap == NULL ) { return ; } Init_Address(ap); // no entries if ( address == NULL) { ap->entries = 0 ; return ; } // copy the text string // All entries will point into this text copy ap->first.alpha = owstrdup(address) ; if ( ap->first.alpha == NULL ) { return ; } colon = strchr( ap->first.alpha, ':' ) ; if ( colon != NULL ) { // 1st colon exists // Colon exists, second entry, so add a null at colon to separate the string. *colon = '\0' ; // second part starts after colon position ap->second.alpha = colon + 1 ; // part of first.alpha } Parse_Single_Address( &(ap->first) ) ; if ( colon == NULL ) { // no colon, so only one entry ap->entries = 1 ; return ; } colon2 = strchr( ap->second.alpha, ':' ) ; if ( colon2 != NULL ) { // 2nd colon exists // Colon exists, third entry, so add a null at colon to separate the string. *colon2 = '\0' ; // third part starts after colon position ap->third.alpha = colon2 + 1 ; // still part of first.alpha } Parse_Single_Address( &(ap->second) ) ; if ( colon2 == NULL ) { // no colon2, so only two entries ap->entries = 2 ; return ; } // third part starts after colon2 position ap->entries = 3 ; Parse_Single_Address( &(ap->third) ) ; } void Free_Address( struct address_pair * ap ) { if ( ap == NULL ) { return ; } // Eliminates ap->second.alpha, too SAFEFREE( ap->first.alpha ) ; Init_Address( ap ) ; } static void Init_Address( struct address_pair * ap ) { if ( ap == NULL ) { return ; } ap->first.alpha = NULL ; ap->first.type = address_none ; ap->second.alpha = NULL ; ap->second.type = address_none ; ap->third.alpha = NULL ; ap->third.type = address_none ; } owfs-2.8p15/module/owlib/src/c/ow_serial_free.c0000644000175000017500000000301611731463643016363 00000000000000/* $Id: ow_serial_free.c,v 1.3 2012/03/12 22:18:30 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif /* ---------------------------------------------- */ /* raw COM port interface routines */ /* ---------------------------------------------- */ //free serial port and restore attributes /* Called on head of multibus group */ void serial_free(struct connection_in *connection) { FILE_DESCRIPTOR_OR_ERROR fd ; if ( SOC(connection)->state == cs_virgin ) { return ; } fd = SOC(connection)->file_descriptor ; if ( FILE_DESCRIPTOR_NOT_VALID( fd ) ) { // reopen to restore attributes fd = open( SOC(connection)->devicename, O_RDWR | O_NONBLOCK | O_NOCTTY | O_CLOEXEC ) ; } // restore tty settings if ( FILE_DESCRIPTOR_VALID( fd ) ) { // in case O_CLOEXEC not supported fcntl (fd, F_SETFD, FD_CLOEXEC) ; LEVEL_DEBUG("COM_close: flush"); tcflush( fd, TCIOFLUSH); LEVEL_DEBUG("COM_close: restore"); if ( tcsetattr( fd, TCSANOW, &(SOC(connection)->dev.serial.oldSerialTio) ) < 0) { ERROR_CONNECT("Cannot restore port attributes: %s", SAFESTRING(SOC(connection)->devicename)); } } Test_and_Close( &( SOC(connection)->file_descriptor) ) ; } owfs-2.8p15/module/owlib/src/c/ow_search.c0000664000175000017500000001621511667560325015362 00000000000000/* $Id: ow_search.c,v 1.31 2011/09/08 03:34:04 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" static void BUS_first_both(struct device_search *ds); static enum search_status BUS_next_3try(struct device_search *ds, const struct parsedname *pn) ; //-------------------------------------------------------------------------- /** The 'owFirst' doesn't find the first device on the 1-Wire Net. instead, it sets up for BUS_next interator. serialnumber -- 8byte (64 bit) serial number found Returns: 0-device found 1-no dev or error */ enum search_status BUS_first(struct device_search *ds, const struct parsedname *pn) { LEVEL_DEBUG("Start of directory path=%s device=" SNformat, SAFESTRING(pn->path), SNvar(pn->sn)); // reset the search state BUS_first_both(ds); ds->search = _1W_SEARCH_ROM; return BUS_next(ds, pn); } enum search_status BUS_first_alarm(struct device_search *ds, const struct parsedname *pn) { LEVEL_DEBUG("Start of directory path=%s device=" SNformat, SAFESTRING(pn->path), SNvar(pn->sn)); // reset the search state BUS_first_both(ds); ds->search = _1W_CONDITIONAL_SEARCH_ROM; return BUS_next(ds, pn); } static void BUS_first_both(struct device_search *ds) { // reset the search state memset(ds->sn, 0, 8); // clear the serial number ds->LastDiscrepancy = -1; ds->LastDevice = 0; ds->index = -1; // true place in dirblob /* Initialize dir-at-once structure */ DirblobInit(&(ds->gulp)); } //-------------------------------------------------------------------------- /** The BUS_next function does a general search. This function continues from the previous search state (held in struct device_search). The search state can be reset by using the BUS_first function. Returns: 0=No problems, 1=Problems Sets LastDevice=1 if no more */ enum search_status BUS_next(struct device_search *ds, const struct parsedname *pn) { switch ( BUS_next_3try(ds, pn) ) { case search_good: // found a device in a directory search, add to "presence" cache LEVEL_DEBUG("Device found: " SNformat, SNvar(ds->sn)); Cache_Add_Device(pn->selected_connection->index,ds->sn) ; return search_good ; case search_done: BUS_next_cleanup(ds); return search_done; case search_error: default: BUS_next_cleanup(ds); return search_error; } } void BUS_next_cleanup( struct device_search *ds ) { DirblobClear(&(ds->gulp)); } /* try the directory search 3 times. * Since ds->LastDescrepancy is altered only on success a repeat is legal * */ static enum search_status BUS_next_3try(struct device_search *ds, const struct parsedname *pn) { switch (BUS_next_both(ds, pn) ) { case search_good: return search_good ; case search_done: return search_done; case search_error: break ; } STAT_ADD1_BUS(e_bus_search_errors1, pn->selected_connection); switch (BUS_next_both(ds, pn) ) { case search_good: return search_good ; case search_done: return search_done; case search_error: break ; } STAT_ADD1_BUS(e_bus_search_errors2, pn->selected_connection); switch (BUS_next_both(ds, pn) ) { case search_good: return search_good ; case search_done: return search_done; case search_error: break ; } STAT_ADD1_BUS(e_bus_search_errors3, pn->selected_connection); return search_error ; } /* Call either master-specific search routine, or the bit-banging one */ enum search_status BUS_next_both(struct device_search *ds, const struct parsedname *pn) { enum search_status next_both ; if ( pn->selected_connection->iroutines.next_both != NO_NEXT_BOTH_ROUTINE ) { next_both = (pn->selected_connection->iroutines.next_both) (ds, pn); } else { next_both = BUS_next_both_bitbang( ds, pn ) ; } switch ( next_both ) { case search_good: if ((ds->sn[0] & 0x7F) == 0x04) { /* We found a DS1994/DS2404 which requires longer delays */ pn->selected_connection->ds2404_found = 1; } break ; default : break ; } return next_both ; } /* Low level search routines -- bit banging */ /* Not used by more advanced adapters */ enum search_status BUS_next_both_bitbang(struct device_search *ds, const struct parsedname *pn) { if ( BAD( BUS_select(pn) ) ) { return search_error ; } else { int search_direction = 0; /* initialization just to forestall incorrect compiler warning */ int bit_number; int last_zero = -1; BYTE bits[3]; // initialize for search // if the last call was not the last one if (ds->LastDevice) { return search_done; } /* Appropriate search command */ if ( BAD( BUS_send_data(&(ds->search), 1, pn)) ) { return search_error ; } // Need data from a reset for AnyDevices -- obtained from BUS_data_send above if (pn->selected_connection->AnyDevices == anydevices_no) { ds->LastDevice = 1; return search_done; } // loop to do the search for (bit_number = 0;; ++bit_number) { bits[1] = bits[2] = 0xFF; if (bit_number == 0) { /* First bit */ /* get two bits (AND'ed bit and AND'ed complement) */ if ( BAD( BUS_sendback_bits(&bits[1], &bits[1], 2, pn) ) ) { return search_error; } } else { bits[0] = search_direction; if (bit_number < 64) { /* Send chosen bit path, then check match on next two */ if ( BAD( BUS_sendback_bits(bits, bits, 3, pn) ) ) { return search_error; } } else { /* last bit */ if ( BAD( BUS_sendback_bits(bits, bits, 1, pn) ) ) { return search_error; } break; } } if (bits[1]) { if (bits[2]) { /* 1,1 */ /* No devices respond */ ds->LastDevice = 1; return search_done; } else { /* 1,0 */ search_direction = 1; // bit write value for search } } else if (bits[2]) { /* 0,1 */ search_direction = 0; // bit write value for search } else if (bit_number > ds->LastDiscrepancy) { /* 0,0 looking for last discrepancy in this new branch */ // Past branch, select zeros for now search_direction = 0; last_zero = bit_number; } else if (bit_number == ds->LastDiscrepancy) { /* 0,0 -- new branch */ // at branch (again), select 1 this time search_direction = 1; // if equal to last pick 1, if not then pick 0 } else if (UT_getbit(ds->sn, bit_number)) { /* 0,0 -- old news, use previous "1" bit */ // this discrepancy is before the Last Discrepancy search_direction = 1; } else { /* 0,0 -- old news, use previous "0" bit */ // this discrepancy is before the Last Discrepancy search_direction = 0; last_zero = bit_number; } UT_setbit(ds->sn, bit_number, search_direction); } // loop until through serial number bits if ( (CRC8(ds->sn, SERIAL_NUMBER_SIZE)!=0) || (bit_number < 64) || (ds->sn[0] == 0)) { /* A minor "error" */ return search_error; } // if the search was successful then ds->LastDiscrepancy = last_zero; // printf("Post, lastdiscrep=%d\n",si->LastDiscrepancy) ; ds->LastDevice = (last_zero < 0); return search_good; } } owfs-2.8p15/module/owlib/src/c/ow_2502.c0000644000175000017500000001123111740076517014471 00000000000000/* $Id: ow_2502.c,v 1.54 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2502.h" /* ------- Prototypes ----------- */ /* DS2423 counter */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_param); /* ------- Structures ----------- */ static struct aggregate A2502 = { 4, ag_numbers, ag_separate, }; static struct filetype DS2502[] = { F_STANDARD, {"memory", 128, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2502, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntry(09, DS2502, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1982U[] = { F_STANDARD, {"memory", 128, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2502, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"mac_e", 6, NON_AGGREGATE, ft_binary, fc_stable, FS_r_param, NO_WRITE_FUNCTION, VISIBLE, {i:4}, }, {"mac_fw", 8, NON_AGGREGATE, ft_binary, fc_stable, FS_r_param, NO_WRITE_FUNCTION, VISIBLE, {i:4}, }, {"project", 4, NON_AGGREGATE, ft_binary, fc_stable, FS_r_param, NO_WRITE_FUNCTION, VISIBLE, {i:0}, }, }; DeviceEntry(89, DS1982U, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_READ_MEMORY 0xF0 #define _1W_READ_STATUS 0xAA #define _1W_READ_DATA_CRC8 0xC3 #define _1W_WRITE_MEMORY 0x0F #define _1W_WRITE_STATUS 0x55 /* ------- Functions ------------ */ /* DS2502 */ static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_r_data(BYTE * data, struct parsedname *pn); /* 2502 memory */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_r_mem)) ; } static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_r_param(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[32]; RETURN_ERROR_IF_BAD( OW_r_data(data, pn) ); return OWQ_format_output_offset_and_size((ASCII *) & data[pn->selected_filetype->data.i], FileLength(pn), owq); } static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { return COMMON_write_eprom_mem_owq(owq) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize ) ; } static GOOD_OR_BAD OW_r_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[4] = { _1W_READ_DATA_CRC8, LOW_HIGH_ADDRESS(offset), }; BYTE q[33]; int rest = 33 - (offset & 0x1F); struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ1(&p[3]), TRXN_CRC8(p, 4), TRXN_READ(q, rest), TRXN_CRC8(q, rest), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; memcpy(data, q, size); return gbGOOD; } static GOOD_OR_BAD OW_r_data(BYTE * data, struct parsedname *pn) { BYTE p[32]; RETURN_BAD_IF_BAD( OW_r_mem(p, 32, 0, pn) ) ; if ( CRC16(p, 3 + p[0])) { return gbBAD; } memcpy(data, &p[1], p[0]); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/Makefile.am0000644000175000017500000001753511741156523015276 00000000000000# $Id: Makefile.am,v 1.174 2012/04/11 01:24:35 alfille Exp $ OWLIB_SOURCE = ow_dl.c \ ow_dnssd.c \ ow_arg.c \ ow_baud.c \ ow_bitfield.c \ ow_byte.c \ compat.c \ getaddrinfo.c \ getline.c \ getopt.c \ ow_none.c \ ow_1820.c \ ow_1821.c \ ow_1921.c \ ow_1923.c \ ow_1954.c \ ow_1963.c \ ow_1977.c \ ow_1991.c \ ow_1993.c \ ow_2401.c \ ow_2404.c \ ow_2405.c \ ow_2406.c \ ow_2408.c \ ow_2409.c \ ow_2413.c \ ow_2415.c \ ow_2423.c \ ow_2430.c \ ow_2433.c \ ow_2436.c \ ow_2438.c \ ow_2450.c \ ow_2502.c \ ow_2505.c \ ow_2760.c \ ow_2804.c \ ow_2890.c \ ow_add_inflight.c \ ow_alias.c \ ow_alloc.c \ ow_api.c \ ow_avahi_announce.c\ ow_avahi_browse.c \ ow_avahi_link.c \ ow_badadapter.c \ ow_bae.c \ ow_browse.c \ ow_browse_resolve.c\ ow_browse_monitor.c\ ow_bus.c \ ow_bus_bitdata.c \ ow_bus_data.c \ ow_buslock.c \ ow_cache.c \ ow_channel.c \ ow_charblob.c \ ow_com.c \ ow_com_change.c \ ow_com_close.c \ ow_com_free.c \ ow_com_open.c \ ow_com_write.c \ ow_com_read.c \ ow_connect.c \ ow_connect_out.c \ ow_crc.c \ ow_daemon.c \ ow_date.c \ ow_delay.c \ ow_del_inflight.c \ ow_devicelock.c \ ow_dir.c \ ow_dirblob.c \ ow_ds2482.c \ ow_ds9097.c \ ow_ds1410.c \ ow_ds9097U.c \ ow_ds9490.c \ ow_eds.c \ ow_eeef.c \ ow_eprom_write.c \ ow_etherweather.c \ ow_example_slave.c \ ow_exit.c \ ow_external.c \ ow_find_external.c \ ow_fs_address.c \ ow_fs_alias.c \ ow_fs_code.c \ ow_fs_crc8.c \ ow_fs_id.c \ ow_fs_type.c \ ow_ha5.c \ ow_ha7.c \ ow_ha7e.c \ ow_fake.c \ ow_fakeread.c \ ow_filelength.c \ ow_fstat.c \ ow_generic_read.c \ ow_get.c \ ow_help.c \ ow_interface.c \ ow_iterate.c \ ow_lcd.c \ ow_lib_close.c \ ow_lib_setup.c \ ow_lib_stop.c \ ow_link.c \ ow_locator.c \ ow_locks.c \ ow_memblob.c \ ow_memory.c \ ow_multicast.c \ ow_name.c \ ow_net_client.c \ ow_net_server.c \ ow_offset.c \ ow_opt.c \ ow_parse_address.c \ ow_parse_external.c\ ow_parseinput.c \ ow_parsename.c \ ow_parseobject.c \ ow_parseoutput.c \ ow_parseshallow.c \ ow_parse_sn.c \ ow_pid.c \ ow_powerbyte.c \ ow_powerbit.c \ ow_presence.c \ ow_pressure.c \ ow_printparse.c \ ow_programpulse.c \ ow_read.c \ ow_read_external.c \ ow_read_telnet.c \ ow_reconnect.c \ ow_remote_alias.c \ ow_reset.c \ ow_return_code.c \ ow_rwlock.c \ ow_stats.c \ ow_search.c \ ow_serial_free.c \ ow_serial_open.c \ ow_server.c \ ow_server_message.c\ ow_server_enet.c \ ow_select.c \ ow_set_telnet.c \ ow_settings.c \ ow_sibling.c \ ow_sibling_binary.c\ ow_sibling_float.c \ ow_sibling_uint.c \ ow_sibling_yesno.c \ ow_sig_handlers.c \ ow_simultaneous.c \ ow_slurp.c \ ow_stateinfo.c \ ow_system.c \ ow_tcp_free.c \ ow_tcp_open.c \ ow_tcp_read.c \ ow_telnet_write.c \ ow_temp.c \ ow_testerread.c \ ow_thermocouple.c \ ow_traffic.c \ ow_transaction.c \ ow_tree.c \ ow_udp_read.c \ ow_usb_msg.c \ ow_usb_cycle.c \ ow_usb_monitor.c \ ow_util.c \ ow_verify.c \ ow_visibility.c \ ow_w1.c \ ow_w1_addremove.c \ ow_w1_bind.c \ ow_w1_browse.c \ ow_w1_dispatch.c \ ow_w1_list.c \ ow_w1_monitor.c \ ow_w1_parse.c \ ow_w1_print.c \ ow_w1_scan.c \ ow_w1_select.c \ ow_w1_send.c \ ow_write.c \ ow_write_external.c\ ow_zero.c \ owlib.c \ error.c \ globals.c lib_LTLIBRARIES = libow.la libow_la_SOURCES = ${OWLIB_SOURCE} if HAVE_CYGWIN libow_la_LDFLAGS = ${PTHREAD_LIBS} -shared -no-undefined ${LIBUSB_LIBS} ${LD_EXTRALIBS} else libow_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} -shared -shrext .so ${LIBUSB_LIBS} ${LD_EXTRALIBS} endif # Maybe need this for MacOS X #if HAVE_DARWIN #LDADDS = -framework IOKit -framework CoreFoundation #endif #libow_la_LDFLAGS = -shared -shrext .so \ # -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ # -release $(LT_RELEASE) \ # -export-dynamic \ # $(LDADDS) AM_CFLAGS = -I../include \ -fexceptions \ -Wall \ -W \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wcast-qual \ -Wcast-align \ -Wstrict-prototypes \ -Wredundant-decls \ -D__EXTENSIONS__ \ ${EXTRACFLAGS} \ ${PTHREAD_CFLAGS} \ ${LIBUSB_CFLAGS} \ ${PIC_FLAGS} clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/module/owlib/src/c/ow_1820.c0000644000175000017500000007674011740076517014513 00000000000000/* $Id: ow_1820.c,v 1.152 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_1820.h" /* ------- Prototypes ----------- */ /* DS18S20&2 Temperature */ // READ_FUNCTION( FS_tempdata ) ; READ_FUNCTION(FS_10temp); READ_FUNCTION(FS_10temp_link); READ_FUNCTION(FS_22temp); READ_FUNCTION(FS_fasttemp); READ_FUNCTION(FS_slowtemp); READ_FUNCTION(FS_power); READ_FUNCTION(FS_r_templimit); WRITE_FUNCTION(FS_w_templimit); READ_FUNCTION(FS_r_die); READ_FUNCTION(FS_r_trim); WRITE_FUNCTION(FS_w_trim); READ_FUNCTION(FS_r_trimvalid); READ_FUNCTION(FS_r_blanket); WRITE_FUNCTION(FS_w_blanket); READ_FUNCTION(FS_r_ad); READ_FUNCTION(FS_r_piostate); READ_FUNCTION(FS_r_pio); READ_FUNCTION(FS_r_latch); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_sense); /* -------- Structures ---------- */ static struct filetype DS18S20[] = { F_STANDARD, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_10temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"temperature9", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_10temp_link, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"temperature10", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_10temp_link, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"temperature11", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_10temp_link, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"temperature12", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_10temp_link, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"fasttemp", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_10temp_link, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trim", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_trim, FS_w_trim, VISIBLE, NO_FILETYPE_DATA, }, {"errata/die", 2, NON_AGGREGATE, ft_ascii, fc_static, FS_r_die, NO_WRITE_FUNCTION, VISIBLE, {i:1}, }, {"errata/trimvalid", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_trimvalid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trimblanket", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_blanket, FS_w_blanket, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(10, DS18S20, DEV_temp | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS18B20[] = { F_STANDARD, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_slowtemp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"temperature9", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"temperature10", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:10}, }, {"temperature11", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:11}, }, {"temperature12", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"fasttemp", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_fasttemp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trim", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_trim, FS_w_trim, VISIBLE, NO_FILETYPE_DATA, }, {"errata/die", 2, NON_AGGREGATE, ft_ascii, fc_static, FS_r_die, NO_WRITE_FUNCTION, VISIBLE, {i:2}, }, {"errata/trimvalid", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_trimvalid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trimblanket", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_blanket, FS_w_blanket, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(28, DS18B20, DEV_temp | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1822[] = { F_STANDARD, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_slowtemp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"temperature9", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"temperature10", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:10}, }, {"temperature11", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:11}, }, {"temperature12", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"fasttemp", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_fasttemp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trim", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_trim, FS_w_trim, VISIBLE, NO_FILETYPE_DATA, }, {"errata/die", 2, NON_AGGREGATE, ft_ascii, fc_static, FS_r_die, NO_WRITE_FUNCTION, VISIBLE, {i:0}, }, {"errata/trimvalid", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_trimvalid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"errata/trimblanket", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_blanket, FS_w_blanket, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(22, DS1822, DEV_temp | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct filetype DS1825[] = { F_STANDARD, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_slowtemp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"temperature9", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"temperature10", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:10}, }, {"temperature11", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:11}, }, {"temperature12", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"fasttemp", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_fasttemp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"prog_addr", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_ad, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(3B, DS1825, DEV_temp | DEV_alarm, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A28EA00 = { 2, ag_letters, ag_aggregate, }; static struct filetype DS28EA00[] = { F_STANDARD, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_slowtemp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"temperature9", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"temperature10", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:10}, }, {"temperature11", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:11}, }, {"temperature12", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_22temp, NO_WRITE_FUNCTION, VISIBLE, {i:12}, }, {"fasttemp", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_link, FS_fasttemp, NO_WRITE_FUNCTION, VISIBLE, {i:9}, }, {"templow", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:1}, }, {"temphigh", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_stable, FS_r_templimit, FS_w_templimit, VISIBLE, {i:0}, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"piostate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_piostate, NO_WRITE_FUNCTION, INVISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_BITFIELD, &A28EA00, ft_bitfield, fc_link, FS_r_pio, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"latch", PROPERTY_LENGTH_BITFIELD, &A28EA00, ft_bitfield, fc_link, FS_r_latch, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A28EA00, ft_bitfield, fc_link, FS_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(42, DS28EA00, DEV_temp | DEV_alarm | DEV_chain, NO_GENERIC_READ, NO_GENERIC_WRITE); /* Internal properties */ Make_SlaveSpecificTag(RES, fc_stable); // resolution Make_SlaveSpecificTag(POW, fc_stable); // power status struct tempresolution { int bits; BYTE config; UINT delay; BYTE mask; }; struct tempresolution Resolution9 = { 9, 0x1F, 110, 0xF8} ; /* 9 bit */ struct tempresolution Resolution10 = {10, 0x3F, 200, 0xFC} ; /* 10 bit */ struct tempresolution Resolution11 = {11, 0x5F, 400, 0xFE} ; /* 11 bit */ struct tempresolution Resolution12 = {12, 0x7F, 1000, 0xFF}; /* 12 bit */ struct die_limits { BYTE B7[6]; BYTE C2[6]; }; enum eDie { eB6, eB7, eC2, eC3, }; // ID ranges for the different chip dies struct die_limits DIE[] = { { // DS1822 Family code 22 {0x00, 0x00, 0x00, 0x08, 0x97, 0x8A}, {0x00, 0x00, 0x00, 0x0C, 0xB8, 0x1A}, }, { // DS18S20 Family code 10 {0x00, 0x08, 0x00, 0x59, 0x1D, 0x20}, {0x00, 0x08, 0x00, 0x80, 0x88, 0x60}, }, { // DS18B20 Family code 28 {0x00, 0x00, 0x00, 0x54, 0x50, 0x10}, {0x00, 0x00, 0x00, 0x66, 0x2B, 0x50}, }, }; /* Intermediate cached values -- start with unlikely asterisk */ /* RES -- resolution POW -- power */ #define _1W_WRITE_SCRATCHPAD 0x4E #define _1W_READ_SCRATCHPAD 0xBE #define _1W_COPY_SCRATCHPAD 0x48 #define _1W_CONVERT_T 0x44 #define _1W_READ_POWERMODE 0xB4 #define _1W_RECALL_EEPROM 0xB8 #define _1W_PIO_ACCESS_READ 0xF5 #define _1W_PIO_ACCESS_WRITE 0xA5 #define _1W_CHAIN_COMMAND 0x99 #define _1W_CHAIN_SUBCOMMAND_OFF 0x3C #define _1W_CHAIN_SUBCOMMAND_ON 0x5A #define _1W_CHAIN_SUBCOMMAND_DONE 0x96 #define _1W_READ_TRIM_1 0x93 #define _1W_READ_TRIM_2 0x68 #define _1W_WRITE_TRIM_1 0x95 #define _1W_WRITE_TRIM_2 0x63 #define _1W_ACTIVATE_TRIM_1 0x94 #define _1W_ACTIVATE_TRIM_2 0x64 #define _DEFAULT_BLANKET_TRIM_1 0x9D #define _DEFAULT_BLANKET_TRIM_2 0xBB enum temperature_problem_flag { allow_85C, deny_85C, } ; /* ------- Functions ------------ */ /* DS1820&2*/ static GOOD_OR_BAD OW_10temp(_FLOAT * temp, enum temperature_problem_flag accept_85C, int simul_good, const struct parsedname *pn); static GOOD_OR_BAD OW_22temp(_FLOAT * temp, enum temperature_problem_flag accept_85C, int simul_good, struct tempresolution * Resolution, const struct parsedname *pn); static GOOD_OR_BAD OW_power(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_templimit(_FLOAT * T, const int Tindex, const struct parsedname *pn); static GOOD_OR_BAD OW_w_templimit(const _FLOAT T, const int Tindex, const struct parsedname *pn); static GOOD_OR_BAD OW_r_scratchpad(BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_scratchpad(const BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_w_store_scratchpad(const BYTE * data, const struct parsedname *pn); static GOOD_OR_BAD OW_r_trim(BYTE * trim, const struct parsedname *pn); static GOOD_OR_BAD OW_w_trim(const BYTE * trim, const struct parsedname *pn); static enum eDie OW_die(const struct parsedname *pn); static GOOD_OR_BAD OW_w_pio(BYTE pio, const struct parsedname *pn); static GOOD_OR_BAD OW_read_piostate(UINT * piostate, const struct parsedname *pn) ; static _FLOAT OW_masked_temperature( BYTE * data, BYTE mask ) ; static ZERO_OR_ERROR FS_10temp(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; // triple try temperatures // first pass include simultaneous if ( GOOD( OW_10temp(&OWQ_F(owq), deny_85C, OWQ_SIMUL_TEST(owq), pn)) ) { return 0 ; } // second pass no simultaneous if ( GOOD( OW_10temp(&OWQ_F(owq), deny_85C, 0, pn)) ) { return 0 ; } // third pass, accept 85C return GB_to_Z_OR_E(OW_10temp(&OWQ_F(owq), allow_85C, 0, pn)); } static ZERO_OR_ERROR FS_10temp_link(struct one_wire_query *owq) { return FS_r_sibling_F(&OWQ_F(owq),"temperature",owq) ; } /* For DS1822 and DS18B20 -- resolution stuffed in ft->data */ static ZERO_OR_ERROR FS_22temp(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; struct tempresolution * Resolution ; switch (pn->selected_filetype->data.i) { // bits case 9: Resolution = &Resolution9 ; break ; case 10: Resolution = &Resolution10 ; break ; case 11: Resolution = &Resolution11 ; break ; case 12: Resolution = &Resolution12 ; break ; default: return -ENODEV ; } // triple try temperatures // first pass include simultaneous if ( GOOD( OW_22temp(&OWQ_F(owq), deny_85C, OWQ_SIMUL_TEST(owq), Resolution, pn) ) ) { return 0 ; } // second pass no simultaneous if ( GOOD( OW_22temp(&OWQ_F(owq), deny_85C, 0, Resolution, pn) ) ) { return 0 ; } // third pass, accept 85C return GB_to_Z_OR_E(OW_22temp(&OWQ_F(owq), allow_85C, 0, Resolution, pn)); } // use sibling function for fasttemp to keep cache value consistent static ZERO_OR_ERROR FS_fasttemp(struct one_wire_query *owq) { _FLOAT temperature = 0.; ZERO_OR_ERROR z_or_e = FS_r_sibling_F( &temperature, "temperature9", owq ) ; OWQ_F(owq) = temperature ; return z_or_e ; } // use sibling function for temperature to keep cache value consistent static ZERO_OR_ERROR FS_slowtemp(struct one_wire_query *owq) { _FLOAT temperature = 0. ; ZERO_OR_ERROR z_or_e = FS_r_sibling_F( &temperature, "temperature12", owq ) ; OWQ_F(owq) = temperature ; return z_or_e ; } static ZERO_OR_ERROR FS_power(struct one_wire_query *owq) { BYTE data; RETURN_ERROR_IF_BAD(OW_power(&data, PN(owq))) ; OWQ_Y(owq) = (data != 0x00); return 0; } /* 28EA00 switch */ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { BYTE data = BYTE_INVERSE(OWQ_U(owq) & 0x03); /* reverse bits, set unused to 1s */ //printf("Write pio raw=%X, stored=%X\n",OWQ_U(owq),data) ; FS_del_sibling( "piostate", owq ) ; return GB_to_Z_OR_E(OW_w_pio(data, PN(owq))); } static ZERO_OR_ERROR FS_sense(struct one_wire_query *owq) { UINT piostate = 0; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &piostate, "piostate", owq ) ; // bits 0->0 and 2->1 OWQ_U(owq) = ( (piostate & 0x01) | ((piostate & 0x04)>>1) ) & 0x03 ; return z_or_e; } static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { UINT piostate = 0; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &piostate, "piostate", owq ) ; // bits 0->0 and 2->1 OWQ_U(owq) = BYTE_INVERSE( (piostate & 0x01) | ((piostate & 0x04)>>1) ) & 0x03 ; return z_or_e; } static ZERO_OR_ERROR FS_r_piostate(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_read_piostate(&(OWQ_U(owq)), PN(owq)) ) ; } static ZERO_OR_ERROR FS_r_latch(struct one_wire_query *owq) { UINT piostate = 0 ; ZERO_OR_ERROR z_or_e = FS_r_sibling_U( &piostate, "piostate", owq ) ; // bits 1->0 and 3->1 OWQ_U(owq) = BYTE_INVERSE( ((piostate & 0x02)>>1) | ((piostate & 0x08)>>2) ) & 0x03 ; return z_or_e; } static ZERO_OR_ERROR FS_r_templimit(struct one_wire_query *owq) { return GB_to_Z_OR_E( OW_r_templimit(&OWQ_F(owq), PN(owq)->selected_filetype->data.i, PN(owq)) ); } /* DS1825 hardware programmable address */ static ZERO_OR_ERROR FS_r_ad(struct one_wire_query *owq) { BYTE data[9]; RETURN_ERROR_IF_BAD(OW_r_scratchpad(data, PN(owq))) ; OWQ_U(owq) = data[4] & 0x0F; return 0; } static ZERO_OR_ERROR FS_w_templimit(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_templimit(OWQ_F(owq), PN(owq)->selected_filetype->data.i, PN(owq))); } static ZERO_OR_ERROR FS_r_die(struct one_wire_query *owq) { char *d; switch (OW_die(PN(owq))) { case eB6: d = "B6"; break; case eB7: d = "B7"; break; case eC2: d = "C2"; break; case eC3: d = "C3"; break; default: return -EINVAL; } return OWQ_format_output_offset_and_size(d, 2, owq); } static ZERO_OR_ERROR FS_r_trim(struct one_wire_query *owq) { BYTE t[2]; RETURN_ERROR_IF_BAD(OW_r_trim(t, PN(owq))) ; OWQ_U(owq) = (t[1] << 8) | t[0]; return 0; } static ZERO_OR_ERROR FS_w_trim(struct one_wire_query *owq) { UINT trim = OWQ_U(owq); BYTE t[2] = { LOW_HIGH_ADDRESS(trim), }; switch (OW_die(PN(owq))) { case eB7: case eC2: return GB_to_Z_OR_E(OW_w_trim(t, PN(owq))); default: return -EINVAL; } } /* Are the trim values valid-looking? */ static ZERO_OR_ERROR FS_r_trimvalid(struct one_wire_query *owq) { BYTE trim[2]; switch (OW_die(PN(owq))) { case eB7: case eC2: RETURN_ERROR_IF_BAD(OW_r_trim(trim, PN(owq))) ; OWQ_Y(owq) = (((trim[0] & 0x07) == 0x05) || ((trim[0] & 0x07) == 0x03)) && (trim[1] == 0xBB); break; default: OWQ_Y(owq) = 1; /* Assume true */ } return 0; } /* Put in a blank trim value if non-zero */ static ZERO_OR_ERROR FS_r_blanket(struct one_wire_query *owq) { BYTE trim[2]; BYTE blanket[] = { _DEFAULT_BLANKET_TRIM_1, _DEFAULT_BLANKET_TRIM_2 }; switch (OW_die(PN(owq))) { case eB7: case eC2: RETURN_ERROR_IF_BAD(OW_r_trim(trim, PN(owq))) ; OWQ_Y(owq) = (memcmp(trim, blanket, 2) == 0); return 0; default: return -EINVAL; } } /* Put in a blank trim value if non-zero */ static ZERO_OR_ERROR FS_w_blanket(struct one_wire_query *owq) { BYTE blanket[] = { _DEFAULT_BLANKET_TRIM_1, _DEFAULT_BLANKET_TRIM_2 }; switch (OW_die(PN(owq))) { case eB7: case eC2: if (OWQ_Y(owq)) { RETURN_ERROR_IF_BAD(OW_w_trim(blanket, PN(owq)) ) ; } return 0; default: return -EINVAL; } } /* get the temp from the scratchpad buffer after starting a conversion and waiting */ static GOOD_OR_BAD OW_10temp(_FLOAT * temp, enum temperature_problem_flag accept_85C, int simul_good, const struct parsedname *pn) { BYTE data[9]; BYTE convert[] = { _1W_CONVERT_T, }; UINT delay = 1100; // hard wired BYTE pow; struct transaction_log tunpowered[] = { TRXN_START, TRXN_POWER( convert, delay), TRXN_END, }; struct transaction_log tpowered[] = { TRXN_START, TRXN_WRITE1(convert), TRXN_END, }; if (OW_power(&pow, pn)) { pow = 0x00; /* assume unpowered if cannot tell */ } /* Select particular device and start conversion */ if (!pow) { // unpowered, deliver power, no communication allowed RETURN_BAD_IF_BAD(BUS_transaction(tunpowered, pn)) ; } else if ( !simul_good ) { // powered // Simultaneous not valid, so do a conversion GOOD_OR_BAD ret; BUSLOCK(pn); ret = BUS_transaction_nolock(tpowered, pn) || FS_poll_convert(pn); BUSUNLOCK(pn); RETURN_BAD_IF_BAD(ret) ; } else { // simultaneous -- delay if needed RETURN_BAD_IF_BAD( FS_Test_Simultaneous( simul_temp, delay, pn)) ; } RETURN_BAD_IF_BAD(OW_r_scratchpad(data, pn)) ; // Correction thanks to Nathan D. Holmes //temp[0] = (_FLOAT) ((int16_t)(data[1]<<8|data[0])) * .5 ; // Main conversion // Further correction, using "truncation" thanks to Wim Heirman //temp[0] = (_FLOAT) ((int16_t)(data[1]<<8|data[0])>>1); // Main conversion temp[0] = (_FLOAT) ((UT_int16(data)) >> 1); // Main conversion -- now with helper function if (data[7]) { // only if COUNT_PER_C non-zero (supposed to be!) // temp[0] += (_FLOAT)(data[7]-data[6]) / (_FLOAT)data[7] - .25 ; // additional precision temp[0] += .75 - (_FLOAT) data[6] / (_FLOAT) data[7]; // additional precision } if ( accept_85C==allow_85C || data[0] != 0x50 || data[1] != 0x05 ) { return gbGOOD; } return gbBAD ; } static GOOD_OR_BAD OW_power(BYTE * data, const struct parsedname *pn) { if (IsUncachedDir(pn) || BAD( Cache_Get_SlaveSpecific(data, sizeof(BYTE), SlaveSpecificTag(POW), pn)) ) { BYTE b4[] = { _1W_READ_POWERMODE, }; struct transaction_log tpower[] = { TRXN_START, TRXN_WRITE1(b4), TRXN_READ1(data), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(tpower, pn)) ; //LEVEL_DEBUG("TEST cannot read power"); Cache_Add_SlaveSpecific(data, sizeof(BYTE), SlaveSpecificTag(POW), pn); } return gbGOOD; } static GOOD_OR_BAD OW_22temp(_FLOAT * temp, enum temperature_problem_flag accept_85C, int simul_good, struct tempresolution * Resolution, const struct parsedname *pn) { BYTE data[9]; BYTE convert[] = { _1W_CONVERT_T, }; BYTE pow; UINT delay = Resolution->delay; UINT longdelay = delay * 1.5 ; // failsafe int stored_resolution ; int must_convert = 0 ; struct transaction_log tunpowered[] = { TRXN_START, TRXN_POWER(convert, delay), TRXN_END, }; struct transaction_log tpowered[] = { TRXN_START, TRXN_WRITE1(convert), TRXN_END, }; // failsafe struct transaction_log tunpowered_long[] = { TRXN_START, TRXN_POWER(convert, longdelay), TRXN_END, }; //LEVEL_DEBUG("TEST Getting temperature"); /* Resolution */ if ( BAD( Cache_Get_SlaveSpecific(&stored_resolution, sizeof(stored_resolution), SlaveSpecificTag(RES), pn)) || stored_resolution != Resolution->bits) { BYTE resolution_register = Resolution->config; /* Get existing settings */ RETURN_BAD_IF_BAD(OW_r_scratchpad(data, pn)) ; /* Put in new settings (if different) */ if ((data[4] | 0x1F) != resolution_register) { // ignore lower 5 bits //LEVEL_DEBUG("TEST resolution changed"); must_convert = 1 ; // resolution has changed data[4] = (resolution_register & 0x60) | 0x1F ; /* only store in scratchpad, not EEPROM */ RETURN_BAD_IF_BAD(OW_w_scratchpad(&data[2], pn)) ; Cache_Add_SlaveSpecific(&(Resolution->bits), sizeof(int), SlaveSpecificTag(RES), pn); } } /* Conversion */ // first time /* powered? */ if (OW_power(&pow, pn)) { //LEVEL_DEBUG("TEST unpowered"); pow = 0x00; /* assume unpowered if cannot tell */ } if ( accept_85C == allow_85C ) { // must be desperate LEVEL_DEBUG("Unpowered temperature conversion -- %d msec", longdelay); // If not powered, no Simultaneous for this chip RETURN_BAD_IF_BAD(BUS_transaction(tunpowered_long, pn)) ; } else if (!pow) { // unpowered, deliver power, no communication allowed LEVEL_DEBUG("Unpowered temperature conversion -- %d msec", delay); // If not powered, no Simultaneous for this chip RETURN_BAD_IF_BAD(BUS_transaction(tunpowered, pn)) ; } else if ( must_convert || !simul_good ) { // No Simultaneous active, so need to "convert" // powered, so release bus immediately after issuing convert GOOD_OR_BAD ret; LEVEL_DEBUG("Powered temperature conversion"); BUSLOCK(pn); ret = BUS_transaction_nolock(tpowered, pn) || FS_poll_convert(pn); BUSUNLOCK(pn); RETURN_BAD_IF_BAD(ret) } else { // valid simultaneous, just delay if needed RETURN_BAD_IF_BAD( FS_Test_Simultaneous( simul_temp, delay, pn)) ; } RETURN_BAD_IF_BAD(OW_r_scratchpad(data, pn)) ; temp[0] = OW_masked_temperature( data, Resolution->mask) ; if ( accept_85C==allow_85C || data[0] != 0x50 || data[1] != 0x05 ) { return gbGOOD; } return gbBAD ; } /* Limits Tindex=0 high 1=low */ static GOOD_OR_BAD OW_r_templimit(_FLOAT * T, const int Tindex, const struct parsedname *pn) { BYTE data[9]; BYTE recall[] = { _1W_RECALL_EEPROM, }; struct transaction_log trecall[] = { TRXN_START, TRXN_WRITE1(recall), TRXN_DELAY(10), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(trecall, pn)) ; RETURN_BAD_IF_BAD(OW_r_scratchpad(data, pn)) ; T[0] = (_FLOAT) ((int8_t) data[2 + Tindex]); return gbGOOD; } /* Limits Tindex=0 high 1=low */ static GOOD_OR_BAD OW_w_templimit(const _FLOAT T, const int Tindex, const struct parsedname *pn) { BYTE data[9]; if (OW_r_scratchpad(data, pn)) { return gbBAD; } data[2 + Tindex] = (int8_t) T; return OW_w_store_scratchpad(&data[2], pn); } /* read 9 bytes, includes CRC8 which is checked */ static GOOD_OR_BAD OW_r_scratchpad(BYTE * data, const struct parsedname *pn) { /* data is 9 bytes long */ BYTE be[] = { _1W_READ_SCRATCHPAD, }; struct transaction_log tread[] = { TRXN_START, TRXN_WRITE1(be), TRXN_READ(data, 9), TRXN_CRC8(data, 9), TRXN_END, }; return BUS_transaction(tread, pn); } /* write 3 bytes (byte2,3,4 of register) */ /* Write the scratchpad but not back to static */ static GOOD_OR_BAD OW_w_scratchpad(const BYTE * data, const struct parsedname *pn) { /* data is 3 bytes long */ BYTE d[4] = { _1W_WRITE_SCRATCHPAD, data[0], data[1], data[2], }; /* different processing for DS18S20 and others */ int scratch_length = (pn->sn[0] == 0x10) ? 2 : 3 ; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(d, scratch_length+1), TRXN_END, }; return BUS_transaction(twrite, pn); } /* write 3 bytes (byte2,3,4 of register) */ /* write to scratchpad and store in static */ static GOOD_OR_BAD OW_w_store_scratchpad(const BYTE * data, const struct parsedname *pn) { /* data is 3 bytes long */ BYTE d[4] = { _1W_WRITE_SCRATCHPAD, data[0], data[1], data[2], }; BYTE pow[] = { _1W_COPY_SCRATCHPAD, }; /* different processing for DS18S20 and others */ int scratch_length = (pn->sn[0] == 0x10) ? 2 : 3 ; struct transaction_log twrite[] = { TRXN_START, TRXN_WRITE(d, scratch_length+1), TRXN_START, TRXN_POWER(pow, 10), TRXN_END, }; return BUS_transaction(twrite, pn); } /* Trim values -- undocumented except in AN247.pdf */ static GOOD_OR_BAD OW_r_trim(BYTE * trim, const struct parsedname *pn) { BYTE cmd0[] = { _1W_READ_TRIM_1, }; BYTE cmd1[] = { _1W_READ_TRIM_2, }; struct transaction_log t0[] = { TRXN_START, TRXN_WRITE1(cmd0), TRXN_READ1(&trim[0]), TRXN_END, }; struct transaction_log t1[] = { TRXN_START, TRXN_WRITE1(cmd1), TRXN_READ1(&trim[1]), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t0, pn)) ; return BUS_transaction(t1, pn); } static GOOD_OR_BAD OW_w_trim(const BYTE * trim, const struct parsedname *pn) { BYTE cmd0[] = { _1W_WRITE_TRIM_1, trim[0], }; BYTE cmd1[] = { _1W_WRITE_TRIM_2, trim[1], }; BYTE cmd2[] = { _1W_ACTIVATE_TRIM_1, }; BYTE cmd3[] = { _1W_ACTIVATE_TRIM_2, }; struct transaction_log t0[] = { TRXN_START, TRXN_WRITE2(cmd0), TRXN_END, }; struct transaction_log t1[] = { TRXN_START, TRXN_WRITE2(cmd1), TRXN_END, }; struct transaction_log t2[] = { TRXN_START, TRXN_WRITE1(cmd2), TRXN_END, }; struct transaction_log t3[] = { TRXN_START, TRXN_WRITE1(cmd3), TRXN_END, }; RETURN_BAD_IF_BAD( BUS_transaction(t0, pn) ); RETURN_BAD_IF_BAD( BUS_transaction(t1, pn) ); RETURN_BAD_IF_BAD( BUS_transaction(t2, pn) ); RETURN_BAD_IF_BAD( BUS_transaction(t3, pn) ); return gbGOOD; } /* This is the CMOS die for the circuit, not program death */ static enum eDie OW_die(const struct parsedname *pn) { BYTE die[6] = { pn->sn[6], pn->sn[5], pn->sn[4], pn->sn[3], pn->sn[2], pn->sn[1], }; // data gives index into die matrix if (memcmp(die, DIE[pn->selected_filetype->data.i].C2, 6) > 0) { return eC2; } if (memcmp(die, DIE[pn->selected_filetype->data.i].B7, 6) > 0) { return eB7; } return eB6; } /* Powered temperature measurements -- need to poll line since it is held low during measurement */ /* We check every 10 msec (arbitrary) up to 1.25 seconds */ GOOD_OR_BAD FS_poll_convert(const struct parsedname *pn) { int i; BYTE p[1]; struct transaction_log t[] = { {NULL, NULL, 10, trxn_delay,}, TRXN_READ1(p), TRXN_END, }; // the first test is faster for just DS2438 (10 msec) // subsequent polling is slower since the DS18x20 is a slower converter for (i = 0; i < 22; ++i) { //LEVEL_DEBUG("TEST polling %d",i); if ( BAD( BUS_transaction_nolock(t, pn) )) { LEVEL_DEBUG("BUS_transaction failed"); break; } if (p[0] != 0) { LEVEL_DEBUG("BUS_transaction done after %dms", (i + 1) * 10); return gbGOOD; } t[0].size = 50; // 50 msec for rest of delays } LEVEL_DEBUG("Temperature measurement failed"); return gbBAD; } /* read PIO pins for the DS28EA00 */ static GOOD_OR_BAD OW_read_piostate(UINT * piostate, const struct parsedname *pn) { BYTE data[1]; BYTE cmd[] = { _1W_PIO_ACCESS_READ, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(cmd), TRXN_READ1(data), TRXN_END, }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; /* compare lower and upper nibble to be complements */ // High nibble the complement of low nibble? // Fix thanks to josef_heiler if ((data[0] & 0x0F) != ((~data[0] >> 4) & 0x0F)) { return gbBAD; } piostate[0] = data[0] & 0x0F ; return gbGOOD; } /* Write to PIO -- both channels. Already inverted and other fields set to 1 */ static GOOD_OR_BAD OW_w_pio(BYTE pio, const struct parsedname *pn) { BYTE cmd[] = { _1W_PIO_ACCESS_WRITE, pio, BYTE_INVERSE(pio) }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(cmd), TRXN_END, }; return BUS_transaction(t, pn); } static _FLOAT OW_masked_temperature( BYTE * data, BYTE mask ) { // Torsten Godau found a problem with 9-bit resolution return (_FLOAT) ((int16_t) ((data[1] << 8) | (data[0] & mask))) * .0625 ; } owfs-2.8p15/module/owlib/src/c/ow_offset.c0000664000175000017500000000357711356232013015373 00000000000000/* $Id: ow_offset.c,v 1.3 2010/04/05 00:51:23 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" /* Offset manipulation * Performs a shift of the offset to do an operation, * then returns the offset to the initial value. * The reason is that some reads or writes are done in another place in memory, * but OWQ_parse_output checks the file size against the original property constraints. */ ZERO_OR_ERROR COMMON_offset_process( ZERO_OR_ERROR (*func) (struct one_wire_query *), struct one_wire_query * owq, off_t shift_offset) { ZERO_OR_ERROR func_return_value ; OWQ_offset(owq) += shift_offset ; func_return_value = func(owq) ; OWQ_offset(owq) -= shift_offset ; return func_return_value ; } owfs-2.8p15/module/owlib/src/c/ow_tcp_read.c0000664000175000017500000000771511507641024015670 00000000000000/* $Id: ow_tcp_read.c,v 1.40 2011/01/01 15:02:44 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" /* Wait for something to be readable or timeout */ GOOD_OR_BAD tcp_wait(FILE_DESCRIPTOR_OR_ERROR file_descriptor, const struct timeval *ptv) { int select_result; fd_set readset; struct timeval tv ; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); while (1) { // Read if it doesn't timeout first timercpy( &tv, ptv ) ; select_result = select(file_descriptor + 1, &readset, NULL, NULL, &tv); if (select_result < 0) { if (errno == EINTR) { continue; /* interrupted */ } return gbBAD; /* error */ } else if (select_result == 0) { return gbBAD; /* timeout */ } else { // Is there something to read? if (FD_ISSET(file_descriptor, &readset)) { break; } } } return gbGOOD; } /* Read "n" bytes from a descriptor. */ /* Stolen from Unix Network Programming by Stevens, Fenner, Rudoff p89 */ /* return < 0 if failure */ ZERO_OR_ERROR tcp_read(FILE_DESCRIPTOR_OR_ERROR file_descriptor, BYTE * buffer, size_t requested_size, const struct timeval * ptv, size_t * chars_in) { size_t to_be_read = requested_size ; if ( FILE_DESCRIPTOR_NOT_VALID( file_descriptor ) ) { return -EBADF ; } LEVEL_DEBUG("attempt %d bytes Time: "TVformat,(int)requested_size, TVvar(ptv) ) ; *chars_in = 0 ; while (to_be_read > 0) { int select_result; fd_set readset; struct timeval tv ; /* Initialize readset */ FD_ZERO(&readset); FD_SET(file_descriptor, &readset); /* Read if it doesn't timeout first */ timercpy( &tv, ptv ) ; select_result = select(file_descriptor + 1, &readset, NULL, NULL, &tv); if (select_result > 0) { ssize_t read_result; /* Is there something to read? */ if (FD_ISSET(file_descriptor, &readset) == 0) { LEVEL_DEBUG("tcp_error -- nothing avialable to read"); return -EBADF ; /* error */ } errno = 0 ; read_result = read(file_descriptor, &buffer[*chars_in], to_be_read) ; if ( read_result < 0 ) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { read_result = 0; /* and call read() again */ } else { LEVEL_DATA("Network data read error errno=%d %s", errno, strerror(errno)); STAT_ADD1(NET_read_errors); return -EBADF ; } } else if (read_result == 0) { break; /* EOF */ } TrafficInFD("NETREAD", &buffer[*chars_in], read_result, file_descriptor ) ; to_be_read -= read_result; *chars_in += read_result ; } else if (select_result < 0) { /* select error */ if (errno == EINTR) { /* select() was interrupted, try again */ continue; } ERROR_DATA("Select error"); return -EBADF; } else { /* timed out */ LEVEL_CONNECT("TIMEOUT after %d bytes", requested_size - to_be_read); return -EAGAIN; } } LEVEL_DEBUG("read: %d - %d = %d",(int)requested_size, (int) to_be_read, (int) (requested_size-to_be_read) ) ; return 0; } void tcp_read_flush( FILE_DESCRIPTOR_OR_ERROR file_descriptor) { BYTE buffer[16]; ssize_t nread; int flags = fcntl(file_descriptor, F_GETFL, 0); // Apparently you can test for GET_FL success like this // see http://www.informit.com/articles/article.asp?p=99706&seqNum=13&rl=1 if (flags < 0) { return; } if (fcntl(file_descriptor, F_SETFL, flags | O_NONBLOCK) < 0) { return; } while ((nread = read(file_descriptor, buffer, 16)) > 0) { Debug_Bytes("tcp_read_flush", buffer, nread); continue; } fcntl(file_descriptor, F_SETFL, flags); } owfs-2.8p15/module/owlib/src/c/ow_daemon.c0000644000175000017500000001011211731463643015341 00000000000000/* $Id: ow_daemon.c,v 1.13 2012/03/14 03:48:40 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_devices.h" #include "ow_pid.h" #if defined(__UCLIBC__) #if (defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__)) #define HAVE_DAEMON 1 #else /* __UCLIBC_HAS_MMU__ */ #undef HAVE_DAEMON #endif /* __UCLIBC_HAS_MMU__ */ #endif /* __UCLIBC__ */ #ifndef HAVE_DAEMON #include #include static void catchchild(int sig) { pid_t pid; int status; pid = wait4(-1, &status, WUNTRACED, 0); } /* This is a test to implement daemon() */ static int my_daemon(int nochdir, int noclose) { struct sigaction act; int pid; FILE_DESCRIPTOR_OR_ERROR file_descriptor; signal(SIGCHLD, SIG_DFL); #if defined(__UCLIBC__) pid = vfork(); #else /* __UCLIBC__ */ pid = fork(); #endif /* __UCLIBC__ */ switch (pid) { case -1: memset(&act, 0, sizeof(act)); act.sa_handler = catchchild; act.sa_flags = SA_RESTART; sigaction(SIGCHLD, &act, NULL); //printf("owlib: my_daemon: pid=%d fork error\n", getpid()); LEVEL_CALL("Libsetup ok"); return (-1); case 0: break; default: //signal(SIGCHLD, SIG_DFL); //printf("owlib: my_daemon: pid=%d exit parent\n", getpid()); _exit(0); } if (setsid() < 0) { perror("setsid:"); return -1; } /* Make certain we are not a session leader, or else we * might reacquire a controlling terminal */ #ifdef __UCLIBC__ pid = vfork(); #else /* __UCLIBC__ */ pid = fork(); #endif /* __UCLIBC__ */ if (pid) { //printf("owlib: my_daemon: _exit() pid=%d\n", getpid()); _exit(0); } memset(&act, 0, sizeof(act)); act.sa_handler = catchchild; act.sa_flags = SA_RESTART; sigaction(SIGCHLD, &act, NULL); if (!nochdir) { chdir("/"); } if (!noclose) { close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); if (dup(dup(open("/dev/null", O_APPEND))) == -1) { perror("dup:"); return -1; } } return 0; } #endif /* HAVE_DAEMON */ /* Start the owlib process -- actually only tests for backgrounding */ GOOD_OR_BAD EnterBackground(void) { /* First call to pthread should be done after daemon() in uClibc, so * I moved it here to avoid calling __pthread_initialize() */ /* daemon() is called BEFORE initialization of USB adapter etc... Cygwin will fail to * use the adapter after daemon otherwise. Some permissions are changed on the process * (or process-group id) which libusb-win32 is depending on. */ //printf("Enter Background\n") ; if (Globals.want_background) { switch (Globals.program_type) { case program_type_filesystem: // handles PID from a callback break; case program_type_httpd: case program_type_ftpd: case program_type_server: case program_type_external: if ( // daemonize // current directory left unchanged (not root) // stdin, stdout and stderr sent to /dev/null #ifdef HAVE_DAEMON daemon(1, 0) #else /* HAVE_DAEMON */ my_daemon(1, 0) #endif /* HAVE_DAEMON */ ) { LEVEL_DEFAULT("Cannot enter background mode, quitting."); return gbBAD; } else { Globals.now_background = 1; LEVEL_DEFAULT("Entered background mode, quitting."); #ifdef __UCLIBC__ /* Have to re-initialize pthread since the main-process is gone. * * This workaround will probably be fixed in uClibc-0.9.28 * Other uClibc developers have noticed similar problems which are * trigged when pthread functions are used in shared libraries. */ LockSetup(); #endif /* __UCLIBC__ */ } default: PIDstart(); break; } } else { // not background if (Globals.program_type != program_type_filesystem) { PIDstart(); } } #if OW_MT main_threadid = pthread_self(); main_threadid_init = 1 ; LEVEL_DEBUG("main thread id = %lu", (unsigned long int) main_threadid); #endif return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_powerbit.c0000664000175000017500000000225111501212424015720 00000000000000/* $Id: ow_powerbit.c,v 1.2 2010/12/12 18:31:48 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" #include "ow_codes.h" // Send 8 bits of communication to the 1-Wire Net // Delay delay msec and return to normal // // Power is supplied by normal pull-up resistor, nothing special // /* Returns 0=good bad = -EIO */ GOOD_OR_BAD BUS_PowerBit(BYTE data, BYTE * resp, UINT delay, const struct parsedname *pn) { GOOD_OR_BAD ret; struct connection_in * in = pn->selected_connection ; if ( in->iroutines.PowerBit !=NO_POWERBIT_ROUTINE ) { ret = (in->iroutines.PowerBit) (data, resp, delay, pn); } else { // send the packet // No real "power" in the default case ret = BUS_sendback_bits(&data, resp, 1, pn); // delay UT_delay(delay); } if ( BAD(ret) ) { STAT_ADD1_BUS(e_bus_pullup_errors, in); return gbBAD ; } return gbGOOD ; } owfs-2.8p15/module/owlib/src/c/ow_w1_browse.c0000664000175000017500000000160511447004227016010 00000000000000/* $Id: ow_w1_browse.c,v 1.32 2010/09/24 02:10:31 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* w1 browse for existing and new bus masters * w1 is different: it is a dynamic list of adapters * the scanning starts with "W1_Browse" in LibStart and continues in it's own thread */ #include #include "owfs_config.h" #include "ow_connection.h" #if OW_W1 && OW_MT #include "ow_w1.h" GOOD_OR_BAD W1_Browse( void ) { pthread_t thread_dispatch ; if ( pthread_create(&thread_dispatch, DEFAULT_THREAD_ATTR, W1_Dispatch, NULL ) != 0 ) { ERROR_DEBUG("Couldn't create netlink monitoring thread"); return gbBAD ; } return gbGOOD ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_2890.c0000644000175000017500000001073711740076517014515 00000000000000/* $Id: ow_2890.c,v 1.42 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_2890.h" /* ------- Prototypes ----------- */ /* DS2890 Digital Potentiometer */ READ_FUNCTION(FS_r_cp); WRITE_FUNCTION(FS_w_cp); READ_FUNCTION(FS_r_wiper); WRITE_FUNCTION(FS_w_wiper); /* ------- Structures ----------- */ static struct filetype DS2890[] = { F_STANDARD, {"chargepump", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_cp, FS_w_cp, VISIBLE, NO_FILETYPE_DATA, }, {"wiper", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_wiper, FS_w_wiper, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(2C, DS2890, DEV_alarm | DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_POSITION 0x0F #define _1W_READ_POSITION 0xF0 #define _1W_INCREMENT 0xC3 #define _1W_DECREMENT 0x99 #define _1W_WRITE_CONTROL_REGISTER 0x55 #define _1W_READ_CONTROL_REGISTER 0xAA #define _1W_RELEASE_WIPER 0x96 /* ------- Functions ------------ */ /* DS2890 */ static GOOD_OR_BAD OW_r_wiper(UINT * val, const struct parsedname *pn); static GOOD_OR_BAD OW_w_wiper(const UINT val, const struct parsedname *pn); static GOOD_OR_BAD OW_r_cp(int *val, const struct parsedname *pn); static GOOD_OR_BAD OW_w_cp(const int val, const struct parsedname *pn); /* Wiper */ static ZERO_OR_ERROR FS_w_wiper(struct one_wire_query *owq) { UINT num = OWQ_U(owq); if (num > 255) { num = 255; } return GB_to_Z_OR_E(OW_w_wiper(num, PN(owq))) ; } /* write Charge Pump */ static ZERO_OR_ERROR FS_w_cp(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_w_cp(OWQ_Y(owq), PN(owq))) ; } /* read Wiper */ static ZERO_OR_ERROR FS_r_wiper(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_wiper(&OWQ_U(owq), PN(owq))) ; } /* Charge Pump */ static ZERO_OR_ERROR FS_r_cp(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_r_cp(&OWQ_Y(owq), PN(owq))) ; } /* write Wiper */ static GOOD_OR_BAD OW_w_wiper(const UINT val, const struct parsedname *pn) { BYTE resp[1]; BYTE cmd[] = { _1W_WRITE_POSITION, (BYTE) val, }; BYTE ns[] = { _1W_RELEASE_WIPER, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(cmd), TRXN_READ1(resp), TRXN_WRITE1(ns), TRXN_COMPARE(resp, &cmd[1], 1), TRXN_END }; return BUS_transaction(t, pn); } /* read Wiper */ static GOOD_OR_BAD OW_r_wiper(UINT * val, const struct parsedname *pn) { BYTE fo[] = { _1W_READ_POSITION, }; BYTE resp[2]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(fo), TRXN_READ2(resp), TRXN_END }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; *val = resp[1]; return gbGOOD; } /* write Charge Pump */ static GOOD_OR_BAD OW_w_cp(const int val, const struct parsedname *pn) { BYTE resp[1]; BYTE cmd[] = { _1W_WRITE_CONTROL_REGISTER, (val) ? 0x4C : 0x0C }; BYTE ns[] = { _1W_RELEASE_WIPER, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(cmd), TRXN_READ1(resp), TRXN_WRITE1(ns), TRXN_COMPARE(resp, &cmd[1], 1), TRXN_END }; return BUS_transaction(t, pn); } /* read Charge Pump */ static GOOD_OR_BAD OW_r_cp(int *val, const struct parsedname *pn) { BYTE aa[] = { _1W_READ_CONTROL_REGISTER, }; BYTE resp[2]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(aa), TRXN_READ2(resp), TRXN_END }; RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; *val = ((resp[1] & 0x40) != 0); return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_2804.c0000644000175000017500000002750411740076517014510 00000000000000/* $Id: ow_2804.c,v 1.53 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ /* Changes 7/2004 Extensive improvements based on input from Serg Oskin */ #include #include "owfs_config.h" #include "ow_2804.h" /* ------- Prototypes ----------- */ /* DS2406 switch */ READ_FUNCTION(FS_r_mem); WRITE_FUNCTION(FS_w_mem); READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_r_pio); WRITE_FUNCTION(FS_w_pio); READ_FUNCTION(FS_sense); READ_FUNCTION(FS_r_latch); WRITE_FUNCTION(FS_w_latch); READ_FUNCTION(FS_r_s_alarm); WRITE_FUNCTION(FS_w_s_alarm); READ_FUNCTION(FS_power); READ_FUNCTION(FS_r_por); READ_FUNCTION(FS_polarity); WRITE_FUNCTION(FS_w_por); /* ------- Structures ----------- */ static struct aggregate A2804 = { 2, ag_numbers, ag_aggregate, }; static struct aggregate A2804p = { 16, ag_numbers, ag_separate, }; static struct filetype DS28E04[] = { F_STANDARD, {"memory", 550, NON_AGGREGATE, ft_binary, fc_link, FS_r_mem, FS_w_mem, VISIBLE, NO_FILETYPE_DATA, }, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 32, &A2804p, ft_binary, fc_page, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"polarity", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_polarity, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"power", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_power, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"por", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_volatile, FS_r_por, FS_w_por, VISIBLE, NO_FILETYPE_DATA, }, {"PIO", PROPERTY_LENGTH_BITFIELD, &A2804, ft_bitfield, fc_stable, FS_r_pio, FS_w_pio, VISIBLE, NO_FILETYPE_DATA, }, {"sensed", PROPERTY_LENGTH_BITFIELD, &A2804, ft_bitfield, fc_volatile, FS_sense, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"latch", PROPERTY_LENGTH_BITFIELD, &A2804, ft_bitfield, fc_volatile, FS_r_latch, FS_w_latch, VISIBLE, NO_FILETYPE_DATA, }, {"set_alarm", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_s_alarm, FS_w_s_alarm, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(1C, DS28E04, DEV_alarm | DEV_resume | DEV_ovdr, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x0F #define _1W_READ_SCRATCHPAD 0xAA #define _1W_COPY_SCRATCHPAD 0x55 #define _1W_READ_MEMORY 0xF0 #define _1W_PIO_ACCESS_READ 0xF5 #define _1W_PIO_ACCESS_WRITE 0x5A #define _1W_READ_ACTIVE_LATCH 0xA5 #define _1W_WRITE_REGISTER 0xCC #define _1W_RESET_ACTIVITY_LATCHES 0xC3 #define _1W_PIO_CONFIRMATION 0xAA #define _ADDRESS_PIO_LOGIC 0x0220 #define _ADDRESS_PIO_OUTPUT 0x0221 #define _ADDRESS_PIO_ACTIVITY 0x0222 #define _ADDRESS_CONDITIONAL_SEARCH_PIO 0x0223 #define _ADDRESS_CONDITIONAL_SEARCH_CONTROL 0x0225 /* ------- Functions ------------ */ /* DS2804 */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_scratch(BYTE * data, size_t size, off_t offset, struct parsedname *pn); static GOOD_OR_BAD OW_w_pio(BYTE data, struct parsedname *pn); static GOOD_OR_BAD OW_clear(struct parsedname *pn); static GOOD_OR_BAD OW_w_reg(BYTE * data, size_t size, off_t offset, struct parsedname *pn); /* 2804 memory read */ static ZERO_OR_ERROR FS_r_mem(struct one_wire_query *owq) { size_t pagesize = 32; /* read is not a "paged" endeavor, the CRC comes after a full read */ return GB_to_Z_OR_E(COMMON_read_memory_F0(owq, 0, pagesize)) ; } /* Note, it's EPROM -- write once */ static ZERO_OR_ERROR FS_w_mem(struct one_wire_query *owq) { size_t pagesize = 32; /* write is "byte at a time" -- not paged */ return GB_to_Z_OR_E(COMMON_readwrite_paged(owq, 0, pagesize, OW_w_mem)) ; } /* 2804 memory write */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { size_t pagesize = 32; return COMMON_offset_process( FS_r_mem, owq, OWQ_pn(owq).extension*pagesize) ; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { size_t pagesize = 32; /* write is "byte at a time" -- not paged */ return COMMON_offset_process( FS_w_mem, owq, OWQ_pn(owq).extension*pagesize ) ; } /* 2804 switch */ static ZERO_OR_ERROR FS_r_pio(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_pio); OWQ_create_temporary(owq_pio, (char *) &data, 1, _ADDRESS_PIO_OUTPUT, PN(owq)); if ( COMMON_read_memory_F0(owq_pio, 0, 0) != 0 ) { return -EINVAL; } OWQ_U(owq) = BYTE_INVERSE(data) & 0x03; /* reverse bits */ return 0; } /* write 2804 switch -- 2 values*/ static ZERO_OR_ERROR FS_w_pio(struct one_wire_query *owq) { BYTE data = 0; /* reverse bits */ data = BYTE_INVERSE(OWQ_U(owq)) | 0xFC; /* Set bits 2-7 to "1" */ return GB_to_Z_OR_E(OW_w_pio(data, PN(owq))) ; } /* 2804 switch -- is Vcc powered?*/ static ZERO_OR_ERROR FS_power(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_power); OWQ_create_temporary(owq_power, (char *) &data, 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, PN(owq)); if ( COMMON_read_memory_F0(owq_power, 0, 0) != 0 ) { return -EINVAL; } OWQ_Y(owq) = UT_getbit(&data, 7); return 0; } /* 2904 switch -- power-on status of polrity pin */ static ZERO_OR_ERROR FS_polarity(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_polarity); OWQ_create_temporary(owq_polarity, (char *) &data, 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, PN(owq)); if ( COMMON_read_memory_F0(owq_polarity, 0, 0) != 0 ) { return -EINVAL; } OWQ_Y(owq) = UT_getbit(&data, 6); return 0; } /* 2804 switch -- power-on status of polrity pin */ static ZERO_OR_ERROR FS_r_por(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_por); OWQ_create_temporary(owq_por, (char *) &data, 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, PN(owq)); if ( COMMON_read_memory_F0(owq_por, 0, 0) != 0 ) { return -EINVAL; } OWQ_Y(owq) = UT_getbit(&data, 3); return 0; } /* 2804 switch -- power-on status of polrity pin */ static ZERO_OR_ERROR FS_w_por(struct one_wire_query *owq) { BYTE data; struct parsedname *pn = PN(owq); OWQ_allocate_struct_and_pointer(owq_por); OWQ_create_temporary(owq_por, (char *) &data, 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, pn); if (COMMON_read_memory_F0(owq_por, 0, 0)) { return -EINVAL; /* get current register */ } if (UT_getbit(&data, 3)) { /* needs resetting? bit3==1 */ data ^= 0x08; /* flip bit 3 */ RETURN_ERROR_IF_BAD( OW_w_reg(&data, 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, pn)) ; if (FS_r_por(owq)) { return -EINVAL; /* reread */ } if (OWQ_Y(owq)) { return -EINVAL; /* not reset despite our try */ } } return 0; /* good */ } /* 2804 switch PIO sensed*/ static ZERO_OR_ERROR FS_sense(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_sense); OWQ_create_temporary(owq_sense, (char *) &data, 1, _ADDRESS_PIO_LOGIC, PN(owq)); if ( COMMON_read_memory_F0(owq_sense, 0, 0) != 0 ) { return -EINVAL; } OWQ_U(owq) = (data) & 0x03; return 0; } /* 2804 switch activity latch*/ static ZERO_OR_ERROR FS_r_latch(struct one_wire_query *owq) { BYTE data; OWQ_allocate_struct_and_pointer(owq_latch); OWQ_create_temporary(owq_latch, (char *) &data, 1, _ADDRESS_PIO_ACTIVITY, PN(owq)); if ( COMMON_read_memory_F0(owq_latch, 0, 0) != 0 ) { return -EINVAL; } OWQ_U(owq) = data & 0x03; return 0; } /* 2804 switch activity latch*/ static ZERO_OR_ERROR FS_w_latch(struct one_wire_query *owq) { return GB_to_Z_OR_E(OW_clear(PN(owq))) ; } /* 2804 alarm settings*/ static ZERO_OR_ERROR FS_r_s_alarm(struct one_wire_query *owq) { BYTE data[3]; OWQ_allocate_struct_and_pointer(owq_alarm); OWQ_create_temporary(owq_alarm, (char *) data, 3, _ADDRESS_CONDITIONAL_SEARCH_PIO, PN(owq)); if (COMMON_read_memory_F0(owq_alarm, 0, 0)) { return -EINVAL; } OWQ_U(owq) = (data[2] & 0x03) * 100; OWQ_U(owq) += UT_getbit(&data[1], 0) | (UT_getbit(&data[0], 0) << 1); OWQ_U(owq) += UT_getbit(&data[1], 1) | (UT_getbit(&data[0], 1) << 1) * 10; return 0; } /* 2804 alarm settings*/ static ZERO_OR_ERROR FS_w_s_alarm(struct one_wire_query *owq) { BYTE data[3] = { 0, 0, 0, }; UINT U = OWQ_U(owq); OWQ_allocate_struct_and_pointer(owq_alarm); OWQ_create_temporary(owq_alarm, (char *) &data[2], 1, _ADDRESS_CONDITIONAL_SEARCH_CONTROL, PN(owq)); if (COMMON_read_memory_F0(owq_alarm, 0, 0)) { return -EINVAL; } data[2] |= (U / 100 % 10) & 0x03; UT_setbit(&data[1], 0, (int) (U % 10) & 0x01); UT_setbit(&data[1], 1, (int) (U / 10 % 10) & 0x01); UT_setbit(&data[0], 0, ((int) (U % 10) & 0x02) >> 1); UT_setbit(&data[0], 1, ((int) (U / 10 % 10) & 0x02) >> 1); return GB_to_Z_OR_E(OW_w_reg(data, 3, _ADDRESS_CONDITIONAL_SEARCH_PIO, PN(owq))) ; } static GOOD_OR_BAD OW_w_scratch(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3 + 32 + 2] = { _1W_WRITE_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE(p, 3 + size), TRXN_END, }; struct transaction_log tcrc[] = { TRXN_START, TRXN_WR_CRC16(p, 3 + size, 0), TRXN_END, }; memcpy(&p[3], data, size); if (((size + offset) & 0x1F) == 0) { /* Check CRC if write is to end of page */ return BUS_transaction(tcrc, pn); } else { return BUS_transaction(t, pn); } } /* pre-paged */ static GOOD_OR_BAD OW_w_mem(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[4 + 32 + 2] = { _1W_READ_SCRATCHPAD, LOW_HIGH_ADDRESS(offset), }; struct transaction_log tread[] = { TRXN_START, TRXN_WR_CRC16(p, 3, 1 + size), TRXN_COMPARE(&p[4], data, size), TRXN_END, }; struct transaction_log tcopy[] = { TRXN_START, TRXN_WRITE3(p), TRXN_POWER( &p[3], 10 ) , TRXN_END, }; RETURN_BAD_IF_BAD( OW_w_scratch(data, size, offset, pn) ); RETURN_BAD_IF_BAD( BUS_transaction(tread, pn)) ; p[0] = _1W_COPY_SCRATCHPAD; return BUS_transaction(tcopy, pn); } //* write status byte */ static GOOD_OR_BAD OW_w_reg(BYTE * data, size_t size, off_t offset, struct parsedname *pn) { BYTE p[3] = { _1W_WRITE_REGISTER, LOW_HIGH_ADDRESS(offset), }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ(data, size), TRXN_END, }; return BUS_transaction(t, pn); } /* set PIO state bits: bit0=A bit1=B, value: open=1 closed=0 */ static GOOD_OR_BAD OW_w_pio(BYTE data, struct parsedname *pn) { BYTE p[3] = { _1W_PIO_ACCESS_WRITE, BYTE_MASK(data), BYTE_INVERSE(data), }; BYTE confirm[] = { _1W_PIO_CONFIRMATION, }; BYTE resp[1]; struct transaction_log t[] = { TRXN_START, TRXN_WRITE3(p), TRXN_READ1(resp), TRXN_COMPARE(resp, confirm, 1), TRXN_END, }; return BUS_transaction(t, pn); } /* Clear latches */ static GOOD_OR_BAD OW_clear(struct parsedname *pn) { BYTE cmd[] = { _1W_RESET_ACTIVITY_LATCHES, }; BYTE resp[1]; BYTE confirm[] = { _1W_PIO_CONFIRMATION, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE1(cmd), TRXN_READ1(resp), TRXN_COMPARE(resp, confirm, 1), TRXN_END, }; return BUS_transaction(t, pn); } owfs-2.8p15/module/owlib/src/c/ow_browse_monitor.c0000644000175000017500000000531211704646270017153 00000000000000/* $Id: ow_browse_monitor.c,v 1.9 2012/01/15 22:01:28 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" static void Browse_close(struct connection_in *in); static GOOD_OR_BAD browse_in_use(const struct connection_in * in_selected) ; /* Device-specific functions */ GOOD_OR_BAD Browse_detect(struct connection_in *in) { #if OW_ZERO in->iroutines.detect = Browse_detect; in->Adapter = adapter_browse_monitor; /* OWFS assigned value */ in->iroutines.reset = NO_RESET_ROUTINE; in->iroutines.next_both = NO_NEXT_BOTH_ROUTINE; in->iroutines.PowerByte = NO_POWERBYTE_ROUTINE; in->iroutines.ProgramPulse = NO_PROGRAMPULSE_ROUTINE; in->iroutines.sendback_data = NO_SENDBACKDATA_ROUTINE; in->iroutines.sendback_bits = NO_SENDBACKBITS_ROUTINE; in->iroutines.select = NO_SELECT_ROUTINE; in->iroutines.select_and_sendback = NO_SELECTANDSENDBACK_ROUTINE; in->iroutines.reconnect = NO_RECONNECT_ROUTINE; in->iroutines.close = Browse_close; in->iroutines.flags = ADAP_FLAG_sham; in->adapter_name = "ZeroConf monitor"; in->busmode = bus_browse ; RETURN_BAD_IF_BAD( browse_in_use(in) ) ; in->master.browse.bonjour_browse = 0 ; #if !OW_CYGWIN in->master.browse.avahi_browser = NULL ; in->master.browse.avahi_poll = NULL ; in->master.browse.avahi_client = NULL ; #endif /* !OW_CYGWIN */ if (Globals.zero == zero_none ) { LEVEL_DEFAULT("Zeroconf/Bonjour is disabled since Bonjour or Avahi library wasn't found."); return gbBAD; } else { OW_Browse(in); } return gbGOOD ; #else /* OW_ZERO */ (void) in ; return gbBAD ; #endif /* OW_ZERO */ } static GOOD_OR_BAD browse_in_use(const struct connection_in * in_selected) { struct connection_in *in; for (in = Inbound_Control.head; in != NO_CONNECTION; in = in->next) { if ( in == in_selected ) { continue ; } if ( in->busmode != bus_browse ) { continue ; } return gbBAD ; } return gbGOOD; // not found in the current inbound list } static void Browse_close(struct connection_in *in) { #if OW_ZERO if (in->master.browse.bonjour_browse && (libdnssd != NULL)) { DNSServiceRefDeallocate(in->master.browse.bonjour_browse); in->master.browse.bonjour_browse = 0 ; } #if !OW_CYGWIN if ( in->master.browse.avahi_poll != NULL ) { // Signal avahi loop to quit (in ow_avahi_browse.c) // and clean up for itself avahi_simple_poll_quit(in->master.browse.avahi_poll); } #endif /* !OW_CYGWIN */ #else /* OW_ZERO */ (void) in ; #endif /* OW_ZERO */ } owfs-2.8p15/module/owlib/src/c/ow_alias.c0000644000175000017500000001370711674762370015211 00000000000000/* $Id: ow_alias.c,v 1.33 2011/12/23 02:18:32 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_opt -- owlib specific command line options processing */ #define _GNU_SOURCE #include // for getline #undef _GNU_SOURCE #include #include "owfs_config.h" #include "ow.h" GOOD_OR_BAD ReadAliasFile(const ASCII * file) { FILE *alias_file_pointer ; /* getline parameters. allocated and reallocated by getline. use free rather than owfree */ char * alias_line = NULL ; size_t alias_line_length ; int line_number = 0; /* try to open file for reading */ alias_file_pointer = fopen(file, "r"); if ( alias_file_pointer == NULL ) { ERROR_DEFAULT("Cannot process alias file %s", file); return gbBAD; } /* read each line and parse */ while (getline(&alias_line, &alias_line_length, alias_file_pointer) >= 0) { ++line_number; BYTE sn[SERIAL_NUMBER_SIZE] ; char * a_line = alias_line ; // pointer within the line char * sn_char = NULL ; // pointer to serial number char * name_char = NULL ; // pointer to alias name while ( a_line ) { sn_char = strsep( &a_line, "/ \t=\n"); if ( strlen(sn_char)>0 ) { // non delim char break ; } } if ( Parse_SerialNumber(sn_char, sn) != sn_valid ) { LEVEL_CALL("Problem parsing device name in alias file %s:%d",file,line_number) ; continue ; } if ( a_line ) { a_line += strspn(a_line," \t=") ; } while ( a_line ) { name_char = strsep( &a_line, "\n"); size_t len = strlen(name_char) ; if ( len > 0 ) { while ( len>0 ) { if ( name_char[len-1] != ' ' && name_char[len-1] != '\t' ) { break ; } name_char[--len] = '\0' ; } Test_and_Add_Alias( name_char, sn) ; break ; } } } if ( alias_line != NULL ) { free(alias_line) ; // not owfree since allocated by getline } fclose(alias_file_pointer); return gbGOOD; } /* Name is a null-terminated string */ /* sn is an 8-byte serial number */ /* 1. Trims name * 2. Checks name length * 3. Refuses reserved words * 4. Refuses path separator (/) * 5. Removes any old assignments to name or serial number * 6. Add new alias * */ GOOD_OR_BAD Test_and_Add_Alias( char * name, BYTE * sn ) { BYTE sn_stored[SERIAL_NUMBER_SIZE] ; size_t len ; // Parse off initial spaces while ( name[0] == ' ' ) { ++name ; } // parse off trailing spaces for ( len = strlen(name) ; len > 0 && name[len-1]==' ' ; ) { -- len ; name[len] = '\0' ; } // zero length allowed -- will delete this entry. // Check length if ( len > PROPERTY_LENGTH_ALIAS ) { LEVEL_CALL("Alias too long: sn=" SNformat ", Alias=%s, Length=%d, Max length=%d", SNvar(sn), name, (int) len, PROPERTY_LENGTH_ALIAS ) ; return gbBAD ; } // Reserved word? if ( strcmp( name, "interface" )==0 || strcmp( name, "settings" )==0 || strcmp( name, "uncached" )==0 || strcmp( name, "unaliased" )==0 || strcmp( name, "text" )==0 || strcmp( name, "alarm" )==0 || strcmp( name, "statistics" )==0 || strcmp( name, "simultaneous" )==0 || strcmp( name, "structure" )==0 || strncmp( name, "bus.", 4 )==0 ) { LEVEL_CALL("Alias attempts to redefine reserved filename: %s",name ) ; return gbBAD ; } // No path separator allowed in name if ( strchr( name, '/' ) ) { LEVEL_CALL("Alias contains confusing path separator \'/\': %s",name ) ; return gbBAD ; } // Is there another assignment for this alias name already? if ( GOOD( Cache_Get_Alias_SN( name, sn_stored ) ) ) { if ( memcmp( sn, sn_stored, SERIAL_NUMBER_SIZE ) == 0 ) { // repeat assignment return gbGOOD ; } // delete old serial number LEVEL_CALL("Alias %s reassigned from "SNformat" to "SNformat,name,SNvar(sn_stored),SNvar(sn)) ; Cache_Del_Alias(sn_stored) ; } // Delete any prior assignments for this serial number Cache_Del_Alias(sn) ; // Now add return Cache_Add_Alias( name, sn) ; } void FS_dir_entry_aliased(void (*dirfunc) (void *, const struct parsedname *), void *v, const struct parsedname *pn) { if ( ( pn->state & ePS_unaliased ) == 0 ) { // Want alias substituted struct parsedname s_pn_copy ; struct parsedname * pn_copy = & s_pn_copy ; ASCII path[PATH_MAX+3] ; ASCII * path_pointer = path ; // current location in original path // Shallow copy memcpy( pn_copy, pn, sizeof(struct parsedname) ) ; pn_copy->path[0] = '\0' ; // path copy to use for separation strcpy( path, pn->path ) ; // copy segments of path (delimitted by "/") to copy while( path_pointer != NULL ) { ASCII * path_segment = strsep( &path_pointer, "/" ) ; BYTE sn[SERIAL_NUMBER_SIZE] ; if ( PATH_MAX < strlen(pn_copy->path) + strlen(path_segment) ) { // too long, just use initial copy strcpy( pn_copy->path, pn->path ) ; break ; } //test this segment for serial number if ( Parse_SerialNumber(path_segment,sn) == sn_valid ) { //printf("We see serial number in path "SNformat"\n",SNvar(sn)) ; // now test for alias ASCII * name = Cache_Get_Alias( sn ) ; if ( name != NULL ) { //printf("It's aliased to %s\n",name); // now test for room if ( PATH_MAX < strlen(pn_copy->path) + strlen(name) ) { // too long, just use initial copy strcpy( pn_copy->path, pn->path ) ; owfree(name) ; break ; } // overwrite serial number with alias name strcat( pn_copy->path, name ) ; owfree( name ) ; } else { strcat( pn_copy->path, path_segment ) ; } } else { strcat( pn_copy->path, path_segment ) ; } if ( path_pointer != NULL ) { strcat( pn_copy->path, "/" ) ; } //LEVEL_DEBUG( "Alias path so far: %s",pn_copy->path ) ; } if ( dirfunc != NULL ) { DIRLOCK; dirfunc(v, pn_copy); DIRUNLOCK; } } else { // Don't want alias substituted if ( dirfunc != NULL ) { DIRLOCK; dirfunc(v, pn); DIRUNLOCK; } } } owfs-2.8p15/module/owlib/src/c/ow_w1_bind.c0000644000175000017500000000472411736626772015446 00000000000000/* $Id: ow_w1_bind.c,v 1.21 2012/04/01 18:22:54 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 #include "ow_w1.h" #include "ow_connection.h" // Bind the master netlink socket for all communication // responses will have to be routed to appropriate bus master GOOD_OR_BAD w1_bind( struct connection_in * in ) { struct sockaddr_nl l_local ; SOC(in)->type = ct_netlink ; Test_and_Close( &(SOC(in)->file_descriptor) ) ; // just in case // Example from http://lxr.linux.no/linux+v3.0/Documentation/connector/ucon.c#L114 //SOC(in)->file_descriptor = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); // SOC(in)->file_descriptor = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC , NETLINK_CONNECTOR); SOC(in)->file_descriptor = socket(PF_NETLINK, SOCK_RAW , NETLINK_CONNECTOR); if ( FILE_DESCRIPTOR_NOT_VALID( SOC(in)->file_descriptor ) ) { ERROR_CONNECT("Netlink (w1) socket (are you root?)"); return gbBAD; } fcntl (SOC(in)->file_descriptor, F_SETFD, FD_CLOEXEC); // for safe forking l_local.nl_pid = in->master.w1_monitor.pid = getpid() ; l_local.nl_pad = 0; l_local.nl_family = AF_NETLINK; l_local.nl_groups = 23; if ( bind( SOC(in)->file_descriptor, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl) ) == -1 ) { ERROR_CONNECT("Netlink (w1) bind (are you root?)"); Test_and_Close( &( SOC(in)->file_descriptor) ); return gbBAD ; } SOC(in)->state = cs_deflowered ; return gbGOOD ; } #endif /* OW_W1 */ owfs-2.8p15/module/owlib/src/c/ow_net_server.c0000644000175000017500000002711011734375133016257 00000000000000/* $Id: ow_net_server.c,v 1.60 2012/03/27 17:35:23 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_net holds the network utility routines. Many stolen unashamedly from Steven's Book */ /* Much modification by Christian Magnusson especially for Valgrind and embedded */ /* non-threaded fixes by Jerry Scharf */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* Locking for thread work */ /* Variables only used in this particular file */ /* i.e. "locally global" */ my_rwlock_t shutdown_mutex_rw ; pthread_mutex_t handler_thread_mutex ; int handler_thread_count ; int shutdown_in_progress ; FILE_DESCRIPTOR_OR_ERROR shutdown_pipe[2] ; /* Prototypes */ static GOOD_OR_BAD ServerAddr(const char * default_port, struct connection_out *out); static FILE_DESCRIPTOR_OR_ERROR ServerListen(struct connection_out *out); static FILE_DESCRIPTOR_OR_ERROR SetupListenSet( fd_set * listenset ) ; static GOOD_OR_BAD SetupListenSockets( void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor) ) ; static void CloseListenSockets( void ) ; static void ProcessListenSocket( struct connection_out * out ) ; static void *ProcessAcceptSocket(void *arg) ; static void ProcessListenSet( fd_set * listenset ) ; static GOOD_OR_BAD ListenCycle( void ) ; static GOOD_OR_BAD ServerAddr(const char * default_port, struct connection_out *out) { struct addrinfo hint; char *p; if (out->name == NULL) { // use defaults out->host = owstrdup("0.0.0.0"); out->service = owstrdup(default_port); } else if ((p = strrchr(out->name, ':')) == NULL) { if (strchr(out->name, '.')) { //probably an address out->host = owstrdup(out->name); out->service = owstrdup(default_port); } else { // assume a port out->host = owstrdup("0.0.0.0"); out->service = owstrdup(out->name); } } else { p[0] = '\0'; out->host = owstrdup(out->name); p[0] = ':'; out->service = owstrdup(&p[1]); } memset(&hint, 0, sizeof(struct addrinfo)); hint.ai_flags = AI_PASSIVE; // SOCK_CLOEXEC causes problems // hint.ai_socktype = SOCK_STREAM | SOCK_CLOEXEC ; hint.ai_socktype = SOCK_STREAM ; #if OW_CYGWIN || defined(__FreeBSD__) hint.ai_family = AF_INET; // FreeBSD will bind IP6 preferentially #else /* __FreeBSD__ */ hint.ai_family = AF_UNSPEC; #endif /* __FreeBSD__ */ //printf("ServerAddr: [%s] [%s]\n", out->host, out->service); if ( getaddrinfo(out->host, out->service, &hint, &out->ai) != 0 ) { ERROR_CONNECT("GetAddrInfo error [%s]=%s:%s", SAFESTRING(out->name), SAFESTRING(out->host), SAFESTRING(out->service)); return gbBAD; } return gbGOOD; } static FILE_DESCRIPTOR_OR_ERROR ServerListen(struct connection_out *out) { if (out->ai == NULL) { LEVEL_CONNECT("Server address not yet parsed [%s]", SAFESTRING(out->name)); return FILE_DESCRIPTOR_BAD; } if (out->ai_ok == NULL) { out->ai_ok = out->ai; } do { int on = 1; FILE_DESCRIPTOR_OR_ERROR file_descriptor = socket(out->ai_ok->ai_family, out->ai_ok->ai_socktype, out->ai_ok->ai_protocol); //printf("ServerListen file_descriptor=%d\n",file_descriptor); if ( FILE_DESCRIPTOR_NOT_VALID(file_descriptor) ) { ERROR_CONNECT("Socket problem [%s]", SAFESTRING(out->name)); } else if (setsockopt(file_descriptor, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) != 0) { ERROR_CONNECT("SetSockOpt problem [%s]", SAFESTRING(out->name)); } else if (bind(file_descriptor, out->ai_ok->ai_addr, out->ai_ok->ai_addrlen) != 0) { // this is where the default linking to a busy port shows up ERROR_CONNECT("Bind problem [%s]", SAFESTRING(out->name)); } else if (listen(file_descriptor, 10) != 0) { ERROR_CONNECT("Listen problem [%s]", SAFESTRING(out->name)); } else { fcntl (file_descriptor, F_SETFD, FD_CLOEXEC); // for safe forking out->file_descriptor = file_descriptor; return file_descriptor; } Test_and_Close(&file_descriptor) ; } while ((out->ai_ok = out->ai_ok->ai_next)); LEVEL_CONNECT("No good listen network sockets [%s]", SAFESTRING(out->name)); return FILE_DESCRIPTOR_BAD; } GOOD_OR_BAD ServerOutSetup(struct connection_out *out) { if ( out->name == NULL ) { // NULL name means default attempt char * default_port ; // First time through, try default port switch (Globals.program_type) { case program_type_server: case program_type_external: default_port = DEFAULT_SERVER_PORT ; break ; case program_type_ftpd: default_port = DEFAULT_FTP_PORT ; break ; default: default_port = NULL ; break ; } if ( default_port != NULL ) { // one of the 2 cases above RETURN_BAD_IF_BAD( ServerAddr( default_port, out ) ) ; if ( FILE_DESCRIPTOR_VALID(ServerListen(out)) ) { return gbGOOD ; } ERROR_CONNECT("Default port not successful. Try an ephemeral port"); } } // second time through, use ephemeral port RETURN_BAD_IF_BAD( ServerAddr( "0", out ) ) ; return FILE_DESCRIPTOR_VALID(ServerListen(out)) ? gbGOOD : gbBAD ; } static FILE_DESCRIPTOR_OR_ERROR SetupListenSet( fd_set * listenset ) { FILE_DESCRIPTOR_OR_ERROR maxfd = FILE_DESCRIPTOR_BAD ; struct connection_out * out ; FD_ZERO( listenset ) ; for (out = Outbound_Control.head; out; out = out->next) { FILE_DESCRIPTOR_OR_ERROR fd = out->file_descriptor ; if ( FILE_DESCRIPTOR_VALID( fd ) ) { FD_SET( fd, listenset ) ; if ( fd > maxfd ) { maxfd = fd ; } } } return maxfd ; } static GOOD_OR_BAD SetupListenSockets( void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor) ) { struct connection_out * out ; GOOD_OR_BAD any_sockets = gbBAD ; for (out = Outbound_Control.head; out; out = out->next) { if ( GOOD( ServerOutSetup( out ) ) ) { any_sockets = gbGOOD; ZeroConf_Announce(out); } out-> HandlerRoutine = HandlerRoutine ; } return any_sockets ; } static void CloseListenSockets( void ) { struct connection_out * out ; for (out = Outbound_Control.head; out; out = out->next) { Test_and_Close( &(out->file_descriptor) ) ; } } static void ProcessListenSet( fd_set * listenset ) { struct connection_out * out ; for (out = Outbound_Control.head; out; out = out->next) { if ( FD_ISSET( out->file_descriptor, listenset ) ) { ProcessListenSocket( out ) ; } } } /* structure */ struct Accept_Socket_Data { FILE_DESCRIPTOR_OR_ERROR acceptfd; struct connection_out * out; }; static GOOD_OR_BAD ListenCycle( void ) { fd_set listenset ; FILE_DESCRIPTOR_OR_ERROR maxfd = SetupListenSet( &listenset) ; if ( FILE_DESCRIPTOR_VALID( maxfd ) ) { if ( select( maxfd+1, &listenset, NULL, NULL, NULL) > 0 ) { ProcessListenSet( &listenset) ; return gbGOOD ; } } return gbBAD ; } #if OW_MT // Read data from the waiting socket and do the actual work static void *ProcessAcceptSocket(void *arg) { struct Accept_Socket_Data * asd = (struct Accept_Socket_Data *) arg; DETACH_THREAD; // Do the actual work asd->out->HandlerRoutine( asd->acceptfd ); // cleanup Test_and_Close( &(asd->acceptfd) ); owfree(asd); LEVEL_DEBUG("Normal exit."); // All done. If shutdown in progress and this is a last handler thread, send a message to the main thread. RWLOCK_RLOCK( shutdown_mutex_rw ) ; _MUTEX_LOCK( handler_thread_mutex ) ; --handler_thread_count ; if ( shutdown_in_progress && handler_thread_count==0) { if ( FILE_DESCRIPTOR_VALID( shutdown_pipe[fd_pipe_write] ) ) { ignore_result = write( shutdown_pipe[fd_pipe_write],"X",1) ; //dummy payload } } _MUTEX_UNLOCK( handler_thread_mutex ) ; RWLOCK_RUNLOCK( shutdown_mutex_rw ) ; return VOID_RETURN; } static void ProcessListenSocket( struct connection_out * out ) { FILE_DESCRIPTOR_OR_ERROR acceptfd; struct Accept_Socket_Data * asd ; acceptfd = accept(out->file_descriptor, NULL, NULL); if ( FILE_DESCRIPTOR_NOT_VALID( acceptfd ) ) { return ; } // allocate space to pass variables to thread -- cleaned up in thread handler asd = owmalloc( sizeof(struct Accept_Socket_Data) ) ; if ( asd == NULL ) { LEVEL_DEBUG("Could not allocate memory to handle this request"); close( acceptfd ) ; return ; } asd->acceptfd = acceptfd ; asd->out = out ; // Launch Handler thread only if shutdown not in progress RWLOCK_RLOCK( shutdown_mutex_rw ) ; if ( ! shutdown_in_progress ) { pthread_t tid; _MUTEX_LOCK( handler_thread_mutex ) ; ++handler_thread_count ; _MUTEX_UNLOCK( handler_thread_mutex ) ; if ( pthread_create(&tid, DEFAULT_THREAD_ATTR, ProcessAcceptSocket, asd ) != 0 ) { // Do it in the main routine rather than a thread LEVEL_DEBUG("Thread creation problem. Will handle request unthreaded"); ProcessAcceptSocket(asd) ; } } RWLOCK_RUNLOCK( shutdown_mutex_rw ) ; } /* Setup Servers -- select on each port */ void ServerProcess(void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor)) { /* Locking for thread work */ int need_to_read_pipe ; handler_thread_count = 0 ; shutdown_in_progress = 0 ; Init_Pipe( shutdown_pipe ) ; RWLOCK_INIT( shutdown_mutex_rw ) ; _MUTEX_INIT(handler_thread_mutex); if ( pipe( shutdown_pipe ) != 0 ) { ERROR_DEFAULT("Cannot allocate a shutdown pipe. The program shutdown may be messy"); Init_Pipe( shutdown_pipe ) ; } fcntl (shutdown_pipe[fd_pipe_read], F_SETFD, FD_CLOEXEC); // for safe forking fcntl (shutdown_pipe[fd_pipe_write], F_SETFD, FD_CLOEXEC); // for safe forking if ( GOOD( SetupListenSockets( HandlerRoutine ) ) ) { while ( GOOD( ListenCycle() ) ) { } // Make sure all the handler threads are complete before closing down RWLOCK_WLOCK( shutdown_mutex_rw ) ; shutdown_in_progress = 1 ; // Signal time to wrap up // need to test if there is a handler to wait for before closing // note that a new one can't be started while the write lock is held need_to_read_pipe = handler_thread_count>0 && FILE_DESCRIPTOR_VALID( shutdown_pipe[fd_pipe_read] ) ; RWLOCK_WUNLOCK( shutdown_mutex_rw ) ; if ( need_to_read_pipe ) { // now wait for write to pipe from last handler thread char buf[2] ; ignore_result = read( shutdown_pipe[fd_pipe_read],buf,1) ; } Test_and_Close_Pipe(shutdown_pipe) ; RWLOCK_DESTROY(shutdown_mutex_rw) ; _MUTEX_DESTROY(handler_thread_mutex) ; CloseListenSockets() ; } else { LEVEL_DEFAULT("Isolated from any control -- exit") ; } /* Cleanup that may never be reached */ return; } #else /* OW_MT */ // Read data from the waiting socket and do the actual work static void *ProcessAcceptSocket(void *arg) { struct Accept_Socket_Data * asd = (struct Accept_Socket_Data *) arg; // Do the actual work asd->out->HandlerRoutine( asd->acceptfd ); // cleanup Test_and_Close( &(asd->acceptfd) ); owfree(asd); LEVEL_DEBUG("Normal exit."); return VOID_RETURN; } static void ProcessListenSocket( struct connection_out * out ) { FILE_DESCRIPTOR_OR_ERROR acceptfd; struct Accept_Socket_Data * asd ; acceptfd = accept(out->file_descriptor, NULL, NULL); if ( FILE_DESCRIPTOR_NOT_VALID( acceptfd ) ) { return ; } // allocate space to pass variables to thread -- cleaned up in thread handler asd = owmalloc( sizeof(struct Accept_Socket_Data) ) ; if ( asd == NULL ) { close( acceptfd ) ; return ; } asd->acceptfd = acceptfd ; asd->out = out ; ProcessAcceptSocket(asd) ; } /* Setup Servers -- select on each port */ void ServerProcess(void (*HandlerRoutine) (FILE_DESCRIPTOR_OR_ERROR file_descriptor)) { if ( GOOD( SetupListenSockets( HandlerRoutine ) ) ) { while ( GOOD( ListenCycle() ) ) { } CloseListenSockets() ; } else { LEVEL_DEFAULT("Isolated from any control -- exit") ; } /* Cleanup that may never be reached */ return; } #endif /* OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_sibling.c0000664000175000017500000000456311606144672015543 00000000000000/* $Id: ow_sibling.c,v 1.17 2011/07/09 21:35:54 pascalbaerten Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" ZERO_OR_ERROR FS_w_sibling_bitwork(UINT set, UINT mask, const char * sibling, struct one_wire_query *owq) { ZERO_OR_ERROR write_error = -EINVAL ; struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return -EINVAL ; } if ( FS_read_local(owq_sibling) == 0 ) { // UINT bitfield = OWQ_U(owq) ; //the original state does not come from owq, but from owq_sibling UINT bitfield = OWQ_U(owq_sibling) ; // clear mask: bitfield &= ~mask ; // set bits: bitfield |= (set & mask) ; OWQ_U(owq_sibling) = bitfield ; LEVEL_DEBUG("w sibling bit work set=%04X mask=%04X, sibling=%s, bitfield=%04X", set,mask, sibling,bitfield) ; write_error = FS_write_local(owq_sibling); } OWQ_destroy(owq_sibling) ; return write_error; } /* Delete entry in cache */ void FS_del_sibling(const char * sibling, struct one_wire_query *owq) { struct one_wire_query * owq_sibling = OWQ_create_sibling( sibling, owq ) ; if ( owq_sibling == NO_ONE_WIRE_QUERY ) { return ; } OWQ_Cache_Del(owq_sibling) ; OWQ_destroy(owq_sibling) ; } owfs-2.8p15/module/owlib/src/c/ow_thermocouple.c0000664000175000017500000002143610750074144016613 00000000000000/* $Id: ow_thermocouple.c,v 1.3 2008/01/30 13:15:16 d1mag Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow_thermocouple.h" #if OW_THERMOCOUPLE /* ------- Structures ----------- */ // Note: highest order polynomial coefficient comes first struct thermocouple_data { _FLOAT mV_low, mV_high; _FLOAT temperature_low, temperature_high; struct { _FLOAT mV_upper; _FLOAT C[6]; } temperature[4]; _FLOAT mV_coldjunction[6]; }; struct thermocouple_data Thermocouple_data[e_type_last] = { { // Type_B -0.003, 13.82, // mV limits 0, 1820, // temperature limits { // mV -> temperature in ranges {-0.003, {-2.51221e+27, 2.13758e+24, 7.56308e+22, 1.74246e+20, 1.03265e+17, 0.826153,},}, // range 0 upper bound and coefficients {0.012, {-8.4706e+10, 6.47141e+08, 2.78322e+07, -474183, 4758.86, 41.6374,},}, // range 1 upper bound and coefficients {0.857, {2945.94, -7382.24, 7128.12, -3466.34, 1209.28, 62.3706,},}, // range 2 upper bound and coefficients {13.82, {0.00494198, -0.213432, 3.71517, -34.0892, 260.462, 221.702,},}, // range 3 upper bound and coefficients }, {-6.88408e-13, 2.15015e-10, -2.50994e-08, 7.0516e-06, -0.000269267, 0.000146246,}, // cold junction temperature -> mV }, // end Type_B { // Type_E -9.835, 76.373, // mV limits -270, 1000, // temperature limits { // mV -> temperature in ranges {-9.688, {3.26265, 138.271, 2343.84, 19858.7, 84111.6, 142368,},}, // range 0 upper bound and coefficients {-7.733, {3.26265, 138.271, 2343.84, 19858.7, 84111.6, 142368,},}, // range 1 upper bound and coefficients {6.93, {0.000149705, -0.00165641, 0.0119336, -0.249013, 17.1028, -0.0143392,},}, // range 2 upper bound and coefficients {76.373, {6.43417e-08, -1.81489e-05, 0.00220796, -0.130036, 15.9906, 3.96364,},}, // range 3 upper bound and coefficients }, {-3.75653e-12, 9.62809e-10, -1.02812e-07, 5.02521e-05, 0.0586085, -0.000287881,}, // cold junction temperature -> mV }, // end Type_E { // Type_J -8.095, 69.553, // mV limits -210, 1200, // temperature limits { // mV -> temperature in ranges {-5.194, {0.159313, 4.91673, 60.9921, 377.93, 1191.69, 1450.19,},}, // range 0 upper bound and coefficients {10.168, {6.32835e-05, -0.00164631, 0.0216838, -0.238347, 19.8278, 0.00456731,},}, // range 1 upper bound and coefficients {42.472, {2.94912e-06, -0.000385821, 0.017553, -0.358286, 21.3912, -6.15873,},}, // range 2 upper bound and coefficients {69.553, {4.61439e-06, -0.00139572, 0.166449, -9.73731, 294.793, -3051.08,},}, // range 3 upper bound and coefficients }, {-3.89357e-13, 1.87325e-10, -8.86007e-08, 3.04136e-05, 0.0503854, 9.80857e-06,}, // cold junction temperature -> mV }, // end Type_J { // Type_K -6.458, 54.819, // mV limits -270, 1370, // temperature limits { // mV -> temperature in ranges {-6.351, {16.5881, 450.901, 4901.84, 26628.6, 72304.4, 78407.2,},}, // range 0 upper bound and coefficients {-4.865, {16.5881, 450.901, 4901.84, 26628.6, 72304.4, 78407.2,},}, // range 1 upper bound and coefficients {6.981, {0.00061062, -0.00863106, 0.0728312, -0.405757, 25.3032, -0.0401767,},}, // range 2 upper bound and coefficients {54.819, {6.64007e-07, -0.00011542, 0.00927615, -0.338909, 29.0458, -18.483,},}, // range 3 upper bound and coefficients }, {-1.11057e-12, 2.31125e-10, -1.22507e-07, 2.63207e-05, 0.0394385, -0.000247425,}, // cold junction temperature -> mV }, // end Type_K { // Type_N -4.345, 47.513, // mV limits -270, 1300, // temperature limits { // mV -> temperature in ranges {-4.336, {0., 0., 0., 0., 1033.1, 4220.4,},}, // range 0 upper bound and coefficients {-3.85, {9667.39, 195822, 1.58634e+06, 6.42413e+06, 1.30051e+07, 1.05287e+07,},}, // range 1 upper bound and coefficients {2.48, {0.0255197, -0.0353939, -0.0717555, -0.864733, 38.5024, 0.116269,},}, // range 2 upper bound and coefficients {47.513, {1.93299e-06, -0.000295976, 0.0192512, -0.640613, 36.1391, 4.78696,},}, // range 3 upper bound and coefficients }, {-1.47913e-12, 1.35741e-10, 3.80869e-08, 1.33212e-05, 0.0260551, -0.0012884,}, // cold junction temperature -> mV }, // end Type_N { // Type_R -0.226, 21.003, // mV limits -50, 1760, // temperature limits { // mV -> temperature in ranges {0.284, {539.652, -288.34, 116.45, -91.4751, 189.1, -0.0232359,},}, // range 0 upper bound and coefficients {3.171, {0.313262, -3.48528, 16.2165, -43.8973, 173.888, 1.99571,},}, // range 1 upper bound and coefficients {15.348, {0.000132637, -0.00573544, 0.144438, -3.21251, 113.782, 44.5935,},}, // range 2 upper bound and coefficients {21.003, {0.0121004, -1.07146, 37.9227, -670.36, 5987.36, -20588.8,},}, // range 3 upper bound and coefficients }, {-2.54783e-16, 2.74148e-11, -2.2995e-08, 1.38489e-05, 0.00528974, 0.000102828,}, // cold junction temperature -> mV }, // end Type_R { // Type_S -0.236, 18.609, // mV limits -50, 1760, // temperature limits { // mV -> temperature in ranges {0.248, {72.7836, -147.497, 109.389, -80.6029, 184.799, 0.00485658,},}, // range 0 upper bound and coefficients {3.269, {0.268567, -3.07068, 14.6172, -39.81, 172.739, 1.58909,},}, // range 1 upper bound and coefficients {14.263, {4.55662e-05, 0.0011306, -0.0225231, -1.39047, 113.605, 45.2409,},}, // range 2 upper bound and coefficients {18.609, {0.0462634, -3.71475, 119.221, -1911.17, 15382.2, -48710.7,},}, // range 3 upper bound and coefficients }, {-3.13954e-13, 1.03e-10, -2.77745e-08, 1.25481e-05, 0.00541035, 1.19149e-05,}, // cold junction temperature -> mV }, // end Type_S { // Type_T -6.258, 20.872, // mV limits -270, 400, // temperature limits { // mV -> temperature in ranges {-6.236, {0, 0, 479.89, 8507, 50338, 99203,},}, // range 0 upper bound and coefficients {-5.739, {0, 0, 479.89, 8507, 50338, 99203,},}, // range 1 upper bound and coefficients {-1.545, {0.0589872, 0.884043, 5.49725, 15.4262, 49.2583, 13.1116,},}, // range 2 upper bound and coefficients {20.872, {1.77361e-05, -0.00124183, 0.0374592, -0.723968, 25.8858, -0.0114384,},}, // range 3 upper bound and coefficients }, {-3.30676e-12, 6.45333e-10, -3.91012e-08, 4.19966e-05, 0.0386665, -0.000360973,}, // cold junction temperature -> mV }, // end Type_T }; /* ------- Prototypes ----------- */ static _FLOAT Poly4Value(_FLOAT * c, _FLOAT x); static _FLOAT Temperature_from_mV(_FLOAT mV, enum e_thermocouple_type etype); _FLOAT Thermocouple_range_low(enum e_thermocouple_type etype) { return Thermocouple_data[etype].temperature_low; } _FLOAT Thermocouple_range_high(enum e_thermocouple_type etype) { return Thermocouple_data[etype].temperature_high; } _FLOAT ThermocoupleTemperature(_FLOAT mV_reading, _FLOAT temperature_coldjunction, enum e_thermocouple_type etype) { _FLOAT mV_coldjunction = Poly4Value(Thermocouple_data[etype].mV_coldjunction, temperature_coldjunction); return Temperature_from_mV(mV_reading + mV_coldjunction, etype); } // Find right range and calculate the temperature from (corrected) mV static _FLOAT Temperature_from_mV(_FLOAT mV, enum e_thermocouple_type etype) { if (mV < Thermocouple_data[etype].temperature[1].mV_upper) { if (mV < Thermocouple_data[etype].temperature[0].mV_upper) { return Poly4Value(Thermocouple_data[etype].temperature[0].C, mV); } else { return Poly4Value(Thermocouple_data[etype].temperature[1].C, mV); } } else { if (mV < Thermocouple_data[etype].temperature[2].mV_upper) { return Poly4Value(Thermocouple_data[etype].temperature[2].C, mV); } else { return Poly4Value(Thermocouple_data[etype].temperature[3].C, mV); } } } // Calculate 4th order polynomial using Homer's rule // Of form c0 + c1*x + c2*x^2 + c3*x^3 + c4*x^4 static _FLOAT Poly4Value(_FLOAT * c, _FLOAT x) { return c[5] + x * (c[4] + x * (c[3] + x * (c[2] + x * (c[1] + c[0] * x)))); } #endif /* OW_THERMOCOUPLE */ #ifdef THERMOCOUPLE_TEST #include void Thermotest(char type, enum e_thermocouple_type etype) { _FLOAT mV; printf("OWFS_%c = [\n", type); for (mV = Thermocouple_data[etype].mV_low; mV < Thermocouple_data[etype].mV_high; mV += .1) { printf("%g , %g \n", mV, Temperature_from_mV(mV, etype)); } printf("] ; \n"); } int main(void) { Thermotest('b', e_type_b); Thermotest('e', e_type_e); Thermotest('j', e_type_j); Thermotest('k', e_type_k); Thermotest('n', e_type_n); Thermotest('r', e_type_r); Thermotest('s', e_type_s); Thermotest('t', e_type_t); return 0; } #endif /* THERMOCOUPLE_TEST */ owfs-2.8p15/module/owlib/src/c/compat.c0000664000175000017500000002005411163471722014660 00000000000000/* $Id: compat.c,v 1.11 2009/03/28 19:00:34 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #ifndef HAVE_STRSEP /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Get next token from string *stringp, where tokens are possibly-empty * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. * On return, *stringp points past the last NUL written (if there might * be further tokens), or is NULL (if there are definitely no more tokens). * * If *stringp is NULL, strsep returns NULL. */ char *strsep(char **stringp, const char *delim) { char *s; const char *spanp; int c, sc; char *tok; if ((s = *stringp) == NULL) { return (NULL); } for (tok = s;;) { c = *s++; spanp = delim; do { if ((sc = *spanp++) == c) { if (c == 0) { s = NULL; } else { s[-1] = 0; } *stringp = s; return (tok); } } while (sc != 0); } /* NOTREACHED */ } #endif /* !defined(HAVE_STRSEP) */ #ifndef HAVE_TDESTROY /* uClibc older than 0.9.19 is missing tdestroy() (don't know exactly when it was added) I added a replacement to this, just to be able to compile owfs for WRT54G without any patched uClibc. */ #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif static void tdestroy_recurse_(node * root, void (*freefct) (void *)) { if (root->left != NULL) { tdestroy_recurse_(root->left, freefct); } if (root->right != NULL) { tdestroy_recurse_(root->right, freefct); } if (root->key) { (*freefct) ((void *) root->key); //free(root->key); root->key = NULL; } /* Free the node itself. */ owfree(root); } void tdestroy(void *vroot, void (*freefct) (void *)) { node *root = (node *) vroot; if (root != NULL) { tdestroy_recurse_(root, freefct); } } #endif /* HAVE_TDESTROY */ #ifndef HAVE_TSEARCH #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* find or insert datum into search tree. char *key; key to be located register node **rootp; address of tree root int (*compar)(); ordering function */ void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar) { register node *q; register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0) { return ((struct node_t *) 0); } while (*rootp != (struct node_t *) 0) { /* Knuth's T1: */ int r; if ((r = (*compar) (key, (*rootp)->key)) == 0) { /* T2: */ return (*rootp); /* we found it! */ } rootp = (r < 0) ? &(*rootp)->left : /* T3: follow left branch */ &(*rootp)->right; /* T4: follow right branch */ } q = (node *) owmalloc(sizeof(node)); /* T5: key not found */ if (q != (struct node_t *) 0) { /* make new node */ *rootp = q; /* link new node to old */ q->key = (void *) key; /* initialize new node */ q->left = q->right = (struct node_t *) 0; } return (q); } #endif #ifndef HAVE_TFIND #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif void *tfind(__const void *key, void *__const * vrootp, __compar_fn_t compar) { register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0) { return ((struct node_t *) 0); } while (*rootp != (struct node_t *) 0) { /* Knuth's T1: */ int r; if ((r = (*compar) (key, (*rootp)->key)) == 0) { /* T2: */ return (*rootp); /* we found it! */ } rootp = (r < 0) ? &(*rootp)->left : /* T3: follow left branch */ &(*rootp)->right; /* T4: follow right branch */ } return NULL; } #endif #ifndef HAVE_TFIND #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* delete node with given key char *key; key to be deleted register node **rootp; address of the root of tree int (*compar)(); comparison function */ void *tdelete(__const void *key, void **vrootp, __compar_fn_t compar) { node *p; register node *q; register node *r; int cmp; register node **rootp = (node **) vrootp; if (rootp == (struct node_t **) 0 || (p = *rootp) == (struct node_t *) 0) { return ((struct node_t *) 0); } while ((cmp = (*compar) (key, (*rootp)->key)) != 0) { p = *rootp; rootp = (cmp < 0) ? &(*rootp)->left : /* follow left branch */ &(*rootp)->right; /* follow right branch */ if (*rootp == (struct node_t *) 0) { return ((struct node_t *) 0); /* key not found */ } } r = (*rootp)->right; /* D1: */ if ((q = (*rootp)->left) == (struct node_t *) 0) { /* Left (struct node_t *)0? */ q = r; } else if (r != (struct node_t *) 0) { /* Right link is null? */ if (r->left == (struct node_t *) 0) { /* D2: Find successor */ r->left = q; q = r; } else { /* D3: Find (struct node_t *)0 link */ for (q = r->left; q->left != (struct node_t *) 0; q = r->left) r = q; r->left = q->right; q->left = (*rootp)->left; q->right = (*rootp)->right; } } owfree((struct node_t *) *rootp); /* D4: Free node */ *rootp = q; /* link parent to new node */ return (p); } #endif #ifndef HAVE_TWALK #ifndef NODE_T_DEFINED #define NODE_T_DEFINED typedef struct node_t { void *key; struct node_t *left, *right; } node; #endif /* Walk the nodes of a tree register node *root; Root of the tree to be walked register void (*action)(); Function to be called at each node register int level; */ static void trecurse(__const void *vroot, __action_fn_t action, int level) { register node *root = (node *) vroot; if (root->left == (struct node_t *) 0 && root->right == (struct node_t *) 0) { (*action) (root, leaf, level); } else { (*action) (root, preorder, level); if (root->left != (struct node_t *) 0) { trecurse(root->left, action, level + 1); } (*action) (root, postorder, level); if (root->right != (struct node_t *) 0) { trecurse(root->right, action, level + 1); } (*action) (root, endorder, level); } } /* void twalk(root, action) Walk the nodes of a tree node *root; Root of the tree to be walked void (*action)(); Function to be called at each node PTR */ void twalk(__const void *vroot, __action_fn_t action) { register __const node *root = (node *) vroot; if (root != (node *) 0 && action != (__action_fn_t) 0) { trecurse(root, action, 0); } } #endif owfs-2.8p15/module/owlib/src/c/ow_2438.c0000644000175000017500000010031511740076517014503 00000000000000/* $Id: ow_2438.c,v 1.98 2012/04/07 17:45:51 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include #include "owfs_config.h" #include "ow_2438.h" /* ------- Prototypes ----------- */ /* DS2438 Battery */ READ_FUNCTION(FS_r_page); WRITE_FUNCTION(FS_w_page); READ_FUNCTION(FS_temp); READ_FUNCTION(FS_volts); READ_FUNCTION(FS_Humid); READ_FUNCTION(FS_Humid_1735); READ_FUNCTION(FS_Humid_3600); READ_FUNCTION(FS_Humid_4000); READ_FUNCTION(FS_Humid_datanab); WRITE_FUNCTION(FS_reset_datanab); READ_FUNCTION(FS_Current); READ_FUNCTION(FS_r_status); WRITE_FUNCTION(FS_w_status); READ_FUNCTION(FS_r_Offset); WRITE_FUNCTION(FS_w_Offset); READ_FUNCTION(FS_r_counter); WRITE_FUNCTION(FS_w_counter); READ_FUNCTION(FS_MStype); READ_FUNCTION(FS_B1R1A_pressure); READ_FUNCTION(FS_r_B1R1A_offset); WRITE_FUNCTION(FS_w_B1R1A_offset); READ_FUNCTION(FS_r_B1R1A_gain); WRITE_FUNCTION(FS_w_B1R1A_gain); READ_FUNCTION(FS_S3R1A_current); READ_FUNCTION(FS_S3R1A_illuminance); READ_FUNCTION(FS_r_S3R1A_gain); WRITE_FUNCTION(FS_w_S3R1A_gain); static enum e_visibility VISIBLE_DATANAB( const struct parsedname * pn ) ; // src deserves some explanation: // 1 -- VDD (battery) measured // 0 -- VAD (other) measured enum voltage_source { voltage_source_VAD = 0, voltage_source_VDD = 1, } ; /* ------- Structures ----------- */ static struct aggregate A2437 = { 8, ag_numbers, ag_separate, }; static struct filetype DS2437[] = { F_STANDARD, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 8, &A2437, ft_binary, fc_stable, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"VDD", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:voltage_source_VAD}, }, {"VAD", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:voltage_source_VAD}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"IAD", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:0}, }, {"CA", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:1}, }, {"EE", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:2}, }, {"udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, {s:0x08}, }, {"date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"udate"}, }, {"disconnect", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"disconnect/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_counter, FS_w_counter, VISIBLE, {s:0x10}, }, {"disconnect/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"disconnect/udate"}, }, {"endcharge", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"endcharge/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_counter, FS_w_counter, VISIBLE, {s:0x14}, }, {"endcharge/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"endcharge/udate"}, }, }; DeviceEntryExtended(1E, DS2437, DEV_temp | DEV_volt, NO_GENERIC_READ, NO_GENERIC_WRITE); static struct aggregate A2438 = { 8, ag_numbers, ag_separate, }; static struct filetype DS2438[] = { F_STANDARD, {"pages", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"pages/page", 8, &A2438, ft_binary, fc_stable, FS_r_page, FS_w_page, VISIBLE, NO_FILETYPE_DATA, }, {"VDD", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:voltage_source_VDD}, }, {"VAD", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_volts, NO_WRITE_FUNCTION, VISIBLE, {i:voltage_source_VAD}, }, {"temperature", PROPERTY_LENGTH_TEMP, NON_AGGREGATE, ft_temperature, fc_simultaneous_temperature, FS_temp, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_Humid, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"vis", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"IAD", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:0}, }, {"CA", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:1}, }, {"EE", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, FS_r_status, FS_w_status, VISIBLE, {i:2}, }, {"offset", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_stable, FS_r_Offset, FS_w_Offset, VISIBLE, NO_FILETYPE_DATA, }, {"udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_second, FS_r_counter, FS_w_counter, VISIBLE, {s:0x08}, }, {"date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"udate"}, }, {"disconnect", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"disconnect/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_counter, FS_w_counter, VISIBLE, {s:0x10}, }, {"disconnect/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"disconnect/udate"}, }, {"endcharge", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"endcharge/udate", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, fc_volatile, FS_r_counter, FS_w_counter, VISIBLE, {s:0x14}, }, {"endcharge/date", PROPERTY_LENGTH_DATE, NON_AGGREGATE, ft_date, fc_link, COMMON_r_date, COMMON_w_date, VISIBLE, {a:"endcharge/udate"}, }, {"HTM1735", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"HTM1735/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_link, FS_Humid_1735, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"HIH3600", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"HIH3600/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Humid_3600, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"HIH4000", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"HIH4000/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Humid_4000, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"DATANAB", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE_DATANAB, NO_FILETYPE_DATA, }, {"DATANAB/humidity", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Humid_datanab, NO_WRITE_FUNCTION, VISIBLE_DATANAB, NO_FILETYPE_DATA, }, {"DATANAB/reset", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno, fc_stable, NO_READ_FUNCTION, FS_reset_datanab, VISIBLE_DATANAB, NO_FILETYPE_DATA, }, {"MultiSensor", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"MultiSensor/type", 12, NON_AGGREGATE, ft_vascii, fc_stable, FS_MStype, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"B1-R1-A", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"B1-R1-A/pressure", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_volatile, FS_B1R1A_pressure, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"B1-R1-A/offset", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_B1R1A_offset, FS_w_B1R1A_offset, VISIBLE, NO_FILETYPE_DATA, }, {"B1-R1-A/gain", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_pressure, fc_stable, FS_r_B1R1A_gain, FS_w_B1R1A_gain, VISIBLE, NO_FILETYPE_DATA, }, {"S3-R1-A", PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"S3-R1-A/current", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_S3R1A_current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"S3-R1-A/illuminance", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_S3R1A_illuminance, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA, }, {"S3-R1-A/gain", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_float, fc_stable, FS_r_S3R1A_gain, FS_w_S3R1A_gain, VISIBLE, NO_FILETYPE_DATA, }, }; DeviceEntryExtended(26, DS2438, DEV_temp | DEV_volt, NO_GENERIC_READ, NO_GENERIC_WRITE); #define _1W_WRITE_SCRATCHPAD 0x4E #define _1W_READ_SCRATCHPAD 0xBE #define _1W_COPY_SCRATCHPAD 0x48 #define _1W_RECALL_SCRATCHPAD 0xB8 #define _1W_CONVERT_T 0x44 #define _1W_CONVERT_V 0xB4 /* ------- Functions ------------ */ /* DS2438 */ static GOOD_OR_BAD OW_r_page(BYTE * p, const int page, const struct parsedname *pn); static GOOD_OR_BAD OW_w_page(const BYTE * p, const int page, const struct parsedname *pn); static GOOD_OR_BAD OW_temp(_FLOAT * T, int simul_good, const struct parsedname *pn); static GOOD_OR_BAD OW_volts(_FLOAT * V, enum voltage_source src, const struct parsedname *pn); static GOOD_OR_BAD OW_r_int(int *I, const UINT address, const struct parsedname *pn); static GOOD_OR_BAD OW_w_int(const int I, const UINT address, const struct parsedname *pn); static GOOD_OR_BAD OW_w_offset(const int I, const struct parsedname *pn); static GOOD_OR_BAD OW_r_uint(UINT *U, const UINT address, const struct parsedname *pn); static GOOD_OR_BAD OW_set_AD( enum voltage_source src, const struct parsedname *pn); /* 8 Byte pages */ #define DS2438_ADDRESS_TO_PAGE(a) ((a)>>3) #define DS2438_ADDRESS_TO_OFFSET(a) ((a)&0x07) /* Datanab data */ struct s_datanab { _FLOAT slope ; _FLOAT offset ; }; /* Internal files */ Make_SlaveSpecificTag(NAB, fc_persistent); /* finds the visibility for DATANAB */ static enum e_visibility VISIBLE_DATANAB( const struct parsedname * pn ) { int device_id = -1 ; LEVEL_DEBUG("Checking visibility of %s",SAFESTRING(pn->path)) ; if ( BAD( GetVisibilityCache( &device_id, pn ) ) ) { BYTE page3[8] ; if ( GOOD( OW_r_page( page3, 3, pn ) ) ) { if ( memcmp( page3, "HUMIDIT3", 8 ) == 0 ) { device_id = 1 ; // tag for datanab device } else { device_id = 0 ; // not a datanab } SetVisibilityCache( device_id, pn ) ; } } return device_id==1 ? visible_now : visible_not_now ; } /* 2438 A/D */ static ZERO_OR_ERROR FS_r_page(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); BYTE data[8]; RETURN_ERROR_IF_BAD( OW_r_page(data, pn->extension, pn) ) ; memcpy((BYTE *) OWQ_buffer(owq), &data[OWQ_offset(owq)], OWQ_size(owq)); return 0; } static ZERO_OR_ERROR FS_w_page(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); LEVEL_DEBUG("size=%d offset=%d", OWQ_size(owq), OWQ_offset(owq)); if (OWQ_size(owq) < 8) { /* partial page */ BYTE data[8]; RETURN_ERROR_IF_BAD( OW_r_page(data, pn->extension, pn) ); memcpy(&data[OWQ_offset(owq)], (BYTE *) OWQ_buffer(owq), OWQ_size(owq)); RETURN_ERROR_IF_BAD( OW_w_page(data, pn->extension, pn) ) ; } else { /* complete page */ RETURN_ERROR_IF_BAD( OW_w_page((BYTE *) OWQ_buffer(owq), pn->extension, pn) ) ; } return 0; } static ZERO_OR_ERROR FS_MStype(struct one_wire_query *owq) { BYTE data[8]; ASCII *t; // Read page 3 for type -- Michael Markstaller RETURN_ERROR_IF_BAD( OW_r_page(data, 3, PN(owq)) ); switch (data[0]) { case 0x00: t = "MS-T"; break; case 0x19: t = "MS-TH"; break; case 0x1A: t = "MS-TV"; break; case 0x1B: t = "MS-TL"; break; case 0x1C: t = "MS-TC"; break; case 0x1D: t = "MS-TW"; break; default: t = "unknown"; break; } return OWQ_format_output_offset_and_size_z(t, owq); } static ZERO_OR_ERROR FS_temp(struct one_wire_query *owq) { // Double try temperature, with and without simultaneous if ( GOOD( OW_temp(&OWQ_F(owq), OWQ_SIMUL_TEST(owq), PN(owq))) ) { return 0 ; } return GB_to_Z_OR_E( OW_temp(&OWQ_F(owq), 0, PN(owq)) ) ; } static ZERO_OR_ERROR FS_volts(struct one_wire_query *owq) { /* data=1 VDD data=0 VAD */ return GB_to_Z_OR_E( OW_volts(&OWQ_F(owq), OWQ_pn(owq).selected_filetype->data.i, PN(owq)) ); } static ZERO_OR_ERROR FS_Humid(struct one_wire_query *owq) { _FLOAT H = 0.; ZERO_OR_ERROR z_or_e ; if ( VISIBLE_DATANAB(PN(owq)) == visible_not_now ) { z_or_e = FS_r_sibling_F( &H, "HIH3600/humidity", owq ) ; } else { z_or_e = FS_r_sibling_F( &H, "DATANAB/humidity", owq ) ; } OWQ_F(owq) = H ; return z_or_e ; } static ZERO_OR_ERROR FS_Humid_3600(struct one_wire_query *owq) { _FLOAT T, VAD, VDD; _FLOAT humidity_uncompensated ; _FLOAT temperature_compensation ; if ( FS_r_sibling_F( &T, "temperature", owq ) != 0 || FS_r_sibling_F( &VAD, "VAD", owq ) != 0 || FS_r_sibling_F( &VDD, "VDD", owq ) != 0 ) { return -EINVAL ; } //*H = (VAD/VDD-.16)/(.0062*(1.0546-.00216*T)) ; /* From: Vincent Fleming To: owfs-developers@lists.sourceforge.net Date: Jun 7, 2006 8:53 PM Subject: [Owfs-developers] Error in Humidity calculation in ow_2438.c OK, this is a nit, but it will make owfs a little more accurate (admittedly, it’s not very significant difference)… The calculation given by Dallas for a DS2438/HIH-3610 combination is: Sensor_RH = (VAD/VDD) -0.16 / 0.0062 And Honeywell gives the following: VAD = VDD (0.0062(sensor_RH) + 0.16), but they specify that VDD = 5V dc, at 25 deg C. Which is exactly what we have in owfs code (solved for Humidity, of course). Honeywell’s documentation explains that the HIH-3600 series humidity sensors produce a liner voltage response to humidity that is in the range of 0.8 Vdc to 3.8 Vdc (typical) and is proportional to the input voltage. So, the error is, their listed calculations don’t correctly adjust for varying input voltage. The .16 constant is 1/5 of 0.8 – the minimum voltage produced. When adjusting for voltage (such as (VAD/VDD) portion), this constant should also be divided by the input voltage, not by 5 (the calibrated input voltage), as shown in their documentation. So, their documentation is a little wrong. The level of error this produces would be proportional to how far from 5 Vdc your input voltage is. In my case, I seem to have a constant 4.93 Vdc input, so it doesn’t have a great effect (about .25 degrees RH) */ if ( VDD < .01 ) { LEVEL_DEBUG("Low measured VDD %g",VDD); return -EINVAL ; } humidity_uncompensated = (VAD / VDD - (0.8 / VDD)) / .0062 ; temperature_compensation = 1.0546 - 0.00216 * T ; OWQ_F(owq) = humidity_uncompensated / temperature_compensation ; //printf( "%g,%g,%g,%g\n", VAD, VDD, T, OWQ_F(owq) ) ; return 0; } /* The HIH-4010 and HIH-4020 are newer versions of the HIH-4000 */ /* Used in the Hobbyboards humidity product */ /* Formula from Honeywell datasheet (2007) * http://sensing.honeywell.com/index.cfm/ci_id/142534/la_id/1/document/1/re_id/0 * * */ static ZERO_OR_ERROR FS_Humid_4000(struct one_wire_query *owq) { _FLOAT T, VAD, VDD; _FLOAT humidity_uncompensated ; _FLOAT temperature_compensation ; if ( FS_r_sibling_F( &T, "temperature", owq ) != 0 || FS_r_sibling_F( &VAD, "VAD", owq ) != 0 || FS_r_sibling_F( &VDD, "VDD", owq ) != 0 ) { return -EINVAL ; } if ( VDD < .01 ) { LEVEL_DEBUG("Low measured VDD %g",VDD); return -EINVAL ; } humidity_uncompensated = ((VAD/VDD) - 0.16) / 0.0062 ; // temperature compensation temperature_compensation = 1.0546 - 0.00216 * T ; OWQ_F(owq) = humidity_uncompensated / temperature_compensation ; return 0; } /* The Datanab verion of the HIH-4000 */ static ZERO_OR_ERROR FS_Humid_datanab(struct one_wire_query *owq) { _FLOAT T, vis, VAD; _FLOAT humidity_uncompensated ; _FLOAT temperature_adjust ; struct s_datanab nab ; struct parsedname * pn = PN(owq) ; if ( VISIBLE_DATANAB(pn) == visible_not_now ) { return -ENOTSUP ; } // make sure permanent cache has calibration values // this also serves as a check that device setup was done. if ( BAD( Cache_Get_SlaveSpecific((void *) &nab, sizeof(struct s_datanab), SlaveSpecificTag(NAB), pn) )) { // need to call device setup FS_w_sibling_Y( 1, "DATANAB/reset", owq ) ; if ( BAD( Cache_Get_SlaveSpecific((void *) &nab, sizeof(struct s_datanab), SlaveSpecificTag(NAB), pn) )) { return -EINVAL ; } } if ( FS_r_sibling_F( &T, "temperature", owq ) != 0 || FS_r_sibling_F( &VAD, "VAD", owq ) != 0 || FS_r_sibling_F( &vis, "vis", owq ) != 0 ) { return -EINVAL ; } // calculation straight from datasheet: http://www.datanab.com/docs/sensors/1WTH_PRB_commDetails.pdf humidity_uncompensated = ( (vis/VAD) * 85.65 - nab.offset ) / nab.slope ; temperature_adjust = 1.0546 - ( 0.00216 * T ) ; if ( temperature_adjust == 0. ) { temperature_adjust = 1. ; } OWQ_F(owq) = humidity_uncompensated / temperature_adjust ; return 0 ; } /* * Willy Robison's contribution * HTM1735 from Humirel (www.humirel.com) hooked up like everyone * else. The datasheet seems to suggest that the humidity * measurement isn't too sensitive to VCC (VCC=5.0V +/- 0.25V). * The conversion formula is derived directly from the datasheet * (page 2). VAD is assumed to be volts and *H is relative * humidity in percent. */ static ZERO_OR_ERROR FS_Humid_1735(struct one_wire_query *owq) { _FLOAT VAD = 0.; ZERO_OR_ERROR z_or_e = FS_r_sibling_F( &VAD, "VAD", owq ) ; OWQ_F(owq) = 38.92 * VAD - 41.98; return z_or_e ; } // Read current register // turn on (temporary) A/D in scratchpad static ZERO_OR_ERROR FS_Current(struct one_wire_query *owq) { BYTE data[9]; INT iad ; if ( FS_r_sibling_Y( &iad, "IAD", owq ) != 0 ) { return -EINVAL ; } // Actual units are volts-- need to know sense resistor for current RETURN_ERROR_IF_BAD( OW_r_page(data, 0, PN(owq)) ) ; LEVEL_DEBUG("DS2438 vis scratchpad " SNformat, SNvar(data)); //F[0] = .0002441 * (_FLOAT) ((((int) data[6]) << 8) | data[5]); OWQ_F(owq) = .0002441 * UT_int16(&data[5]); return 0 ; } // Set the DataNAB humidity -- sets the vis converting and reads the constants static ZERO_OR_ERROR FS_reset_datanab( struct one_wire_query * owq ) { if ( OWQ_Y(owq) == 1 ) { struct parsedname * pn = PN(owq) ; BYTE page6[8] ; struct s_datanab nab = { .slope = 0.031, .offset = 0.8 , } ; // default values FS_w_sibling_U( 0, "offset", owq ) ; // set current offset to 0 FS_w_sibling_Y( 1, "IAD", owq ) ; // turn on current sensor UT_delay(28) ; // wait 28 msec for 1st conversion // read slope and offset data stored in page 6 -- with some checks if ( GOOD( OW_r_page( page6, 6, pn ) ) && page6[0]==0xAA && page6[1]==0xAA ) { _FLOAT offset, slope ; slope = ( 256. * page6[4] + page6[5] ) / 100000. ; offset = ( 256. * page6[2] + page6[3] ) / 10000. ; if ( slope != 0. ) { nab.slope = slope ; nab.offset = offset ; } } // store slope and offset in permanent cache Cache_Add_SlaveSpecific((const void *) &nab, sizeof(struct s_datanab), SlaveSpecificTag(NAB), pn ) ; } return 0 ; } // status bit static ZERO_OR_ERROR FS_r_status(struct one_wire_query *owq) { BYTE page0[8]; RETURN_ERROR_IF_BAD( OW_r_page(page0, 0, PN(owq)) ); OWQ_Y(owq) = UT_getbit(page0, PN(owq)->selected_filetype->data.i); return 0; } static ZERO_OR_ERROR FS_w_status(struct one_wire_query *owq) { BYTE page0[8]; RETURN_ERROR_IF_BAD( OW_r_page(page0, 0, PN(owq)) ); UT_setbit(page0, PN(owq)->selected_filetype->data.i, OWQ_Y(owq)); RETURN_ERROR_IF_BAD( OW_w_page(page0, 0, PN(owq)) ) ; return 0; } static ZERO_OR_ERROR FS_r_Offset(struct one_wire_query *owq) { RETURN_ERROR_IF_BAD( OW_r_int(&OWQ_I(owq), 0x0D, PN(owq)) ) ; OWQ_I(owq) >>= 3; return 0; } static ZERO_OR_ERROR FS_w_Offset(struct one_wire_query *owq) { struct parsedname * pn = PN(owq) ; int IAD_status ; int I = OWQ_I(owq); ZERO_OR_ERROR z_or_e ; if (I > 255 || I < -256) { return -EINVAL; } if ( BAD(FS_r_sibling_Y( &IAD_status, "IAD", owq )) ) { return -EINVAL ; } if ( IAD_status == 1 ) { // need to turn off if ( BAD(FS_w_sibling_Y( 0, "IAD", owq )) ) { return -EINVAL ; } } z_or_e = OW_w_offset(I << 3, pn) ; Cache_Del_Internal(SlaveSpecificTag(NAB), pn) ; if ( IAD_status == 1 ) { // need to turn back on if ( BAD(FS_w_sibling_Y( 1, "IAD", owq )) ) { return -EINVAL ; } } return z_or_e ; } /* set clock */ static ZERO_OR_ERROR FS_w_counter(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int page = DS2438_ADDRESS_TO_PAGE(pn->selected_filetype->data.s) ; int offset = DS2438_ADDRESS_TO_OFFSET(pn->selected_filetype->data.s); BYTE data[8]; RETURN_ERROR_IF_BAD( OW_r_page(data, page, pn) ) ; UT_uint32_to_bytes( OWQ_U(owq), &data[offset] ); return GB_to_Z_OR_E( OW_w_page(data, page, pn) ) ; } /* read clock */ static ZERO_OR_ERROR FS_r_counter(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int page = DS2438_ADDRESS_TO_PAGE(pn->selected_filetype->data.s); int offset = DS2438_ADDRESS_TO_OFFSET(pn->selected_filetype->data.s); BYTE data[8]; RETURN_ERROR_IF_BAD(OW_r_page(data, page, pn)) ; OWQ_U(owq) = UT_int32(&data[offset]); return 0; } /* * Egil Kvaleberg's contribution * The B1-R1-A barometer from Hobby-Boards has a * temperature compensated MPXA4115A absolute * pressure sensor from Freescale wired to VAD via an INA126 * instrumentation amp with 10x gain and offset adjusted * by a trimmer. The sensor sensitivity is specified as 46 mV/kPa, * which is 21.737 mbar/V. * The default offset is based on the standard calibration where * 2V is 948.2 mbar (28inHg) at sea level, which translates to * 904.7 mbar for 0V */ static ZERO_OR_ERROR FS_B1R1A_pressure(struct one_wire_query *owq) { _FLOAT VAD; _FLOAT gain; _FLOAT offset; _FLOAT mbar; if ( FS_r_sibling_F( &VAD, "VAD", owq ) || FS_r_sibling_F( &gain, "B1-R1-A/gain", owq ) || FS_r_sibling_F( &offset, "B1-R1-A/offset", owq ) ) { return -EINVAL ; } mbar = VAD * gain + offset; LEVEL_DEBUG("B1-R1-A Raw (mbar) = %g gain = %g ofs = %g", mbar, gain, offset); OWQ_F(owq) = mbar; return 0; } static ZERO_OR_ERROR FS_r_B1R1A_offset(struct one_wire_query *owq) { int i = 0; /* Read page 3 byte 6&7 for barometer offset -- Egil Kvaleberg */ RETURN_ERROR_IF_BAD( OW_r_int(&i, (3 << 3) + 6, PN(owq)) ) ; /* Offset in units of 1/20 millibars, default to 948.2 */ if (i == 0) { OWQ_F(owq) = 904.7; } else { OWQ_F(owq) = i / 20.0; } return 0; } static ZERO_OR_ERROR FS_w_B1R1A_offset(struct one_wire_query *owq) { _FLOAT offset = OWQ_F(owq); int i; if (offset < -0x7fff / 20.0 || offset > 0x7fff / 20.0) { return -EINVAL; } /* Offset in units of 1/20 millibars */ i = round(offset * 20.0); /* Write page 3 byte 6&7 for B1-R1-A offset -- Egil Kvaleberg */ return GB_to_Z_OR_E(OW_w_int(i, (3 << 3) + 6, PN(owq))) ; } static ZERO_OR_ERROR FS_r_B1R1A_gain(struct one_wire_query *owq) { int i = 0; /* Read page 3 byte 4&5 for barometer gain -- Egil Kvaleberg */ RETURN_ERROR_IF_BAD( OW_r_uint( (UINT*) &i, (3 << 3) + 4, PN(owq)) ) ; /* Gain in units of 1/1000 millibars/volt, default is 21.739 */ if (i == 0) { OWQ_F(owq) = 1000.0 / 46.0; } else { OWQ_F(owq) = i / 1000.0; } return 0; } static ZERO_OR_ERROR FS_w_B1R1A_gain(struct one_wire_query *owq) { _FLOAT gain = OWQ_F(owq); int i; if (gain < -0x7fff / 1000.0 || gain > 0x7fff / 1000.0) { return -EINVAL; } /* Gain in units of 1/1000 millibars/volt */ i = round(gain * 1000.0); /* Write page 3 byte 4&5 for B1-R1-A gain -- Egil Kvaleberg */ return GB_to_Z_OR_E(OW_w_int(i, (3 << 3) + 4, PN(owq))) ; } /* * Egil Kvaleberg's contribution * The S3-R1-A solar radiation sensor from Hobby-Boards has a * photodiode where the leakage current is read by the current * sensor over a 390 ohm resistor. The reading is in microamps. * The board is currently delivered with a SFH203P diode from Osram. * The current at 1000 lx is specified as 9.5 uA, the dark current * 0.001 uA. * Also, the actual mounting conditions will need to be * compensated for, such as any integrating sphere and so on. * Previously, the Clairex CLD140 was used, which is more sensitive. */ static ZERO_OR_ERROR FS_S3R1A_current(struct one_wire_query *owq) { _FLOAT vis; if ( FS_r_sibling_F( &vis, "vis", owq ) ) { return -EINVAL ; } /* * A negative current reading can happen, and * would be due to offset errors or noise. */ OWQ_F(owq) = vis * (1000000.0 / 390.0); return 0; } static ZERO_OR_ERROR FS_S3R1A_illuminance(struct one_wire_query *owq) { _FLOAT current; _FLOAT gain; _FLOAT illuminance; if ( FS_r_sibling_F( ¤t, "S3-R1-A/current", owq ) || FS_r_sibling_F( &gain, "S3-R1-A/gain", owq ) ) { return -EINVAL ; } /* * Negative current readings are eliminated to ensure positive * illuminance values. We * ensure they are non-zero to make it easier to deal with any * logaritms that may be applied. * Note that the chip used really is very crude: it has * a resolution of 0.24mV, corresponding to a dark current * resolution of 0.63 uA, corresponding to about 60 lx. * We use 1 lx as a representation of zero. */ illuminance = current * gain; if (illuminance < 1.0) illuminance = 1.0; OWQ_F(owq) = illuminance; return 0; } static ZERO_OR_ERROR FS_r_S3R1A_gain(struct one_wire_query *owq) { unsigned u = 0; /* Read page 3 byte 2&3 for illuminance gain -- Egil Kvaleberg */ RETURN_BAD_IF_BAD( OW_r_uint(&u, (3 << 3) + 2, PN(owq)) ) ; if (u == 0) { /* Default gain assumes SFH203P diode */ OWQ_F(owq) = 1000.0 / 9.5; } else { /* Gain stored in units of 1/10 lx/uA */ OWQ_F(owq) = u / 10.0; } return 0; } static ZERO_OR_ERROR FS_w_S3R1A_gain(struct one_wire_query *owq) { _FLOAT gain = OWQ_F(owq); unsigned u; if (gain < 0.0 || gain > 6553.5) { return -EINVAL; } /* Gain in units of 1/10 lx/uA */ u = round(gain * 10.0); /* Write page 3 byte 2&3 for illuminance gain -- Egil Kvaleberg */ return GB_to_Z_OR_E(OW_w_int(u, (3 << 3) + 2, PN(owq))) ; } /* DS2438 read page (8 bytes) */ /* p is 8 bytes long */ static GOOD_OR_BAD OW_r_page(BYTE * p, const int page, const struct parsedname *pn) { BYTE data[9]; BYTE recall[] = { _1W_RECALL_SCRATCHPAD, page, }; BYTE r[] = { _1W_READ_SCRATCHPAD, page, }; struct transaction_log t[] = { TRXN_START, TRXN_WRITE2(recall), TRXN_START, TRXN_WRITE2(r), TRXN_READ(data, 9), TRXN_CRC8(data, 9), TRXN_END, }; // read to scratch, then in RETURN_BAD_IF_BAD(BUS_transaction(t, pn)) ; // copy to buffer memcpy(p, data, 8); return gbGOOD; } /* write 8 bytes */ /* p is 8 bytes long */ static GOOD_OR_BAD OW_w_page(const BYTE * p, const int page, const struct parsedname *pn) { BYTE data[9]; BYTE w[] = { _1W_WRITE_SCRATCHPAD, page, }; BYTE r[] = { _1W_READ_SCRATCHPAD, page, }; BYTE eeprom[] = { _1W_COPY_SCRATCHPAD, page, }; struct transaction_log t[] = { TRXN_START, // 0 TRXN_WRITE2(w), TRXN_WRITE(p, 8), TRXN_START, TRXN_WRITE2(r), TRXN_READ(data, 9), TRXN_CRC8(data, 9), TRXN_START, TRXN_WRITE2(eeprom), TRXN_DELAY(10), // 10 msec TRXN_END, }; return BUS_transaction(t, pn) ; } static GOOD_OR_BAD OW_temp(_FLOAT * T, int simul_good, const struct parsedname *pn) { BYTE data[9]; UINT delay = 10 ; static BYTE t[] = { _1W_CONVERT_T, }; struct transaction_log tconvert[] = { TRXN_START, TRXN_WRITE1(t), TRXN_DELAY(delay), TRXN_END, }; // write conversion command if ( simul_good ) { RETURN_BAD_IF_BAD( FS_Test_Simultaneous( simul_temp, delay, pn) ) ; } else { RETURN_BAD_IF_BAD(BUS_transaction(tconvert, pn)) ; } // read back registers RETURN_BAD_IF_BAD(OW_r_page(data, 0, pn)) ; //*T = ((int)((signed char)data[2])) + .00390625*data[1] ; T[0] = UT_int16(&data[1]) / 256.0; return gbGOOD; } static GOOD_OR_BAD OW_set_AD( enum voltage_source src, const struct parsedname *pn) { // src deserves some explanation: // 1 -- VDD (battery) measured // 0 -- VAD (other) measured BYTE data[1]; BYTE r[] = { _1W_READ_SCRATCHPAD, 0, }; // page 0 struct transaction_log tread[] = { TRXN_START, TRXN_WRITE2(r), TRXN_READ(data, 1), TRXN_END, }; BYTE w[] = { _1W_WRITE_SCRATCHPAD, 0, }; // page 0 struct transaction_log twrite[] = { TRXN_START, // 0 TRXN_WRITE2(w), TRXN_WRITE(data, 1), TRXN_END, }; // read to scratch, then in RETURN_BAD_IF_BAD(BUS_transaction(tread, pn)) ; if ( UT_getbit( data, 3 ) == (BYTE) src ) { // correct setting already. Leave there return gbGOOD ; } UT_setbit( data, 3, (BYTE) src ) ; return BUS_transaction(twrite, pn) ; } static GOOD_OR_BAD OW_volts(_FLOAT * V, enum voltage_source src, const struct parsedname *pn) { // src deserves some explanation: // 1 -- VDD (battery) measured // 0 -- VAD (other) measured BYTE data[9]; static BYTE v[] = { _1W_CONVERT_V, }; struct transaction_log tconvert[] = { TRXN_START, TRXN_WRITE1(v), TRXN_DELAY(10), // 10 ms TRXN_END, }; // set voltage source command RETURN_BAD_IF_BAD( OW_set_AD( src, pn ) ); // write conversion command RETURN_BAD_IF_BAD(BUS_transaction(tconvert, pn)) ; // read back registers RETURN_BAD_IF_BAD(OW_r_page(data, 0, pn)); V[0] = .01 * (_FLOAT) UT_int16(&data[3]); return gbGOOD; } static GOOD_OR_BAD OW_w_offset(const int I, const struct parsedname *pn) { BYTE data[8]; int current_conversion_enabled; // set current readings off source command RETURN_BAD_IF_BAD(OW_r_page(data, 0, pn)); current_conversion_enabled = UT_getbit(data, 0); if (current_conversion_enabled) { UT_setbit(data, 0, 0); // AD bit in status register RETURN_BAD_IF_BAD(OW_w_page(data, 0, pn)); } // read back registers RETURN_BAD_IF_BAD(OW_w_int(I, 0x0D, pn)); if (current_conversion_enabled) { // if ( OW_r_page( data , 0 , pn ) ) return 1 ; /* Assume no change to these fields */ UT_setbit(data, 0, 1); // AD bit in status register RETURN_BAD_IF_BAD(OW_w_page(data, 0, pn)); } return gbGOOD; } static GOOD_OR_BAD OW_r_int(int *I, const UINT address, const struct parsedname *pn) { BYTE data[8]; // read back registers RETURN_BAD_IF_BAD(OW_r_page(data, DS2438_ADDRESS_TO_PAGE(address), pn)); *I = (int) UT_int16(&data[DS2438_ADDRESS_TO_OFFSET(address)]); return gbGOOD; } static GOOD_OR_BAD OW_w_int(const int I, const UINT address, const struct parsedname *pn) { BYTE data[8]; // write 16bit int RETURN_BAD_IF_BAD(OW_r_page(data, DS2438_ADDRESS_TO_PAGE(address), pn)) ; data[DS2438_ADDRESS_TO_OFFSET(address)] = BYTE_MASK(I); data[DS2438_ADDRESS_TO_OFFSET(address+1) & 0x07] = BYTE_MASK(I >> 8); return OW_w_page(data, DS2438_ADDRESS_TO_PAGE(address), pn); } static GOOD_OR_BAD OW_r_uint(UINT *U, const UINT address, const struct parsedname *pn) { BYTE data[8]; // read back registers RETURN_BAD_IF_BAD( OW_r_page(data, address >> 3, pn) ) ; *U = ((UINT) (data[(address + 1) & 0x07])) << 8 | data[address & 0x07]; return gbGOOD; } owfs-2.8p15/module/owlib/src/c/ow_browse_resolve.c0000644000175000017500000000721111666514504017144 00000000000000/* $Id: ow_browse_resolve.c,v 1.16 2011/12/03 21:48:52 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" static struct connection_in * CreateZeroIn(const char * name, const char * type, const char * domain, const char * host, const char * service ); static struct connection_out *FindOut(const char * name, const char * type, const char * domain); static GOOD_OR_BAD Zero_nomatch(struct connection_in * trial,struct connection_in * existing); static GOOD_OR_BAD string_null_or_match( const char * one, const char * two ); void ZeroAdd(const char * name, const char * type, const char * domain, const char * host, const char * service) { struct connection_in * in ; // Don't add yourself if ( FindOut(name,type,domain) != NULL ) { LEVEL_DEBUG( "Attempt to add ourselves -- ignored" ) ; return ; } in = CreateZeroIn( name, type, domain, host, service ) ; if ( BAD( Zero_detect(in)) ) { LEVEL_DEBUG("Failed to create new %s", SOC(in)->devicename ) ; RemoveIn(in) ; } else { Add_InFlight( Zero_nomatch, in ) ; } } void ZeroDel(const char * name, const char * type, const char * domain ) { struct connection_in * in = CreateZeroIn( name, type, domain, "", "" ) ; if ( in != NO_CONNECTION ) { SAFEFREE(SOC(in)->devicename) ; SOC(in)->devicename = owstrdup(name) ; Del_InFlight( Zero_nomatch, in ) ; } } static struct connection_in * CreateZeroIn(const char * name, const char * type, const char * domain, const char * host, const char * service ) { char addr_name[128] ; struct connection_in * in = AllocIn(NO_CONNECTION); if ( in == NO_CONNECTION ) { LEVEL_DEBUG( "Cannot allocate position for a new Bus Master %s (%s:%s) -- ignored",name,host,service) ; return NO_CONNECTION ; } UCLIBCLOCK; snprintf(addr_name,127,"%s:%s",host,service) ; UCLIBCUNLOCK; SOC(in)->devicename = owstrdup(addr_name) ; SOC(in)->type = ct_tcp ; in->master.tcp.name = owstrdup( name ) ; in->master.tcp.type = owstrdup( type ) ; in->master.tcp.domain = owstrdup( domain) ; return in ; } // GOOD means no match static GOOD_OR_BAD Zero_nomatch(struct connection_in * trial,struct connection_in * existing) { if ( existing->busmode != bus_zero ) { return gbGOOD ; } if ( BAD( string_null_or_match( trial->master.tcp.name , existing->master.tcp.name )) ) { return gbGOOD ; } if ( BAD( string_null_or_match( trial->master.tcp.type , existing->master.tcp.type )) ) { return gbGOOD ; } if ( BAD( string_null_or_match( trial->master.tcp.domain , existing->master.tcp.domain )) ) { return gbGOOD ; } return gbBAD ; } // Finds matching connection in OUTBOUND list (so you don't match yourself) // returns it if found, // else NULL static struct connection_out *FindOut(const char * name, const char * type, const char * domain) { struct connection_out *now ; for ( now = Outbound_Control.head ; now != NULL ; now = now->next ) { if ( BAD( string_null_or_match( name , now->zero.name )) ) { continue ; } if ( BAD( string_null_or_match( type , now->zero.type )) ) { continue ; } if ( BAD( string_null_or_match( domain , now->zero.domain )) ) { continue ; } return now ; } return NULL; } static GOOD_OR_BAD string_null_or_match( const char * one, const char * two ) { if ( one == NULL ) { return (two==NULL) ? gbGOOD : gbBAD ; } if ( two == NULL ) { return gbBAD ; } return ( strcasecmp(one,two) == 0 ) ? gbGOOD : gbBAD ; } owfs-2.8p15/module/owlib/src/c/ow_presence.c0000664000175000017500000001716111733747173015724 00000000000000/* $Id: ow_presence.c,v 1.53 2011/09/07 00:44:12 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow_standard.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ------------ */ static INDEX_OR_ERROR CheckPresence_low(struct parsedname *pn); static INDEX_OR_ERROR CheckThisConnection(int bus_nr, struct parsedname *pn) ; static GOOD_OR_BAD PresenceFromDirblob( struct parsedname * pn ) ; /* ------- Functions ------------ */ /* Check if device exists -- >=0 yes, -1 no */ INDEX_OR_ERROR CheckPresence(struct parsedname *pn) { INDEX_OR_ERROR bus_nr; if (NotRealDir(pn)) { return INDEX_DEFAULT; } if ((pn->selected_device == DeviceSimultaneous) || (pn->selected_device == DeviceThermostat)) { return INDEX_DEFAULT; } /* If set, already found bus. */ /* Use UnsetKnownBus to clear and allow a new search */ if (KnownBus(pn)) { return pn->known_bus->index; } if ( GOOD( Cache_Get_Device(&bus_nr, pn)) ) { LEVEL_DEBUG("Found device on bus %d",bus_nr); SetKnownBus(bus_nr, pn); return bus_nr; } LEVEL_DETAIL("Checking presence of %s", SAFESTRING(pn->path)); bus_nr = CheckPresence_low(pn); // check only allocated inbound connections if ( INDEX_VALID(bus_nr) ) { SetKnownBus(bus_nr, pn); Cache_Add_Device( bus_nr, pn->sn ) ; return bus_nr; } UnsetKnownBus(pn); return INDEX_BAD; } /* See if a cached location is accurate -- called with "Known Bus" set */ INDEX_OR_ERROR ReCheckPresence(struct parsedname *pn) { INDEX_OR_ERROR bus_nr; if (NotRealDir(pn)) { return INDEX_DEFAULT; } if ((pn->selected_device == DeviceSimultaneous) || (pn->selected_device == DeviceThermostat)) { return INDEX_DEFAULT; } if (KnownBus(pn)) { if ( INDEX_VALID( CheckThisConnection(pn->known_bus->index,pn) ) ) { return pn->known_bus->index ; } } if ( GOOD( Cache_Get_Device(&bus_nr, pn)) ) { LEVEL_DEBUG("Found device on bus %d",bus_nr); if ( INDEX_VALID( CheckThisConnection(bus_nr,pn) ) ) { SetKnownBus(bus_nr, pn); return bus_nr ; } } UnsetKnownBus(pn); Cache_Del_Device(pn) ; return CheckPresence(pn); } /* Check if device exists -- -1 no, >=0 yes (bus number) */ /* lower level, cycle through the devices */ #if OW_MT struct checkpresence_struct { struct connection_in *in; struct parsedname *pn; INDEX_OR_ERROR bus_nr; }; static void * CheckPresence_callback(void * v) { pthread_t thread; int threadbad ; struct checkpresence_struct * cps = (struct checkpresence_struct *) v ; struct checkpresence_struct next_cps = { cps->in->next, cps->pn, INDEX_BAD }; threadbad = (next_cps.in == NO_CONNECTION) || (pthread_create(&thread, DEFAULT_THREAD_ATTR, CheckPresence_callback, (void *) (&next_cps)) != 0) ; cps->bus_nr = CheckThisConnection( cps->in->index, cps->pn ) ; if (threadbad == 0) { /* was a thread created? */ if (pthread_join(thread, NULL)==0) { if ( INDEX_VALID(next_cps.bus_nr) ) { cps->bus_nr = next_cps.bus_nr ; } } } return VOID_RETURN ; } static INDEX_OR_ERROR CheckPresence_low(struct parsedname *pn) { struct checkpresence_struct cps = { Inbound_Control.head , pn, INDEX_BAD }; if ( cps.in != NO_CONNECTION ) { CheckPresence_callback( (void *) (&cps) ) ; } return cps.bus_nr; } #else /* OW_MT */ static INDEX_OR_ERROR CheckPresence_low(struct parsedname *pn) { struct connection_in * in ; for ( in=Inbound_Control.head ; in ; in=in->next ) { int bus_nr = CheckThisConnection( in->index, pn ) ; if ( INDEX_VALID(bus_nr) ) { return bus_nr ; } } return INDEX_BAD; // no success } #endif /* OW_MT */ ZERO_OR_ERROR FS_present(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); if (NotRealDir(pn) || pn->selected_device == DeviceSimultaneous || pn->selected_device == DeviceThermostat) { OWQ_Y(owq) = 1; } else if ( pn->selected_connection->iroutines.flags & ADAP_FLAG_presence_from_dirblob ) { OWQ_Y(owq) = GOOD( PresenceFromDirblob(pn) ) ; } else if ( pn->selected_connection->iroutines.flags & ADAP_FLAG_sham ) { OWQ_Y(owq) = 0 ; } else { struct transaction_log t[] = { TRXN_NVERIFY, TRXN_END, }; OWQ_Y(owq) = BAD(BUS_transaction(t, pn)) ? 0 : 1; } return 0; } // Look on a given connection for the device static INDEX_OR_ERROR CheckThisConnection(int bus_nr, struct parsedname *pn) { struct parsedname s_pn_copy; struct parsedname * pn_copy = &s_pn_copy ; struct connection_in * in = find_connection_in(bus_nr) ; INDEX_OR_ERROR connection_result = INDEX_BAD ; if ( in == NO_CONNECTION ) { return INDEX_BAD ; } memcpy(pn_copy, pn, sizeof(struct parsedname)); // shallow copy pn_copy->selected_connection = in; if ( BAD( TestConnection(pn_copy) ) ) { // Connection currently disconnected return INDEX_BAD; } else if (BusIsServer(in)) { // Server if ( INDEX_VALID( ServerPresence(pn_copy) ) ) { connection_result = in->index; } } else if ( in->iroutines.flags & ADAP_FLAG_sham ) { return INDEX_BAD ; } else if ( in->iroutines.flags & ADAP_FLAG_presence_from_dirblob ) { // local connection with a dirblob (like fake, mock, ...) if ( GOOD( PresenceFromDirblob( pn_copy ) ) ) { connection_result = in->index ; } } else { // local connection but need to ask directly struct transaction_log t[] = { TRXN_NVERIFY, TRXN_END, }; if ( GOOD( BUS_transaction(t, pn_copy) ) ) { connection_result = in->index ; } } if ( connection_result == INDEX_BAD ) { LEVEL_DEBUG("Presence of "SNformat" NOT found on bus %s",SNvar(pn_copy->sn),SAFESTRING(SOC(in)->devicename)) ; } else { LEVEL_DEBUG("Presence of "SNformat" FOUND on bus %s",SNvar(pn_copy->sn),SAFESTRING(SOC(in)->devicename)) ; Cache_Add_Device(in->index,pn_copy->sn) ; // add or update cache */ } return connection_result ; } static GOOD_OR_BAD PresenceFromDirblob( struct parsedname * pn ) { struct dirblob db; // cached dirblob if ( GOOD( Cache_Get_Dir( &db , pn ) ) ) { // Use the dirblob from the cache GOOD_OR_BAD ret = ( DirblobSearch(pn->sn, &db ) >= 0 ) ? gbGOOD : gbBAD ; DirblobClear( &db ) ; return ret ; } else { // look through actual directory struct device_search ds ; enum search_status nextboth = BUS_first( &ds, pn ) ; while ( nextboth == search_good ) { if ( memcmp( ds.sn, pn->sn, SERIAL_NUMBER_SIZE ) == 0 ) { // found it. Early exit. BUS_next_cleanup( &ds ); return gbGOOD ; } // Not found. Clean up done by BUS_next in this case nextboth = BUS_next( &ds, pn ) ; } return gbBAD ; } } owfs-2.8p15/module/owlib/src/c/ow_testerread.c0000664000175000017500000001126011444574647016257 00000000000000/* $Id: ow_testerread.c,v 1.21 2010/09/17 05:16:23 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor $ID: $ */ #include #include "owfs_config.h" #include "ow.h" #include "ow_counters.h" #include "ow_connection.h" /* ------- Prototypes ----------- */ static ZERO_OR_ERROR FS_read_tester_single(struct one_wire_query *owq); static ZERO_OR_ERROR FS_read_tester_array(struct one_wire_query *owq); /* ---------------------------------------------- */ /* Filesystem callback functions */ /* ---------------------------------------------- */ ZERO_OR_ERROR FS_read_tester(struct one_wire_query *owq) { switch (OWQ_pn(owq).extension) { case EXTENSION_ALL: /* array */ if (OWQ_offset(owq)) { return 0; } if (OWQ_size(owq) < FullFileLength(PN(owq))) { return -ERANGE; } return FS_read_tester_array(owq); case EXTENSION_BYTE: /* bitfield */ default: return FS_read_tester_single(owq); } } static ZERO_OR_ERROR FS_read_tester_single(struct one_wire_query *owq) { struct parsedname *pn = PN(owq); int tester_bus = (pn->sn[2] << 8) + pn->sn[1]; int device = (pn->sn[6] << 8) + pn->sn[5]; int family_code = pn->sn[0]; int calculated_value = family_code + tester_bus + device + pn->extension; switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: OWQ_I(owq) = calculated_value; break; case ft_yesno: OWQ_Y(owq) = calculated_value & 0x1; break; case ft_bitfield: if (OWQ_pn(owq).extension == EXTENSION_BYTE) { OWQ_U(owq) = calculated_value; } else { OWQ_Y(owq) = calculated_value & 0x1; } break; case ft_unsigned: OWQ_U(owq) = calculated_value; break; case ft_pressure: case ft_temperature: case ft_tempgap: case ft_float: OWQ_F(owq) = (_FLOAT) calculated_value *0.1;; break; case ft_date: OWQ_D(owq) = 1174622400; break; case ft_alias: case ft_vascii: case ft_ascii: { ASCII address[16]; size_t length_left = OWQ_size(owq); size_t buffer_index; size_t length = FileLength(PN(owq)); ASCII return_chars[length]; bytes2string(address, pn->sn, SERIAL_NUMBER_SIZE); OWQ_length(owq) = OWQ_size(owq); for (buffer_index = 0; buffer_index < length; buffer_index += sizeof(address)) { size_t copy_length = length_left; if (copy_length > sizeof(address)) { copy_length = sizeof(address); } memcpy(&return_chars[buffer_index], address, copy_length); length_left -= copy_length; } return OWQ_format_output_offset_and_size(return_chars, length, owq); } case ft_binary: { size_t length_left = OWQ_size(owq); size_t buffer_index; size_t length = FileLength(PN(owq)); ASCII return_chars[length]; OWQ_length(owq) = OWQ_size(owq); for (buffer_index = 0; buffer_index < length; buffer_index += SERIAL_NUMBER_SIZE) { size_t copy_length = length_left; if (copy_length > SERIAL_NUMBER_SIZE) { copy_length = SERIAL_NUMBER_SIZE; } memcpy(&return_chars[buffer_index], pn->sn, copy_length); length_left -= copy_length; } return OWQ_format_output_offset_and_size(return_chars, length, owq); } case ft_directory: case ft_subdir: case ft_unknown: return -ENOENT; } return 0; // put data as string into buffer and return length } /* Read each array element independently, but return as one long string */ /* called when pn->extension==EXTENSION_ALL and pn->selected_filetype->ag->combined==ag_separate */ static ZERO_OR_ERROR FS_read_tester_array(struct one_wire_query *owq) { size_t elements = OWQ_pn(owq).selected_filetype->ag->elements; size_t extension; size_t entry_length = FileLength(PN(owq)); for (extension = 0; extension < elements; ++extension) { struct one_wire_query * owq_single = OWQ_create_separate( extension, owq ) ; if ( owq_single == NO_ONE_WIRE_QUERY ) { return -ENOMEM ; } switch (OWQ_pn(owq).selected_filetype->format) { case ft_integer: case ft_yesno: case ft_bitfield: case ft_unsigned: case ft_pressure: case ft_temperature: case ft_tempgap: case ft_float: case ft_date: break; case ft_vascii: case ft_alias: case ft_ascii: case ft_binary: OWQ_assign_read_buffer(&OWQ_buffer(owq)[extension * entry_length],entry_length,0,owq_single) ; break; case ft_directory: case ft_subdir: case ft_unknown: OWQ_destroy(owq_single) ; return -ENOENT; } if (FS_read_tester_single(owq_single)) { OWQ_destroy(owq_single) ; return -EINVAL; } memcpy(&OWQ_array(owq)[extension], &OWQ_val(owq_single), sizeof(union value_object)); OWQ_destroy(owq_single) ; } return 0; } owfs-2.8p15/module/owlib/src/c/ow_visibility.c0000664000175000017500000000463011614317020016262 00000000000000/* $Id: ow_visibility.c,v 1.11 2011/07/28 17:36:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* General Device File format: This device file corresponds to a specific 1wire/iButton chip type ( or a closely related family of chips ) The connection to the larger program is through the "device" data structure, which must be declared in the acompanying header file. The device structure holds the family code, name, device type (chip, interface or pseudo) number of properties, list of property structures, called "filetype". Each filetype structure holds the name, estimated length (in bytes), aggregate structure pointer, data format, read function, write funtion, generic data pointer The aggregate structure, is present for properties that several members (e.g. pages of memory or entries in a temperature log. It holds: number of elements whether the members are lettered or numbered whether the elements are stored together and split, or separately and joined */ #include #include "owfs_config.h" #include "ow.h" /* ------- Prototypes ------------ */ enum e_visibility AlwaysVisible( const struct parsedname * pn ) { (void) pn ; return visible_always ; } enum e_visibility NeverVisible( const struct parsedname * pn ) { (void) pn ; return visible_never ; } /* Internal files */ Make_SlaveSpecificTag(VIS, fc_persistent); // used for all visibility work GOOD_OR_BAD GetVisibilityCache( int * visibility_parameter, const struct parsedname * pn ) { return Cache_Get_SlaveSpecific( visibility_parameter, sizeof(int), SlaveSpecificTag(VIS), pn) ; } void SetVisibilityCache( int visibility_parameter, const struct parsedname * pn ) { Cache_Add_SlaveSpecific( &visibility_parameter, sizeof(int), SlaveSpecificTag(VIS), pn) ; } enum e_visibility FS_visible( const struct parsedname * pn ) { struct filetype * ft = pn->selected_filetype ; if ( ft != NO_FILETYPE ) { // filetype exists return ft->visible(pn) ; } ft = pn->subdir ; if ( ft != NO_SUBDIR ) { // this is a subdir return ft->visible(pn) ; } // default is to show return visible_always ; } owfs-2.8p15/module/owlib/src/c/ow_com_open.c0000644000175000017500000000335211707143413015676 00000000000000/* $Id: ow_com_open.c,v 1.9 2012/01/23 02:33:47 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #include "ow.h" #include "ow_connection.h" #include "ow_w1.h" #ifdef HAVE_LINUX_LIMITS_H #include #endif /* ---------------------------------------------- */ /* raw COM port interface routines */ /* ---------------------------------------------- */ //open a port (serial or tcp) GOOD_OR_BAD COM_open(struct connection_in *connection) { struct connection_in * head_in ; if (connection == NO_CONNECTION) { LEVEL_DEBUG("Attempt to open a NULL serial device"); return gbBAD; } head_in = connection->channel_info.head ; // head of multigroup bus switch ( SOC(head_in)->state ) { case cs_deflowered: // Attempt to reopen a good connection? COM_close(head_in) ; break ; case cs_virgin: break ; } switch ( SOC(head_in)->type ) { case ct_telnet: if ( SOC(head_in)->dev.telnet.telnet_negotiated == completed_negotiation ) { SOC(head_in)->dev.telnet.telnet_negotiated = needs_negotiation ; } SOC(head_in)->dev.telnet.telnet_supported = 0 ; return tcp_open( head_in ) ; case ct_tcp: return tcp_open( head_in ) ; case ct_netlink: #if OW_W1 return w1_bind( connection ) ; #endif /* OW_W1 */ case ct_i2c: case ct_usb: LEVEL_DEBUG("Unimplemented"); return gbBAD ; case ct_serial: return serial_open( head_in ) ; case ct_unknown: case ct_none: default: LEVEL_DEBUG("Unknown type."); return gbBAD ; } } owfs-2.8p15/module/owlib/src/c/ow_w1_send.c0000644000175000017500000001121111672006231015425 00000000000000/* $Id: ow_w1_send.c,v 1.33 2011/12/14 02:40:25 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 #include "ow_w1.h" #include "ow_connection.h" /* If cmd is specified, msg length will be adjusted */ /* Build a netlink message, rather tediously, from all the components * making the internal flags, length fields and headers be correct */ SEQ_OR_ERROR W1_send_msg( struct connection_in * in, struct w1_netlink_msg *msg, struct w1_netlink_cmd *cmd, const unsigned char * data) { // outer structure -- nlm = netlink message struct nlmsghdr *nlm; // second structure -- cn = connection message struct cn_msg *cn; // third structure w1m = w1 message to the bus master struct w1_netlink_msg *w1m; // optional fourth w1c = w1 command to a device struct w1_netlink_cmd *w1c; unsigned char * pdata ; int data_size ; SEQ_OR_ERROR seq ; int bus ; int nlm_payload; // NULL connection for initial LIST_MASTERS, not assigned to a specific bus if ( in == NO_CONNECTION ) { // w1 root bus (scanner) // need to lock master w1 before incrementing _MUTEX_LOCK(Inbound_Control.w1_monitor->master.w1_monitor.seq_mutex) ; seq = ++Inbound_Control.w1_monitor->master.w1_monitor.seq ; _MUTEX_UNLOCK(Inbound_Control.w1_monitor->master.w1_monitor.seq_mutex) ; bus = 0 ; } else { // w1 subsidiary bus // this bus is locked seq = ++in->master.w1.seq ; bus = in->master.w1.id; } // figure out the full message length and allocate space nlm_payload = W1_CN_LENGTH + W1_W1M_LENGTH ; // default length before data if ( cmd == NULL ) { // no command data_size = msg->len ; } else { data_size = cmd->len ; // command data length // add command field nlm_payload += W1_W1C_LENGTH ; } // add data length nlm_payload += data_size ; nlm = owmalloc( NLMSG_SPACE(nlm_payload) ); if (nlm==NULL) { // memory allocation error return SEQ_BAD; } // set the nlm fields memset(nlm, 0, NLMSG_SPACE(nlm_payload) ); nlm->nlmsg_seq = MAKE_NL_SEQ( bus, seq ); nlm->nlmsg_type = NLMSG_DONE; nlm->nlmsg_len = NLMSG_LENGTH(nlm_payload) ; // full message //nlm->nlmsg_flags = NLM_F_REQUEST ; // required for userspace -> kernel nlm->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK ; // respond, please nlm->nlmsg_pid = Inbound_Control.w1_monitor->master.w1_monitor.pid ; // set the cn fields cn = (struct cn_msg *) NLMSG_DATA(nlm) ; // just after nlm field cn->id.idx = CN_W1_IDX; cn->id.val = CN_W1_VAL; cn->seq = nlm->nlmsg_seq; cn->ack = cn->seq; // intentionally non-zero ; cn->flags = 0 ; cn->len = nlm_payload - W1_CN_LENGTH ; // size not including nlm or cn // set the w1m (and optionally w1c) fields w1m = (struct w1_netlink_msg *)(cn + 1); // just after cn field memcpy(w1m, msg, W1_W1M_LENGTH); w1m->len = cn->len - W1_W1M_LENGTH ; // size minus nlm, cn and w1m if ( cmd == NULL ) { // no command w1c = NULL ; pdata = (unsigned char *)(w1m + 1); // data just after w1m } else { w1c = (struct w1_netlink_cmd *)(w1m + 1); // just after w1m pdata = (unsigned char *)(w1c + 1); // data just after w1c memcpy(w1c, cmd, W1_W1C_LENGTH); // set command } if ( data_size > 0 ) { memcpy(pdata, data, data_size); } else { pdata = NULL ; // no data } LEVEL_DEBUG("Netlink send -----------------"); Netlink_Print( nlm, cn, w1m, w1c, pdata, data_size ) ; if ( send( SOC(Inbound_Control.w1_monitor)->file_descriptor, nlm, NLMSG_SPACE(nlm_payload), 0) == -1 ) { //err = COM_write( nlm, nlm_size, Inbound_Control.w1.monitor ) ; owfree(nlm); ERROR_CONNECT("Failed to send w1 netlink message"); return SEQ_BAD ; } owfree(nlm); LEVEL_DEBUG("NETLINK sent seq=%d", (int) seq); return seq; } #endif /* OW_W1 */ owfs-2.8p15/module/owlib/src/c/ow_w1_select.c0000664000175000017500000000445411440235033015765 00000000000000/* $Id: ow_w1_select.c,v 1.19 2010/09/03 18:10:35 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" /* Wait for a netlink packet */ GOOD_OR_BAD W1PipeSelect_timeout( FILE_DESCRIPTOR_OR_ERROR file_descriptor ) { do { int select_value ; struct timeval tv = { Globals.timeout_w1, 0 } ; fd_set readset ; FD_ZERO(&readset) ; FD_SET(file_descriptor,&readset) ; select_value = select(file_descriptor+1,&readset,NULL,NULL,&tv) ; if ( select_value == -1 ) { if (errno != EINTR) { ERROR_CONNECT("Netlink (w1) Select error"); return gbBAD ; } } else if ( select_value == 0 ) { struct timeval now ; struct timeval diff ; timernow( &now ); // Set time of last read _MUTEX_LOCK(Inbound_Control.w1_monitor->master.w1_monitor.read_mutex) ; timersub( &now, &(Inbound_Control.w1_monitor->master.w1_monitor.last_read), &diff ); _MUTEX_UNLOCK(Inbound_Control.w1_monitor->master.w1_monitor.read_mutex) ; if ( diff.tv_sec <= Globals.timeout_w1 ) { LEVEL_DEBUG("Select legal timeout -- try again"); continue ; } LEVEL_DEBUG("Select returned zero (timeout)"); return gbBAD; } else { return gbGOOD ; } } while (1) ; } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_w1_list.c0000644000175000017500000000366111666515375015502 00000000000000/* $Id: ow_w1_list.c,v 1.23 2011/12/03 21:56:13 alfille Exp $ W1 Announce -- daemon for showing w1 busmasters using Avahi Written 2008 Paul H Alfille email: paul.alfille@gmail.com Released under the GPLv2 Much thanks to Evgeniy Polyakov This file itself is amodestly modified version of w1d by Evgeniy Polyakov */ /* * w1d.c * * Copyright (c) 2004 Evgeniy Polyakov * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* w1 list * Routines to read the list of w1 masters * This is called from ow_w1_browse */ #include #include "owfs_config.h" #if OW_W1 && OW_MT #include "ow_w1.h" #include "ow_connection.h" SEQ_OR_ERROR w1_list_masters( void ) { struct w1_netlink_msg w1m; memset(&w1m, 0, W1_W1M_LENGTH); w1m.type = W1_LIST_MASTERS; w1m.len = 0; w1m.id.mst.id = 0; LEVEL_DEBUG("Sending w1 bus master list message"); return W1_send_msg( NULL, &w1m, NULL, NULL ); } void w1_parse_master_list(struct netlink_parse * nlp) { int * bus_master = (int32_t *) nlp->data ; int num_masters = nlp->data_size / 4 ; int i ; LEVEL_DEBUG("W1 List %d masters",num_masters); for ( i=0 ;idata_size); AddW1Bus( bus_master[i] ) ; } } #endif /* OW_W1 && OW_MT */ owfs-2.8p15/module/owlib/src/c/ow_avahi_link.c0000664000175000017500000000706511470535274016222 00000000000000/* $Id: ow_avahi_link.c,v 1.7 2010/11/16 17:09:16 alfille Exp $ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ #include #include "owfs_config.h" #if OW_ZERO #include "ow.h" #include "ow_dl.h" DLHANDLE avahi_client = NULL; DLHANDLE avahi_common = NULL; /* Special functions that need to be linked in dynamically -- libavahi-client.so avahi_client_errno avahi_client_free avahi_client_new avahi_entry_group_add_service avahi_entry_group_commit avahi_entry_group_is_empty avahi_entry_group_new avahi_entry_group_reset --libavahi-common.so avahi_simple_poll_free avahi_simple_poll_get avahi_simple_poll_loop avahi_simple_poll_new avahi_simple_poll_quit avahi_strerror */ #ifdef HAVE_DLFCN_H #include #endif #define DNSfunction_link( lib , name ) do { name = DL_sym( lib, #name );\ if ( name == NULL ) {\ LEVEL_CONNECT("Avahi is DISABLED since "#name" isn't found");\ return gbBAD;\ } else { \ LEVEL_DEBUG("Avahi library function found: "#name);\ } } while (0) GOOD_OR_BAD OW_Load_avahi_library(void) { #if OW_CYGWIN LEVEL_DEBUG("No avahi in Cygwin"); return gbBAD ; #elif OW_DARWIN LEVEL_DEBUG("At least currently, it's easier to use the native Bonjour on Mac OSX"); return gbBAD ; #elif defined(HAVE_DLOPEN) if ( (avahi_client=DL_open("libavahi-client.so")) == NULL && (avahi_client=DL_open("/usr/lib/libavahi-client.so")) == NULL && (avahi_client=DL_open("/opt/owfs/lib/libavahi-client.so")) == NULL ) { LEVEL_CONNECT("No Avahi support. Library libavahi-client couldn't be loaded") ; return gbBAD ; } else { LEVEL_DEBUG("Avahi support: libavahi-client loaded successfully"); } DNSfunction_link(avahi_client,avahi_client_errno) ; DNSfunction_link(avahi_client,avahi_client_free) ; DNSfunction_link(avahi_client,avahi_client_new) ; DNSfunction_link(avahi_client,avahi_client_get_domain_name) ; DNSfunction_link(avahi_client,avahi_entry_group_add_service) ; DNSfunction_link(avahi_client,avahi_entry_group_commit) ; DNSfunction_link(avahi_client,avahi_entry_group_is_empty) ; DNSfunction_link(avahi_client,avahi_entry_group_new) ; DNSfunction_link(avahi_client,avahi_entry_group_reset) ; DNSfunction_link(avahi_client,avahi_service_resolver_free) ; DNSfunction_link(avahi_client,avahi_service_resolver_new) ; DNSfunction_link(avahi_client,avahi_service_browser_free) ; DNSfunction_link(avahi_client,avahi_service_browser_new) ; if ( (avahi_common=DL_open("libavahi-common.so")) == NULL && (avahi_common=DL_open("/usr/lib/libavahi-common.so")) == NULL && (avahi_common=DL_open("/opt/owfs/lib/libavahi-common.so")) == NULL ) { LEVEL_CONNECT("No Avahi support. Library libavahi-common couldn't be loaded.") ; return gbBAD ; } else { LEVEL_DEBUG("Avahi support: libavahi-common loaded successfully."); } DNSfunction_link(avahi_common,avahi_simple_poll_free) ; DNSfunction_link(avahi_common,avahi_simple_poll_get) ; DNSfunction_link(avahi_common,avahi_simple_poll_loop) ; DNSfunction_link(avahi_common,avahi_simple_poll_new) ; DNSfunction_link(avahi_common,avahi_simple_poll_quit) ; DNSfunction_link(avahi_common,avahi_strerror) ; return gbGOOD ; #endif LEVEL_CONNECT("dlopen not supported on this platform") ; return gbBAD; } void OW_Free_avahi_library(void) { if (avahi_client) { DL_close(avahi_client); avahi_client = NULL; } if (avahi_common) { DL_close(avahi_common); avahi_common = NULL; } } #endif /* OW_ZERO */ owfs-2.8p15/module/owlib/Makefile.in0000664000175000017500000005115411756250027014273 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ target_triplet = @target@ subdir = module/owlib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 \ $(top_srcdir)/module/swig/perl5/perl5.m4 \ $(top_srcdir)/module/swig/php/php.m4 \ $(top_srcdir)/module/swig/python/python.m4 \ $(top_srcdir)/module/owtcl/tcl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) \ $(top_srcdir)/src/scripts/install/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 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 ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIR = @DATADIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_CACHE = @ENABLE_CACHE@ ENABLE_DEBUG = @ENABLE_DEBUG@ ENABLE_HA7 = @ENABLE_HA7@ ENABLE_I2C = @ENABLE_I2C@ ENABLE_MT = @ENABLE_MT@ ENABLE_OWCAPI = @ENABLE_OWCAPI@ ENABLE_OWEXTERNAL = @ENABLE_OWEXTERNAL@ ENABLE_OWFS = @ENABLE_OWFS@ ENABLE_OWFTPD = @ENABLE_OWFTPD@ ENABLE_OWHTTPD = @ENABLE_OWHTTPD@ ENABLE_OWLIB = @ENABLE_OWLIB@ ENABLE_OWMALLOC = @ENABLE_OWMALLOC@ ENABLE_OWMON = @ENABLE_OWMON@ ENABLE_OWNET = @ENABLE_OWNET@ ENABLE_OWNETLIB = @ENABLE_OWNETLIB@ ENABLE_OWPERL = @ENABLE_OWPERL@ ENABLE_OWPHP = @ENABLE_OWPHP@ ENABLE_OWPYTHON = @ENABLE_OWPYTHON@ ENABLE_OWSERVER = @ENABLE_OWSERVER@ ENABLE_OWSHELL = @ENABLE_OWSHELL@ ENABLE_OWTAP = @ENABLE_OWTAP@ ENABLE_OWTCL = @ENABLE_OWTCL@ ENABLE_PARPORT = @ENABLE_PARPORT@ ENABLE_PERL = @ENABLE_PERL@ ENABLE_PHP = @ENABLE_PHP@ ENABLE_PROFILING = @ENABLE_PROFILING@ ENABLE_PYTHON = @ENABLE_PYTHON@ ENABLE_SWIG = @ENABLE_SWIG@ ENABLE_TAI8570 = @ENABLE_TAI8570@ ENABLE_THERMOCOUPLE = @ENABLE_THERMOCOUPLE@ ENABLE_TRAFFIC = @ENABLE_TRAFFIC@ ENABLE_USB = @ENABLE_USB@ ENABLE_W1 = @ENABLE_W1@ ENABLE_ZERO = @ENABLE_ZERO@ EXEEXT = @EXEEXT@ EXTRACFLAGS = @EXTRACFLAGS@ FGREP = @FGREP@ FUSE_FLAGS = @FUSE_FLAGS@ FUSE_INCLUDES = @FUSE_INCLUDES@ FUSE_LIBS = @FUSE_LIBS@ GREP = @GREP@ HAVE_CYGWIN = @HAVE_CYGWIN@ HAVE_DARWIN = @HAVE_DARWIN@ HAVE_DEBIAN = @HAVE_DEBIAN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXTRALIBS = @LD_EXTRALIBS@ LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBPOSTFIX = @LIBPOSTFIX@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSLIBS = @OSLIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ OWFSROOT = @OWFSROOT@ OWFS_BINARY_AGE = @OWFS_BINARY_AGE@ OWFS_INTERFACE_AGE = @OWFS_INTERFACE_AGE@ OWTCL_INSTALL_PATH = @OWTCL_INSTALL_PATH@ OW_ALLOC_DEBUG = @OW_ALLOC_DEBUG@ OW_CACHE = @OW_CACHE@ OW_CYGWIN = @OW_CYGWIN@ OW_DARWIN = @OW_DARWIN@ OW_DEBUG = @OW_DEBUG@ OW_HA7 = @OW_HA7@ OW_I2C = @OW_I2C@ OW_MT = @OW_MT@ OW_PARPORT = @OW_PARPORT@ OW_SHOW_TRAFFIC = @OW_SHOW_TRAFFIC@ OW_TAI8570 = @OW_TAI8570@ OW_THERMOCOUPLE = @OW_THERMOCOUPLE@ OW_USB = @OW_USB@ OW_W1 = @OW_W1@ OW_ZERO = @OW_ZERO@ 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@ PERL = @PERL@ PERL5CCFLAGS = @PERL5CCFLAGS@ PERL5DIR = @PERL5DIR@ PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@ PERL5EXT = @PERL5EXT@ PERL5LIB = @PERL5LIB@ PERL5NAME = @PERL5NAME@ PHP = @PHP@ PHPCONFIG = @PHPCONFIG@ PHPEXT = @PHPEXT@ PHPINC = @PHPINC@ PHPLIBDIR = @PHPLIBDIR@ PIC_FLAGS = @PIC_FLAGS@ POW_LIB = @POW_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYCFLAGS = @PYCFLAGS@ PYLDFLAGS = @PYLDFLAGS@ PYLIB = @PYLIB@ PYSITEDIR = @PYSITEDIR@ PYTHON = @PYTHON@ PYTHONCONFIG = @PYTHONCONFIG@ PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@ PYVERSION = @PYVERSION@ RANLIB = @RANLIB@ RM = @RM@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@ TCL_BUILD_STUB_LIB_SPEC = @TCL_BUILD_STUB_LIB_SPEC@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_COMPAT_OBJS = @TCL_COMPAT_OBJS@ TCL_DEFS = @TCL_DEFS@ TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LD_FLAGS = @TCL_LD_FLAGS@ TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@ TCL_LIBS = @TCL_LIBS@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_FLAG = @TCL_LIB_FLAG@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@ TCL_SHLIB_LD = @TCL_SHLIB_LD@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TCL_VERSION = @TCL_VERSION@ TEST = @TEST@ VERSION = @VERSION@ VERSION_MAJOR = @VERSION_MAJOR@ VERSION_MINOR = @VERSION_MINOR@ VERSION_PATCHLEVEL = @VERSION_PATCHLEVEL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ 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@ fuse_include_path = @fuse_include_path@ fuse_lib_path = @fuse_lib_path@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src all: all-recursive .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 module/owlib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu module/owlib/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): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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) $(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) $(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) $(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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f 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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am clean-generic: @RM@ -f *~ .*~ # 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: owfs-2.8p15/module/owlib/Makefile.am0000664000175000017500000000005710432627750014257 00000000000000SUBDIRS = src clean-generic: @RM@ -f *~ .*~ owfs-2.8p15/bootstrap0000775000175000017500000000017511651552637011573 00000000000000#! /bin/sh rm -rf *cache aclocal && autoheader && autoconf && automake && echo "Run './configure' and 'make' to build owfs"