cobalt-panel-utils-1.0.2/0000705000175000017500000000000010273253010014747 5ustar gandalfgandalfcobalt-panel-utils-1.0.2/doc/0000755000175000017500000000000010272741667015544 5ustar gandalfgandalfcobalt-panel-utils-1.0.2/doc/man/0000755000175000017500000000000010241421076016300 5ustar gandalfgandalfcobalt-panel-utils-1.0.2/doc/man/lcd-write.10000644000175000017500000000227210272742222020262 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-WRITE "1" "May 2005" "lcd-write 1.0.2" "User Commands" .SH NAME lcd-write \- Writes the specified lines to the LCD device and blinks .SH SYNOPSIS .B lcd-write \fILINE1 LINE2\fR .SH DESCRIPTION .\" Add any additional description here .PP Writes LINE1 and LINE2 to the LCD device. Atleast one line is required. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/lcd-yesno.10000644000175000017500000000304310272742221020261 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-YESNO "1" "May 2005" "lcd-yesno 1.0.2" "User Commands" .SH NAME lcd-yesno \- Prompts the user to make a choice between two options .SH SYNOPSIS .B lcd-yesno \fI[-y ] [-n ] [-1 ] [-2 ]\fR .SH DESCRIPTION .\" Add any additional description here .PP Prompts the user to make a choice between to options on the LCD which can be specified by the arguments. .TP \fB\-\-y \fR Specifies position of the yes answer character .TP \fB\-\-n\fR Specifies position of the no answer character .TP \fB\-\-1 \fR Sets the text to be displayed on the first line of the LCD .TP \fB\-\-2 \fR Sets the text to be displayed on the second line of the LCD. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/readbutton.10000644000175000017500000000222010272742220020526 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH READBUTTON "1" "May 2005" "readbutton 1.0.2" "User Commands" .SH NAME readbutton \- Returns the status front panel buttons .SH SYNOPSIS .B readbutton .SH DESCRIPTION .\" Add any additional description here .PP Returns the status of front panel buttons in the return value. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1),cobalt-panel-utils-1.0.2/doc/man/lcd-swrite.10000644000175000017500000000240710272742223020446 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-SWRITE "1" "May 2005" "lcd-swrite 1.0.2" "User Commands" .SH NAME lcd-swrite \- Writes the specified lines to the LCD device and blinks .SH SYNOPSIS .B lcd-swrite \fILINE1 LINE2\fR .SH DESCRIPTION .\" Add any additional description here .PP Writes LINE1 and LINE2 to the LCD device along with a flash astrisk. Atleast one line is required. This program does not quit until interrupted. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/lcd-setcursor.10000644000175000017500000000256710272742223021171 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-SETCURSOR "1" "May 2005" "lcd-setcursor 1.0.2" "User Commands" .SH NAME lcd-setcursor \- Sets the position of the cursor on the LCD .SH SYNOPSIS .B lcd-setcursor \fI \fR .SH DESCRIPTION .\" Add any additional description here .PP Sets the position of the LCD's hardware cursor for use as a selection identifier. .TP \fB\-\\fR The row to place the cursor on. Possible values are 1 or 2. .TP \fB\-\\fR The column to place the cursor on. Possible values are 1 through 16. .SH AUTHOR Written by Jeff Walter. Based on code by Sun Microsystems (lcd-getip.c) .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2005 Jeff Walter .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/iflink.10000644000175000017500000000232710272742226017651 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH IFLINK "1" "May 2005" "iflink 1.0.2" "User Commands" .SH NAME iflink \- Returns whether or not the system has a network link .SH SYNOPSIS .B iflink .SH DESCRIPTION .\" Add any additional description here .PP Checks whether or not the system has a network hardware link. Status is returned via STDOUT and return value, 0 for no, 1 for yes. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1), cobalt-panel-utils-1.0.2/doc/man/lcd-flash.10000644000175000017500000000245710272742225020235 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-FLASH "1" "May 2005" "lcd-flash 1.0.2" "User Commands" .SH NAME lcd-flash \- Momentarily inverts the LCD to indicate an error .SH SYNOPSIS .B lcd-flash \fI[-s]\fR .SH DESCRIPTION .\" Add any additional description here .PP Momentarily inverts the LCD display to indicate than an input error has occured. .TP \fB\-\-s\fR Indicates the flash should be performed silently. Don't print anything to STDOUT unless absolutely needed. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/lcd-getip.10000644000175000017500000000256410272742224020246 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH LCD-GETIP "1" "May 2005" "lcd-getip 1.0.2" "User Commands" .SH NAME lcd-getip \- Prompts the user to enter an IP address on the LCD .SH SYNOPSIS .B lcd-getip \fI[-1 ] [-i ]\fR .SH DESCRIPTION .\" Add any additional description here .PP Prompts the user to enter an IP address through the LCD. The resulting IP address is printed to STDOUT. .TP \fB\-\-1 \fR Sets the text to be displayed on the first line of the LCD .TP \fB\-\-i \fR Sets the default IP address for the selection .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR iflinkstatus (1), .BR lcd-flash (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/man/iflinkstatus.10000644000175000017500000000227310272742226021115 0ustar gandalfgandalf.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. .TH IFLINKSTATUS "1" "May 2005" "iflinkstatus 1.0.2" "User Commands" .SH NAME iflinkstatus \- Returns the status of hardware network links .SH SYNOPSIS .B iflinkstatus .SH DESCRIPTION .\" Add any additional description here .PP Returns the status of hardware network links in a binary format. 1 for eth0, 2 for eth1. yes. .SH AUTHOR Written by Sun Microsystems. Modified by Jeff Walter .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT Copyright \(co 2002 Sun Microsystems, Inc. .br 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 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 General Public License for more details. .SH "SEE ALSO" .BR iflink (1), .BR lcd-flash (1), .BR lcd-getip (1), .BR lcd-setcursor (1), .BR lcd-swrite (1), .BR lcd-write (1), .BR lcd-yesno (1), .BR readbutton (1),cobalt-panel-utils-1.0.2/doc/README_GNU_LGPL0000644000175000017500000006347610227467055017767 0ustar gandalfgandalf GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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 Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 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! cobalt-panel-utils-1.0.2/doc/README_GNU_GPL0000644000175000017500000004313110227467055017635 0ustar gandalfgandalf 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. cobalt-panel-utils-1.0.2/doc/README0000644000175000017500000000152610241410575016413 0ustar gandalfgandalfCopyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. Portions Copyright (c) 2005, Jeff Walter Portions source to the Sun Cobalt panel utilities are released under the terms of the GNU General Public License (GPL) or the GNU Lesser General Public License (LGPL). These licenses should be available in the files README_GNU_GPL - GPL license terms README_GNU_LGPL - LGPL license terms Please refer to the specific files to determine which license applies. NOTE: Development of these tools requires the gettext package to be loaded on the development machine. NOTE: This does not include the menu system that comes with the Cobalt Linux because it is incompatible with Gentoo (file layout, and something better could be written). NOTE: There is a Perl module availabe to interact more easily with these applications, Cobalt::LCD. cobalt-panel-utils-1.0.2/doc/CREDITS0000644000175000017500000000017010241410656016545 0ustar gandalfgandalfSun Microsystems, Inc: Lyle Scheer Timothy Stonis Duncan Laurie Adrian Sun Jeff Lovell Joshua Uziel Other: Jeff Walter cobalt-panel-utils-1.0.2/lib/0000755000175000017500000000000010273002006015517 5ustar gandalfgandalfcobalt-panel-utils-1.0.2/lib/lcdlocale.c0000644000175000017500000000334710272741317017632 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * locale setting for panel utils * * NOTE: as we want to make sure that all of the lcd utils know * about each other, this is almost intentionally * single-threaded. */ #include #include #include #include #include #include "lcdutils.h" #define LOCALEFILE "/etc/cobalt/locale" #define TEXTDOMAIN "panel-utils" #define DOMAINDIR "/usr/share/locale" extern int _nl_msg_cat_cntr; void lcd_setlocale(void) { unsigned char language[32]; FILE *fp; if ((fp = fopen(LOCALEFILE, "r"))) { fscanf(fp, "%s", language); fclose(fp); } else { strcpy(language, "en_US"); } setenv("LANGUAGE", language, 1); ++_nl_msg_cat_cntr; setlocale(LC_ALL, ""); bindtextdomain(TEXTDOMAIN, DOMAINDIR); textdomain(TEXTDOMAIN); } cobalt-panel-utils-1.0.2/lib/Makefile0000644000175000017500000000065210227474126017201 0ustar gandalfgandalf# # Makefile for creating LED and LCD utilities # SRCS = lcdlock.c lcdlocale.c lcdtimeout.c lcddisplay.c lcdread.c \ lcdcursor.c lcdlink.c lcdnet.c lcdbutton.c OBJS := $(SRCS:.c=.o) LIB = liblcd.a RANLIB = ranlib DEBUG = -g -Wall COPTS = -O2 CFLAGS = $(COPTS) -I../ $(COPTFLAGS) all: $(LIB) $(OBJS): ../lcdutils.h $(LIB): $(OBJS) $(AR) cr $(LIB) $(OBJS) $(RANLIB) $(LIB) clean: -rm -f $(OBJS) $(LIB) *~ TAGS cobalt-panel-utils-1.0.2/lib/lcdbutton.c0000644000175000017500000000331110272741323017672 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. */ /* button routines */ #include #include #include "lcdutils.h" #include "lcd_private.h" int lcd_button_debounce(void *lcd_private) { struct lcd_private *lcd = lcd_private; return lcd->button_debounce; } int lcd_button_sense(void *lcd_private) { struct lcd_private *lcd = lcd_private; return lcd->button_sense; } /* wait until the user stops pressing a button */ void lcd_wait_no_button(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || lcd->fd < 0) return; ioctl(lcd->fd, BUTTON_Read, &lcd->display); lcd->display.buttons &= 0x00FF; while((lcd->display.buttons != BUTTON_NONE) && (lcd->display.buttons != BUTTON_NONE_B)) { ioctl(lcd->fd, BUTTON_Read, &lcd->display); lcd->display.buttons &= 0x00FF; } } cobalt-panel-utils-1.0.2/lib/lcd_private.h0000644000175000017500000000222610272741310020175 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. */ #ifndef LCD_PRIVATE_H #define LCD_PRIVATE_H 1 #include "lcd.h" #define DEVLCD "/dev/lcd" struct lcd_private { struct lcd_display display; int fd, button_debounce, button_sense; } lcd_private; #endif cobalt-panel-utils-1.0.2/lib/lcddisplay.c0000644000175000017500000001317010272741321020026 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * display utilities for the panel utils * * NOTE: as we want to make sure that all of the lcd utils know * about each other, this is almost intentionally * single-threaded. */ #include #include #include #include #include #include #include #include "lcdutils.h" #include "lcd_private.h" #define INVALIDUSECS 300000 /* .3 seconds */ #define SPINUSECS 500000 /* .5 secs */ #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif void lcd_set(void *lcd_private, const int value) { struct lcd_private *lcd = lcd_private; if (!lcd || lcd->fd < 0) return; ioctl(lcd->fd, value); } /* this depends upon the lcd driver not changing bits that * it doesn't use. */ void lcd_blink_invalid(void *lcd_private) { struct lcd_private *save = lcd_private; struct lcd_display lcd, lcdblank; struct timeval tv, savetv; if (!save || save->fd < 0) return; ioctl(save->fd, LCD_Read, &lcd); /* initialize the blinky bits */ memcpy(&lcdblank, &lcd, sizeof(lcd)); memset(lcdblank.line2, ' ', sizeof(lcdblank.line2)); lcd.size1 = lcd.size2 = 16; lcdblank.size1 = lcdblank.size2 = 16; ioctl(save->fd, BUTTON_Read, &save->display); save->display.buttons = save->display.buttons & 0x00FF; memset(&savetv, 0, sizeof(savetv)); savetv.tv_usec = INVALIDUSECS; while ((save->display.buttons == BUTTON_NONE) || (save->display.buttons == BUTTON_NONE_B)) { ioctl(save->fd, LCD_Write, &lcdblank); memcpy(&tv, &savetv, sizeof(tv)); select(1, NULL, NULL, NULL, &tv); ioctl(save->fd, LCD_Write, &lcd); memcpy(&tv, &savetv, sizeof(tv)); select(1, NULL, NULL, NULL, &tv); ioctl(save->fd, BUTTON_Read, &save->display); save->display.buttons = save->display.buttons & 0x00FF; } ioctl(save->fd, LCD_Write, &lcd); } /* blinky asterisk */ void lcd_spin(void *lcd, const char *line1, const char *line2) { char star[16]; struct timeval tv, save; memset(star, ' ', sizeof(star)); if (line2) memcpy(star, line2, MIN(strlen(line2), sizeof(star))); memset(&save, 0, sizeof(save)); save.tv_usec = SPINUSECS; while (1) { star[15] = '*'; lcd_write(lcd, line1, star); memcpy(&tv, &save, sizeof(tv)); select(1, NULL, NULL, NULL, &tv); star[15] = ' '; lcd_write(lcd, line1, star); memcpy(&tv, &save, sizeof(tv)); select(1, NULL, NULL, NULL, &tv); } } void *lcd_open(const int flags) { struct lcd_private *lcd; int lcdtype = 0; if ((lcd = calloc(1, sizeof(struct lcd_private))) == NULL) return NULL; if ((lcd->fd = open(DEVLCD, flags)) < 0) { free(lcd); return NULL; } lcd->button_debounce = PARALLEL_BUTTON_DEBOUNCE; lcd->button_sense = PARALLEL_BUTTON_SENSE; if ((ioctl(lcd->fd, LCD_Type, &lcdtype) == 0) && (lcdtype == LCD_TYPE_I2C)) { lcd->button_debounce = I2C_BUTTON_DEBOUNCE; lcd->button_sense = I2C_BUTTON_SENSE; } return lcd; } void lcd_close(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd) return; if (lcd->fd < 0) close(lcd->fd); free(lcd); } void lcd_reset(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return; ioctl(lcd->fd,LCD_Reset); ioctl(lcd->fd,LCD_Clear); ioctl(lcd->fd,LCD_On); ioctl(lcd->fd,LCD_Cursor_Off); } int lcd_write(void *lcd_private, const char *line1, const char *line2) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; if (line1) { lcd->display.size1 = MIN(strlen(line1), sizeof(lcd->display.line1)); memcpy(lcd->display.line1, line1, lcd->display.size1); } if (line2) { lcd->display.size2 = MIN(strlen(line2), sizeof(lcd->display.line2)); memcpy(lcd->display.line2, line2, lcd->display.size2); } ioctl(lcd->fd, LCD_Write, &lcd->display); return 0; } int lcd_setleds(void *lcd_private, const int pattern) { struct lcd_private *lcd = lcd_private; if (ioctl(lcd->fd, LED32_Set, pattern) == 0) return 0; if (!lcd || (lcd->fd < 0) || ((pattern & 0x0F) == 0x0F)) return -1; lcd->display.leds = pattern; ioctl(lcd->fd,LED_Set,&lcd->display); return 0; } int lcd_led_set(void *lcd_private, const unsigned int pattern) { struct lcd_private *lcd = lcd_private; if (ioctl(lcd->fd, LED32_Bit_Set, pattern) == 0) return 0; if (!lcd || (lcd->fd < 0) || ((pattern & 0x0F) == 0x0F)) return -1; lcd->display.leds = pattern; ioctl(lcd->fd,LED_Set,&lcd->display); return 0; } int lcd_led_clear(void *lcd_private, const unsigned int pattern) { struct lcd_private *lcd = lcd_private; if (ioctl(lcd->fd, LED32_Bit_Clear, pattern) == 0) return 0; if (!lcd || (lcd->fd < 0) || ((pattern & 0x0F) == 0x0F)) return -1; lcd->display.leds = pattern; ioctl(lcd->fd,LED_Set,&lcd->display); return 0; } cobalt-panel-utils-1.0.2/lib/lcdtimeout.c0000644000175000017500000000462010272741323020051 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * implement time-related functions for panel utils. it's done this way * because select() doesn't always work with the lcd driver. bleah. * * NOTE: as we want to make sure that all of the lcd utils know * about each other, this is almost intentionally * single-threaded. */ #include #include #include #include #include #include #include #include "lcdutils.h" static struct itimerval timeout; /* start up an alarm handler for timeouts. we have to do it * this way because we can't do a select/poll on /dev/lcd * and have it be meaningful. */ int lcd_timeout_start(void (*fcn)(int), const int seconds) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = fcn; act.sa_flags = SA_RESTART; if (sigaction(SIGALRM, &act, NULL) < 0) return -1; memset(&timeout, 0, sizeof(timeout)); timeout.it_interval.tv_sec = seconds; timeout.it_value.tv_sec = seconds; if (setitimer(ITIMER_REAL, &timeout, NULL) < 0) { sigaction(SIGALRM, NULL, NULL); return -1; } return 0; } /* stop and reset everything */ void lcd_timeout_stop(void) { struct itimerval zero; struct sigaction act; memset(&zero, 0, sizeof(zero)); memset(&act, 0, sizeof(act)); setitimer(ITIMER_REAL, &zero, NULL); act.sa_handler = SIG_DFL; sigaction(SIGALRM, &act, NULL); } /* just do a reset */ int lcd_timeout_reset(void) { return setitimer(ITIMER_REAL, &timeout, NULL); } cobalt-panel-utils-1.0.2/lib/lcdcursor.c0000644000175000017500000000370310272741322017700 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. */ #include #include #include #include "lcdutils.h" #include "lcd_private.h" void lcd_setcursorpos(void *lcd_private, unsigned char address) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return; lcd->display.cursor_address = address; ioctl(lcd->fd, LCD_Set_Cursor_Pos, &lcd->display); } void lcd_setcursor(void *lcd_private, unsigned char character) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return; lcd->display.character = character; ioctl(lcd->fd, LCD_Set_Cursor, &lcd->display); } int lcd_getcursorpos(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; ioctl(lcd->fd, LCD_Get_Cursor_Pos, &lcd->display); return lcd->display.cursor_address; } int lcd_getcursor(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; ioctl(lcd->fd, LCD_Get_Cursor, &lcd->display); return lcd->display.character; } cobalt-panel-utils-1.0.2/lib/lcdlink.c0000644000175000017500000000323610272741320017317 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * link status functions */ #include #include #include #include #include "lcdutils.h" #include "lcd_private.h" int lcd_checklink(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; lcd->display.buttons = 0; ioctl(lcd->fd,LINK_Check,&lcd->display); return lcd->display.buttons & 0x04; } int lcd_checklink2(void *lcd_private, int *buttons) { struct lcd_private *lcd = lcd_private; int i; if (!lcd || (lcd->fd < 0)) return -1; lcd->display.buttons = (buttons) ? *buttons : 0; if ((i = ioctl(lcd->fd,LINK_Check_2,&lcd->display)) < 0) return i; if (buttons) *buttons = lcd->display.buttons; return 0; } cobalt-panel-utils-1.0.2/lib/lcdlock.c0000644000175000017500000000705510272741316017322 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * lock functions for the panel utils * * NOTE: as we want to make sure that all of the lcd utils know * about each other, this is almost intentionally * single-threaded. */ #include #include #include #include #include #include #include #define __USE_GNU #include #include "lcdutils.h" #define LOCKFILE "/var/run/.lcdlock" static int lockfd = -1; extern int errno; /* lcd locking */ int lcd_lock(void) { char buf[16]; struct flock lock; struct stat st1, st2; if (lockfd > -1) /* already locked */ return -2; /* * verify file before opening it */ if (lstat(LOCKFILE, &st1) < 0) { /* * does not exist - create */ lockfd = open(LOCKFILE, O_RDWR | O_TRUNC | O_EXCL | O_CREAT, 0600); if (lockfd < 0) { fprintf(stderr, "ERROR: unable to open file '%s' for write: %s\n",LOCKFILE, strerror(errno)); return lockfd = -1; } } else { /* * exists - allow only regular file, not links */ if (!S_ISREG(st1.st_mode)) { fprintf(stderr, "ERROR: file '%s' has invalid mode: %d\n", LOCKFILE, st1.st_mode); return lockfd = -1; } /* * allow only files with 1 link (itself) */ if (st1.st_nlink != 1) { fprintf(stderr, "ERROR: file '%s' has invalid link count: %d != 1\n",LOCKFILE, st1.st_nlink); return lockfd = -1; } /* * open it for write, overwrite existing file */ lockfd = open(LOCKFILE, O_RDWR | O_NOFOLLOW | O_TRUNC, 0600); if (lockfd < 0) { fprintf(stderr, "ERROR: unable to overwrite file '%s': %s\n", LOCKFILE, strerror(errno)); return lockfd = -1; } /* * stat again and verify inode/owner/link count */ fstat(lockfd, &st2); if (st2.st_ino != st1.st_ino || st2.st_uid != st1.st_uid || st2.st_nlink != 1) { fprintf(stderr, "ERROR: unable to verify file '%s'\n", LOCKFILE); close(lockfd); return lockfd = -1; } } /* * establish a fcntl lock on it * so it dies when the process dies */ memset(&lock, 0, sizeof(lock)); lock.l_type = F_WRLCK; if (fcntl(lockfd, F_SETLK, &lock) < 0) { fprintf(stderr, "ERROR: unable to establish fcntl lock on file '%s'\n",LOCKFILE); close(lockfd); return lockfd = -1; } memset(&buf[0], 0, sizeof(buf)); sprintf(buf, "%d", getpid()); if (write(lockfd, buf, strlen(buf)) < 0) { fprintf(stderr, "ERROR: unable to write PID '%s' to file '%s'\n",buf, LOCKFILE); close(lockfd); return lockfd = -1; } return 0; } /* this assumes that every call to lcd_unlock really means it. */ void lcd_unlock(void) { if (lockfd > -1) { close(lockfd); lockfd = -1; } unlink(LOCKFILE); } cobalt-panel-utils-1.0.2/lib/lcdread.c0000644000175000017500000000367410272741315017307 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * read functions for the lcd. we handle both buttons and * reading from the panel. */ #include #include #include #include #include #include #include #include "lcdutils.h" #include "lcd_private.h" int lcd_getdisplay(void *lcd_private, char **line1, char **line2, int *buttons) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; ioctl(lcd->fd, LCD_Read, &lcd->display); if (line1) *line1 = lcd->display.line1; if (line2) *line2 = lcd->display.line2; if (buttons) *buttons = lcd->display.buttons; return 0; } int lcd_readbutton(void *lcd_private) { struct lcd_private *lcd = lcd_private; if (!lcd || (lcd->fd < 0)) return -1; ioctl(lcd->fd, BUTTON_Read, &lcd->display); return lcd->display.buttons; } int lcd_getbutton(void *lcd_private) { struct lcd_private *lcd = lcd_private; int i; if (!lcd || (lcd->fd < 0)) return -2; return read(lcd->fd, &i, 1); } cobalt-panel-utils-1.0.2/lib/lcdnet.c0000644000175000017500000001026310272741316017153 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * read functions for the lcd. we handle both buttons and * reading from the panel. */ #include #include #include #include #include #include #include "lcdutils.h" #include "lcd_private.h" void lcd_rev_format( char *in ) { int one, two, three, four; sscanf(in,"%d.%d.%d.%d", &one, &two, &three, &four); if (one > 255) one = 0; if (two > 255) two = 0; if (three > 255) three = 0; if (four > 255) four = 0; sprintf(in,"%03d.%03d.%03d.%03d",one,two,three,four); } int lcd_netbutton(void *lcd) { int firstdigit = 0; int button, i, ctr=0; lcd_set(lcd, LCD_Cursor_On); while( 1 ) { button = lcd_readbutton(lcd) & 0x00FF; if ( (button != BUTTON_NONE) && (button != BUTTON_NONE_B) ) { ctr++; if ( (ctr==lcd_button_debounce(lcd)) ) { switch (button) { case BUTTON_Left: case BUTTON_Left_B: i = lcd_getcursorpos(lcd); if (i != 0x40) { lcd_set(lcd, LCD_Cursor_Left); i = lcd_getcursor(lcd); if (i == '.') lcd_set(lcd, LCD_Cursor_Left); } break; case BUTTON_Right: case BUTTON_Right_B: i = lcd_getcursorpos(lcd); if (i != 0x4E) { lcd_set(lcd, LCD_Cursor_Right); i = lcd_getcursor(lcd); if (i == '.') lcd_set(lcd, LCD_Cursor_Right); } break; case BUTTON_Up: case BUTTON_Up_B: i = lcd_getcursorpos(lcd); firstdigit = 0; firstdigit = ( i == 0x40 ) || ( i == 0x44 ) || ( i == 0x48 ) || ( i == 0x4C ); i = lcd_getcursor(lcd); if (i == '9') i = '0'; else if ((i == '2') && (firstdigit)) i = '0'; else i++; lcd_setcursor(lcd, i); break; case BUTTON_Down: case BUTTON_Down_B: i = lcd_getcursorpos(lcd); firstdigit = 0; firstdigit = ( i == 0x40 ) || ( i == 0x44 ) || ( i == 0x48 ) || ( i == 0x4C ); i = lcd_getcursor(lcd); if ((i == '0') && (!firstdigit)) i = '9'; else if ((i == '0') && (firstdigit)) i = '2'; else i--; lcd_setcursor(lcd, i); break; case BUTTON_Next: case BUTTON_Next_B: break; case BUTTON_Enter: case BUTTON_Enter_B: lcd_getdisplay(lcd, NULL, NULL, &i); return i; break; } lcd_netcorrect(lcd); } if (ctr==lcd_button_sense(lcd)) { ctr=0; } } else { ctr=0; } } } static void mangle_num(char *line) { char *first = line + 1, *second = line + 2; if ( *line == '2' ) { if ( *first == '9' ) *first = '5'; else if ( *first > '5' ) *first = '0'; else if (*first == '5') { if (*second == '9') *second = '5'; else if (*second > '5') *second = '0'; } } } void lcd_netcorrect(void *lcd) { char last_address; char *line1, last_line1[LCD_CHARS_PER_LINE]; char *line2, last_line2[LCD_CHARS_PER_LINE]; last_address = lcd_getcursorpos(lcd); lcd_getdisplay(lcd, &line1, &line2, NULL); strcpy(last_line1, line1); strcpy(last_line2, line2); mangle_num(last_line2); mangle_num(last_line2 + 4); mangle_num(last_line2 + 8); mangle_num(last_line2 + 12); lcd_write(lcd, last_line1, last_line2); lcd_setcursorpos(lcd, last_address); lcd_set(lcd, LCD_Cursor_On); } cobalt-panel-utils-1.0.2/messages.h0000644000175000017500000001052410272732223016745 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * File: messages.h * Andrew Bose * */ #include #define gettext_noop(String) (String) unsigned char selstr[] = gettext_noop("SELECT: "); unsigned char sysstr[] = gettext_noop(" SYSTEM INFO "); unsigned char netstr[] = gettext_noop(" SETUP NETWORK "); unsigned char offstr[] = gettext_noop(" POWER DOWN "); unsigned char qoffstr[] = gettext_noop(" POWER DOWN? "); unsigned char rebstr[] = gettext_noop(" REBOOT "); unsigned char qrebstr[] = gettext_noop(" REBOOT? "); unsigned char resnetstr[] = gettext_noop(" RESET NETWORK "); unsigned char qresnetstr[] = gettext_noop(" RESET NETWORK? "); unsigned char resingnetstr[] = gettext_noop(" RESETTING "); unsigned char resingnetstr2[] = gettext_noop(" NETWORK "); unsigned char resfiltstr[] = gettext_noop(" RESET FILTERS "); unsigned char qresfiltstr[] = gettext_noop(" RESET FILTERS? "); unsigned char resingfiltstr[] = gettext_noop(" RESETTING "); unsigned char resingfiltstr2[] = gettext_noop(" FILTERS "); unsigned char extstr[] = gettext_noop(" EXIT "); unsigned char qextstr[] = gettext_noop(" EXIT? "); unsigned char ynstr[] = gettext_noop(" [Y]ES [N]O "); unsigned char respwstr1[] = gettext_noop("RESETTING ADMIN "); unsigned char respwstr2[] = gettext_noop(" PASSWORD "); unsigned char nullstr[] = gettext_noop(" "); unsigned char exstr[] = gettext_noop("[S]AVE/[C]ANCEL "); unsigned char finishstr[] = gettext_noop(" SAVE "); unsigned char redostr[] = gettext_noop(" EDIT "); unsigned char ipstr[] = gettext_noop("PRIMARY IP ADDR:"); unsigned char xipstr[] = gettext_noop("INVALID IP: "); unsigned char ipaddrm[] = gettext_noop("IP Address: "); unsigned char ipmess1[] = gettext_noop(" PLEASE SAVE IP "); unsigned char ipmess2[] = gettext_noop(" ADDRESS "); unsigned char gwstr[] = gettext_noop("ENTER GATEWAY: "); unsigned char xgwstr[] = gettext_noop("INVALID GATEWAY:"); unsigned char nmstr[] = gettext_noop("PRIMARY NETMASK:"); unsigned char xnmstr[] = gettext_noop("INVALID NETMASK:"); unsigned char nmmess1[] = gettext_noop(" PLEASE SAVE "); unsigned char nmmess2[] = gettext_noop(" NETMASK "); unsigned char nsstr[] = gettext_noop("ENTER DNS: "); unsigned char xnsstr[] = gettext_noop("INVALID DNS: "); unsigned char verstr[] = gettext_noop("VERIFYING: "); unsigned char savingstr[] = gettext_noop(" SAVING "); unsigned char rebootingstr[] = gettext_noop("SYSTEM REBOOTING"); unsigned char nonetstr[] = gettext_noop("NO NETWORK FOUND"); unsigned char connectstr[] = gettext_noop("[H]ALT [C]ONNECT"); unsigned char ipaddr[] = gettext_noop("000.000.000.000"); unsigned char fipaddr[] = gettext_noop("000.000.000.000"); unsigned char gwaddr[] = gettext_noop("000.000.000.000"); unsigned char fgwaddr[] = gettext_noop("000.000.000.000"); unsigned char nsaddr[] = gettext_noop("000.000.000.000"); unsigned char fnsaddr[] = gettext_noop("000.000.000.000"); unsigned char noip[] = gettext_noop("000.000.000.000"); unsigned char defmaskA[] = gettext_noop("255.000.000.000"); unsigned char defmaskB[] = gettext_noop("255.255.000.000"); unsigned char defmaskC[] = gettext_noop("255.255.255.000"); unsigned char defmask[] = gettext_noop("255.255.255.000"); unsigned char fdefmask[] = gettext_noop("255.255.255.000"); cobalt-panel-utils-1.0.2/lcd.h0000644000175000017500000001202210272731553015700 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. * * File: lcd.h * Andrew Bose */ #ifndef LCD_H #define LCD_H 1 // function headers #define RET_YES 1 #define RET_NO 2 #define RET_TIMEOUT 3 #define CURSOR_YES 0x43 #define CURSOR_NO 0x4a #define CURSOR_CANCEL_POS 0x08 #define LCD_CHARS_PER_LINE 40 #define FLASH_SIZE 524288 #define MAX_IDLE_TIME 120 struct lcd_display { unsigned long buttons; int size1; int size2; unsigned char line1[LCD_CHARS_PER_LINE]; unsigned char line2[LCD_CHARS_PER_LINE]; unsigned char cursor_address; unsigned char character; unsigned char leds; unsigned char *RomImage; }; #define LCD_DRIVER "Cobalt LCD Driver v2.10" #define kLCD_IR 0xBF000000 #define kLCD_DR 0xBF000010 #define kGPI 0xBD000000 #define kLED 0xBC000000 #define kDD_R00 0x00 #define kDD_R01 0x27 #define kDD_R10 0x40 #define kDD_R11 0x67 #define kLCD_Addr 0x00000080 #define LCDTimeoutValue 0xfff // Flash definitions AMD 29F040 #define kFlashBase 0xBFC00000 #define kFlash_Addr1 0x5555 #define kFlash_Addr2 0x2AAA #define kFlash_Data1 0xAA #define kFlash_Data2 0x55 #define kFlash_Prog 0xA0 #define kFlash_Erase3 0x80 #define kFlash_Erase6 0x10 #define kFlash_Read 0xF0 #define kFlash_ID 0x90 #define kFlash_VenAddr 0x00 #define kFlash_DevAddr 0x01 #define kFlash_VenID 0x01 #define kFlash_DevID 0xA4 // 29F040 //#define kFlash_DevID 0xAD // 29F016 // Macros #define LCDWriteData(x) (*(volatile unsigned long *) kLCD_DR) = (x << 24) #define LCDWriteInst(x) (*(volatile unsigned long *) kLCD_IR) = (x << 24) #define LCDReadData (((*(volatile unsigned long *) kLCD_DR) >> 24)) #define LCDReadInst (((*(volatile unsigned long *) kLCD_IR) >> 24)) #define GPIRead (( (*(volatile unsigned long *) kGPI) >> 24)) #define LEDSet(x) (*(volatile unsigned char *) kLED) = ((char)x) #define WRITE_GAL(x,y) (*((volatile unsigned long *) (0xB4000000 | (x)) ) =y) #define BusyCheck() while ((LCDReadInst & 0x80) == 0x80) #define WRITE_FLASH(x,y) (*((volatile unsigned char *) (kFlashBase | (x)) ) = y) #define READ_FLASH(x) *((volatile unsigned char *) (kFlashBase | (x)) ) // Function command codes for io_ctl. #define LCD_On 1 #define LCD_Off 2 #define LCD_Clear 3 #define LCD_Reset 4 #define LCD_Cursor_Left 5 #define LCD_Cursor_Right 6 #define LCD_Disp_Left 7 #define LCD_Disp_Right 8 #define LCD_Get_Cursor 9 #define LCD_Set_Cursor 10 #define LCD_Home 11 #define LCD_Read 12 #define LCD_Write 13 #define LCD_Cursor_Off 14 #define LCD_Cursor_On 15 #define LCD_Get_Cursor_Pos 16 #define LCD_Set_Cursor_Pos 17 #define LCD_Blink_Off 18 #define LCD_Raw_Inst 19 #define LCD_Raw_Data 20 #define LCD_Type 21 #define LED_Set 40 #define LED_Bit_Set 41 #define LED_Bit_Clear 42 #define LED32_Set 43 #define LED32_Bit_Set 44 #define LED32_Bit_Clear 45 // Button defs #define BUTTON_Read 50 // Flash command codes #define FLASH_Erase 60 #define FLASH_Burn 61 #define FLASH_Read 62 // Ethernet LINK check hackaroo #define LINK_Check 90 #define LINK_Check_2 91 // Button patterns _B - single layer lcd boards #define BUTTON_NONE 0x3F #define BUTTON_NONE_B 0xFE #define BUTTON_Left 0x3B #define BUTTON_Left_B 0xFA #define BUTTON_Right 0x37 #define BUTTON_Right_B 0xDE #define BUTTON_Up 0x2F #define BUTTON_Up_B 0xF6 #define BUTTON_Down 0x1F #define BUTTON_Down_B 0xEE #define BUTTON_Next 0x3D #define BUTTON_Next_B 0x7E #define BUTTON_Enter 0x3E #define BUTTON_Enter_B 0xBE #define BUTTON_Reset_B 0xFC #define BUTTON_Power 0x01 // Debounce constants #define I2C_BUTTON_SENSE 10 #define I2C_BUTTON_DEBOUNCE 3 #define PARALLEL_BUTTON_SENSE 160000 #define PARALLEL_BUTTON_DEBOUNCE 5000 // LCD types #define LCD_TYPE_UNKNOWN 0 #define LCD_TYPE_PARALLEL 1 #define LCD_TYPE_PARALLEL_B 2 #define LCD_TYPE_I2C 3 // Galileo register stuff #define kGal_DevBank2Cfg 0x1466DB33 #define kGal_DevBank2PReg 0x464 #define kGal_DevBank3Cfg 0x146FDFFB #define kGal_DevBank3PReg 0x468 // Network #define kIPADDR 1 #define kNETMASK 2 #define kGATEWAY 3 #define kDNS 4 #define kClassA 5 #define kClassB 6 #define kClassC 7 #endif /* lcd.h */ cobalt-panel-utils-1.0.2/lcdutils.h0000644000175000017500000000477310272731567017004 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU Lesser General Public License, Version 2.1, * February 1999, which is contained in the read-me file named * "README_GNU_LGPL." This library is free software; you can * redistribute it and/or modify it under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your * option) any later version. This library is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA. */ #ifndef LCDUTILS_H #define LCDUTILS_H 1 #include #include #include /* locking bits */ extern int lcd_lock(void); extern void lcd_unlock(void); /* locale setting */ extern void lcd_setlocale(void); /* button settings */ extern int lcd_button_debounce(void *); extern int lcd_button_sense(void *); /* timeout facilities */ extern int lcd_timeout_start(void (*)(const int), const int); extern void lcd_timeout_stop(void); extern int lcd_timeout_reset(void); /* display and writing utils */ extern void *lcd_open(const int); extern int lcd_write(void *, const char *, const char *); extern void lcd_wait_no_button(void *); extern void lcd_blink_invalid(void *); extern void lcd_spin(void *, const char *, const char *); extern void lcd_close(void *); extern int lcd_setleds(void *, const int); extern void lcd_reset(void *); extern void lcd_set(void *, const int); /* cursor utilities */ extern void lcd_setcursorpos(void *, unsigned char); extern void lcd_setcursor(void *, unsigned char); extern int lcd_getcursorpos(void *); extern int lcd_getcursor(void *); extern int lcd_movecursor(void *, const int); /* link utilities */ extern int lcd_checklink(void *); extern int lcd_checklink2(void *, int *); /* reading utilities */ extern int lcd_getdisplay(void *, char **, char **, int *); extern int lcd_readbutton(void *); extern int lcd_getbutton(void *); /* net utilities */ extern void lcd_netcorrect(void *); extern int lcd_netbutton(void *); extern void lcd_rev_format(char *); #ifndef _ #define _(mesg) gettext((mesg)) #endif #endif cobalt-panel-utils-1.0.2/lcd-write.c0000644000175000017500000000312110272730430017014 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "lcdutils.h" int main(int argc, char **argv) { void *lcd; int silent; silent = (((argc > 1) && strcmp(argv[1], "-s") == 0)) ? 1 : 0; lcd_setlocale(); if (!silent && (lcd_lock() < 0)) { printf(_("LCD in use... try again later\n")); exit(0); } if (argc <= 1 + silent) { printf(_("Please pass text to display\n")); lcd_unlock(); exit(0); } if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); } else { lcd_reset(lcd); lcd_write(lcd, argv[1 + silent], (argc > 2 + silent) ? argv[2 + silent] : NULL); lcd_close(lcd); } if (!silent) lcd_unlock(); exit(0); } cobalt-panel-utils-1.0.2/lcd-yesno.c0000644000175000017500000000731710272730427017040 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "lcd.h" #include "lcdutils.h" void timeout_handler(int sig) { exit(RET_TIMEOUT); } int main(int argc, char *argv[]) { void *lcd; int silent = 0; char line1[40], line2[40]; int button, address; int ctr=0; int i, j; int yes_adr = 0; int no_adr = 0; int spots[10]; int args = argc; char **vp = &argv[0]; lcd_setlocale(); while (--args > 0) { vp++; if ((**vp) != '-') break; switch (*((*vp)+1)) { case 'y': vp++; args--; sscanf(*vp,"%x",&yes_adr); break; case 'n': vp++; args--; sscanf(*vp,"%x",&no_adr); break; case '1': vp++; args--; strcpy(line1,*vp); break; case '2': vp++; args--; strcpy(line2,*vp); break; case 's': silent++; break; case 'h': printf(_("Usage: %s [-y ] [-n ] [-1 ] [-2 ]\n"),argv[0]); exit(0); default: printf(_("Unknown switch %s\n"),*vp); exit(0); } } if (!silent && (lcd_lock() < 0)) { printf(_("LCD in use... try again later\n")); exit(0); } strcpy(line1, _("Is this Correct?")); strcpy(line2, _(" [Y]ES [N]O ")); if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); exit(0); } memset(spots, 0, sizeof(spots)); j = 0; for (i=0; i<14; i++) { if (line1[i] == '[' && line1[i+2] == ']') { spots[j++] = i + kDD_R00 + 1; } } for (i=0; i<14; i++) { if (line2[i] == '[' && line2[i+2] == ']') { spots[j++] = i + kDD_R10 + 1; } } if (yes_adr == 0) { if (spots[0] != 0) { yes_adr = spots[0]; } else { yes_adr = CURSOR_YES; } } if (no_adr == 0) { if (spots[1] != 0) { no_adr = spots[1]; } else { no_adr = CURSOR_NO; } } lcd_reset(lcd); ctr=0; lcd_write(lcd, line1, line2); lcd_set(lcd, LCD_Cursor_On); lcd_setcursorpos(lcd, no_adr); while( 1 ) { lcd_timeout_start(timeout_handler, MAX_IDLE_TIME); button = lcd_readbutton(lcd) & 0x00FF; if ( (button != BUTTON_NONE) && (button != BUTTON_NONE_B) ) { ctr++; if ( (ctr==lcd_button_debounce(lcd)) ) { lcd_timeout_stop(); switch (button) { case BUTTON_Next: case BUTTON_Next_B: case BUTTON_Up: case BUTTON_Up_B: case BUTTON_Down: case BUTTON_Down_B: case BUTTON_Left: case BUTTON_Left_B: case BUTTON_Right: case BUTTON_Right_B: address = lcd_getcursorpos(lcd); lcd_setcursorpos(lcd, address == no_adr ? yes_adr : no_adr); break; case BUTTON_Enter: case BUTTON_Enter_B: address = lcd_getcursorpos(lcd); lcd_close(lcd); if (!silent) lcd_unlock(); exit((address == yes_adr) ? RET_YES : RET_NO); break; } } if (ctr==lcd_button_sense(lcd)) { ctr=0; } } else { ctr=0; } } } cobalt-panel-utils-1.0.2/readbutton.c0000644000175000017500000000260010272730426017277 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include "lcd.h" #include "lcdutils.h" int main (int argc, char **argv) { void *lcd; int button = BUTTON_NONE; lcd_setlocale(); if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); exit(0); } button = lcd_readbutton(lcd) & 0x00FF; lcd_close(lcd); if ((button == BUTTON_NONE) || (button == BUTTON_NONE_B)) exit(0); exit(button); } cobalt-panel-utils-1.0.2/lcd-swrite.c0000644000175000017500000000311710272730430017204 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "lcdutils.h" int main(int argc, char **argv) { void *lcd; int silent; silent = (((argc > 1) && strcmp(argv[1], "-s") == 0)) ? 1 : 0; lcd_setlocale(); if (!silent && (lcd_lock() < 0)) { printf(_("LCD in use... try again later\n")); exit(0); } if (argc <= 1 + silent) { printf(_("Please pass text to display\n")); lcd_unlock(); exit(0); } if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); } else { lcd_reset(lcd); lcd_spin(lcd, argv[1 + silent], (argc > 2 + silent) ? argv[2 + silent] : NULL); } lcd_close(lcd); if (!silent) lcd_unlock(); exit(0); } cobalt-panel-utils-1.0.2/lcd-setcursor.c0000644000175000017500000000357410272730431017730 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include "lcd.h" #include "lcdutils.h" int main(int argc, char **argv) { void *lcd; int c, row, column; unsigned char address; row = -1; column = -1; lcd_setlocale(); if (argc < 2) { printf(_("Usage: %s \n"),argv[0]); exit(0); } for (c = 1; c < argc; c++) { if (c == 1) row = atoi(argv[c]); if (c == 2) column = atoi(argv[c]); } if ((row < 1) || (row > 2) || (column < 1) || (column > 16)) { printf(_("Usage: %s \n"),argv[0]); exit(0); } address = ((unsigned char) row - 1) * 64; address += (unsigned char) column - 1; if (lcd_lock() < 0) { printf(_("LCD in use... try again later\n")); exit(0); } if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); exit(0); } lcd_set(lcd, LCD_Cursor_On); lcd_setcursorpos(lcd, address); lcd_close(lcd); lcd_unlock(); exit(0); } cobalt-panel-utils-1.0.2/iflink.c0000644000175000017500000000242510272730435016411 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include "lcdutils.h" int main (int argc, char **argv) { void *lcd; int ctr; lcd_setlocale(); if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); exit(0); } ctr = lcd_checklink(lcd);; lcd_close(lcd); if (ctr) { printf(_("No Link Detected\n")); exit(0); } printf(_("Link Detected\n")); exit(1); } cobalt-panel-utils-1.0.2/lcd-flash.c0000644000175000017500000000275010272730433016771 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "lcdutils.h" int main(int argc, char **argv) { void *lcd; int silent; silent = (((argc > 1) && strcmp(argv[1], "-s") == 0)) ? 1 : 0; lcd_setlocale(); if (!silent && (lcd_lock() < 0)) { printf(_("LCD in use... try again later\n")); exit(0); } if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); lcd_close(lcd); if (!silent) lcd_unlock(); exit(0); } lcd_wait_no_button(lcd); lcd_blink_invalid(lcd); lcd_close(lcd); if (!silent) lcd_unlock(); exit(0); } cobalt-panel-utils-1.0.2/lcd-getip.c0000644000175000017500000000516010272730432017001 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include #include "lcd.h" #include "lcdutils.h" /* FIXME - timeout needed */ #define OPTIONS "sh1:i:" int main(int argc, char **argv) { void *lcd; int one, two, three, four, c, silent = 0; char *line, ipstr[17], ipaddr[17]; extern char *optarg; extern int opterr; opterr = 0; /* make getopt quiet */ lcd_setlocale(); strcpy(ipaddr, "000.000.000.000"); strcpy(ipstr, _("PRIMARY IP ADDR:")); /* we silently ignore bad options. so, only -h returns usage. */ while ((c = getopt(argc, argv, OPTIONS)) != EOF) { switch (c) { case 's': silent++; break; case '1': strncpy(ipstr, optarg, sizeof(ipstr) - 1); break; case 'i': strncpy(ipaddr, optarg, sizeof(ipaddr) - 1); lcd_rev_format(ipaddr); break; case 'h': printf(_("Usage: %s [-1 ] [-i ]\n"),argv[0]); exit(0); break; default: break; } } if (!silent && (lcd_lock() < 0)) { printf(_("LCD in use... try again later\n")); exit(0); } if ((lcd = lcd_open(O_RDWR)) == NULL) { printf(_("LCD is not present\n")); exit(0); } lcd_reset(lcd); lcd_set(lcd, LCD_Blink_Off); lcd_wait_no_button(lcd); lcd_write(lcd, ipstr, ipaddr); lcd_setcursorpos(lcd, 0x40); lcd_wait_no_button(lcd); lcd_netbutton(lcd); lcd_getdisplay(lcd, NULL, &line, NULL); strncpy( ipaddr, line, 15 ); lcd_close(lcd); if (!silent) lcd_unlock(); sscanf(ipaddr,"%d.%d.%d.%d", &one, &two, &three, &four); if (one > 255) one = 0; if (two > 255) two = 0; if (three > 255) three = 0; if (four > 255) four = 0; printf("%d.%d.%d.%d",one,two,three,four); exit(0); } cobalt-panel-utils-1.0.2/iflinkstatus.c0000644000175000017500000000303410272730434017651 0ustar gandalfgandalf/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Use is subject to the GNU General Public License, Version 2, * June 1991, which is contained in the read-me file named * "README_GNU_GPL." 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 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 General Public License for * more details. * * You should have received a copy of the GNU 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. */ #include #include "lcd.h" #include "lcdutils.h" /* linkstatus.c * Returns the link status of eth0 and eth1 * 0 - both links down * 1 - eth0 UP, eth1 DOWN * 2 - eth0 DOWN, eth1 UP * 3 - eth0 UP, eth1 UP * */ int main (int argc, char **argv) { void *lcd; int button, err, status; status = 0; lcd_setlocale(); if ((lcd = lcd_open(O_RDWR)) == NULL) exit(0); button = 1; if (lcd_checklink2(lcd, &button) < 0) exit(0); if (button) status++; button = 0; if (lcd_checklink2(lcd, &button) < 0) exit(0); if (button) status += 2; printf("%d",status); lcd_close(lcd); exit(status); } cobalt-panel-utils-1.0.2/Makefile0000644000175000017500000000243210273252561016427 0ustar gandalfgandalf# # Makefile for creating LED and LCD utilities # BINDIR = $(PREFIX)/sbin INSTALL = install CHMOD = chmod CHOWN = chown LINGUAS = ja_JP LOCALEDIR = $(PREFIX)/usr/share/locale ETC = $(PREFIX)/etc RCD = $(PREFIX)/etc/init.d LIB = lib/liblcd.a SRCS = lcd-write.c lcd-swrite.c lcd-yesno.c lcd-setcursor.c \ lcd-getip.c lcd-flash.c readbutton.c iflink.c iflinkstatus.c OBJS := $(SRCS:.c=.o) PROG := $(OBJS:.o=) DEBUG = -g -Wall COPTS = -O2 CFLAGS = $(COPTS) $(COPTFLAGS) #$(DEBUG) LIBS = -llcd LDFLAGS = $(STATIC) -L./lib all: library $(PROG) library: $(MAKE) -C lib COPTFLAGS=$(COPTFLAGS) $(OBJS): lcdutils.h ${LIB}: library lcd-write: lcd-write.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) lcd-swrite: lcd-swrite.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) lcd-yesno: lcd-yesno.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) lcd-setcursor: lcd-setcursor.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) lcd-getip: lcd-getip.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) lcd-flash: lcd-flash.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) readbutton: readbutton.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) iflink: iflink.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) iflinkstatus: iflinkstatus.o $(LIB) $(CC) $(LDFLAGS) $< -o $@ $(LIBS) clean: $(MAKE) -C lib clean -rm -f $(OBJS) $(PROG) *~ TAGS