Commit 59c5f9e107b6df36d60eb9684c7f23b53d8b333e

Authored by Silvan Calarco
0 parents
Exists in master

Initial commit (release 0.3.25)

Showing 15 changed files with 1280 additions and 0 deletions Side-by-side Diff

... ... @@ -0,0 +1,340 @@
  1 + GNU GENERAL PUBLIC LICENSE
  2 + Version 2, June 1991
  3 +
  4 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  5 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6 + Everyone is permitted to copy and distribute verbatim copies
  7 + of this license document, but changing it is not allowed.
  8 +
  9 + Preamble
  10 +
  11 + The licenses for most software are designed to take away your
  12 +freedom to share and change it. By contrast, the GNU General Public
  13 +License is intended to guarantee your freedom to share and change free
  14 +software--to make sure the software is free for all its users. This
  15 +General Public License applies to most of the Free Software
  16 +Foundation's software and to any other program whose authors commit to
  17 +using it. (Some other Free Software Foundation software is covered by
  18 +the GNU Library General Public License instead.) You can apply it to
  19 +your programs, too.
  20 +
  21 + When we speak of free software, we are referring to freedom, not
  22 +price. Our General Public Licenses are designed to make sure that you
  23 +have the freedom to distribute copies of free software (and charge for
  24 +this service if you wish), that you receive source code or can get it
  25 +if you want it, that you can change the software or use pieces of it
  26 +in new free programs; and that you know you can do these things.
  27 +
  28 + To protect your rights, we need to make restrictions that forbid
  29 +anyone to deny you these rights or to ask you to surrender the rights.
  30 +These restrictions translate to certain responsibilities for you if you
  31 +distribute copies of the software, or if you modify it.
  32 +
  33 + For example, if you distribute copies of such a program, whether
  34 +gratis or for a fee, you must give the recipients all the rights that
  35 +you have. You must make sure that they, too, receive or can get the
  36 +source code. And you must show them these terms so they know their
  37 +rights.
  38 +
  39 + We protect your rights with two steps: (1) copyright the software, and
  40 +(2) offer you this license which gives you legal permission to copy,
  41 +distribute and/or modify the software.
  42 +
  43 + Also, for each author's protection and ours, we want to make certain
  44 +that everyone understands that there is no warranty for this free
  45 +software. If the software is modified by someone else and passed on, we
  46 +want its recipients to know that what they have is not the original, so
  47 +that any problems introduced by others will not reflect on the original
  48 +authors' reputations.
  49 +
  50 + Finally, any free program is threatened constantly by software
  51 +patents. We wish to avoid the danger that redistributors of a free
  52 +program will individually obtain patent licenses, in effect making the
  53 +program proprietary. To prevent this, we have made it clear that any
  54 +patent must be licensed for everyone's free use or not licensed at all.
  55 +
  56 + The precise terms and conditions for copying, distribution and
  57 +modification follow.
  58 +
  59 + GNU GENERAL PUBLIC LICENSE
  60 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  61 +
  62 + 0. This License applies to any program or other work which contains
  63 +a notice placed by the copyright holder saying it may be distributed
  64 +under the terms of this General Public License. The "Program", below,
  65 +refers to any such program or work, and a "work based on the Program"
  66 +means either the Program or any derivative work under copyright law:
  67 +that is to say, a work containing the Program or a portion of it,
  68 +either verbatim or with modifications and/or translated into another
  69 +language. (Hereinafter, translation is included without limitation in
  70 +the term "modification".) Each licensee is addressed as "you".
  71 +
  72 +Activities other than copying, distribution and modification are not
  73 +covered by this License; they are outside its scope. The act of
  74 +running the Program is not restricted, and the output from the Program
  75 +is covered only if its contents constitute a work based on the
  76 +Program (independent of having been made by running the Program).
  77 +Whether that is true depends on what the Program does.
  78 +
  79 + 1. You may copy and distribute verbatim copies of the Program's
  80 +source code as you receive it, in any medium, provided that you
  81 +conspicuously and appropriately publish on each copy an appropriate
  82 +copyright notice and disclaimer of warranty; keep intact all the
  83 +notices that refer to this License and to the absence of any warranty;
  84 +and give any other recipients of the Program a copy of this License
  85 +along with the Program.
  86 +
  87 +You may charge a fee for the physical act of transferring a copy, and
  88 +you may at your option offer warranty protection in exchange for a fee.
  89 +
  90 + 2. You may modify your copy or copies of the Program or any portion
  91 +of it, thus forming a work based on the Program, and copy and
  92 +distribute such modifications or work under the terms of Section 1
  93 +above, provided that you also meet all of these conditions:
  94 +
  95 + a) You must cause the modified files to carry prominent notices
  96 + stating that you changed the files and the date of any change.
  97 +
  98 + b) You must cause any work that you distribute or publish, that in
  99 + whole or in part contains or is derived from the Program or any
  100 + part thereof, to be licensed as a whole at no charge to all third
  101 + parties under the terms of this License.
  102 +
  103 + c) If the modified program normally reads commands interactively
  104 + when run, you must cause it, when started running for such
  105 + interactive use in the most ordinary way, to print or display an
  106 + announcement including an appropriate copyright notice and a
  107 + notice that there is no warranty (or else, saying that you provide
  108 + a warranty) and that users may redistribute the program under
  109 + these conditions, and telling the user how to view a copy of this
  110 + License. (Exception: if the Program itself is interactive but
  111 + does not normally print such an announcement, your work based on
  112 + the Program is not required to print an announcement.)
  113 +
  114 +These requirements apply to the modified work as a whole. If
  115 +identifiable sections of that work are not derived from the Program,
  116 +and can be reasonably considered independent and separate works in
  117 +themselves, then this License, and its terms, do not apply to those
  118 +sections when you distribute them as separate works. But when you
  119 +distribute the same sections as part of a whole which is a work based
  120 +on the Program, the distribution of the whole must be on the terms of
  121 +this License, whose permissions for other licensees extend to the
  122 +entire whole, and thus to each and every part regardless of who wrote it.
  123 +
  124 +Thus, it is not the intent of this section to claim rights or contest
  125 +your rights to work written entirely by you; rather, the intent is to
  126 +exercise the right to control the distribution of derivative or
  127 +collective works based on the Program.
  128 +
  129 +In addition, mere aggregation of another work not based on the Program
  130 +with the Program (or with a work based on the Program) on a volume of
  131 +a storage or distribution medium does not bring the other work under
  132 +the scope of this License.
  133 +
  134 + 3. You may copy and distribute the Program (or a work based on it,
  135 +under Section 2) in object code or executable form under the terms of
  136 +Sections 1 and 2 above provided that you also do one of the following:
  137 +
  138 + a) Accompany it with the complete corresponding machine-readable
  139 + source code, which must be distributed under the terms of Sections
  140 + 1 and 2 above on a medium customarily used for software interchange; or,
  141 +
  142 + b) Accompany it with a written offer, valid for at least three
  143 + years, to give any third party, for a charge no more than your
  144 + cost of physically performing source distribution, a complete
  145 + machine-readable copy of the corresponding source code, to be
  146 + distributed under the terms of Sections 1 and 2 above on a medium
  147 + customarily used for software interchange; or,
  148 +
  149 + c) Accompany it with the information you received as to the offer
  150 + to distribute corresponding source code. (This alternative is
  151 + allowed only for noncommercial distribution and only if you
  152 + received the program in object code or executable form with such
  153 + an offer, in accord with Subsection b above.)
  154 +
  155 +The source code for a work means the preferred form of the work for
  156 +making modifications to it. For an executable work, complete source
  157 +code means all the source code for all modules it contains, plus any
  158 +associated interface definition files, plus the scripts used to
  159 +control compilation and installation of the executable. However, as a
  160 +special exception, the source code distributed need not include
  161 +anything that is normally distributed (in either source or binary
  162 +form) with the major components (compiler, kernel, and so on) of the
  163 +operating system on which the executable runs, unless that component
  164 +itself accompanies the executable.
  165 +
  166 +If distribution of executable or object code is made by offering
  167 +access to copy from a designated place, then offering equivalent
  168 +access to copy the source code from the same place counts as
  169 +distribution of the source code, even though third parties are not
  170 +compelled to copy the source along with the object code.
  171 +
  172 + 4. You may not copy, modify, sublicense, or distribute the Program
  173 +except as expressly provided under this License. Any attempt
  174 +otherwise to copy, modify, sublicense or distribute the Program is
  175 +void, and will automatically terminate your rights under this License.
  176 +However, parties who have received copies, or rights, from you under
  177 +this License will not have their licenses terminated so long as such
  178 +parties remain in full compliance.
  179 +
  180 + 5. You are not required to accept this License, since you have not
  181 +signed it. However, nothing else grants you permission to modify or
  182 +distribute the Program or its derivative works. These actions are
  183 +prohibited by law if you do not accept this License. Therefore, by
  184 +modifying or distributing the Program (or any work based on the
  185 +Program), you indicate your acceptance of this License to do so, and
  186 +all its terms and conditions for copying, distributing or modifying
  187 +the Program or works based on it.
  188 +
  189 + 6. Each time you redistribute the Program (or any work based on the
  190 +Program), the recipient automatically receives a license from the
  191 +original licensor to copy, distribute or modify the Program subject to
  192 +these terms and conditions. You may not impose any further
  193 +restrictions on the recipients' exercise of the rights granted herein.
  194 +You are not responsible for enforcing compliance by third parties to
  195 +this License.
  196 +
  197 + 7. If, as a consequence of a court judgment or allegation of patent
  198 +infringement or for any other reason (not limited to patent issues),
  199 +conditions are imposed on you (whether by court order, agreement or
  200 +otherwise) that contradict the conditions of this License, they do not
  201 +excuse you from the conditions of this License. If you cannot
  202 +distribute so as to satisfy simultaneously your obligations under this
  203 +License and any other pertinent obligations, then as a consequence you
  204 +may not distribute the Program at all. For example, if a patent
  205 +license would not permit royalty-free redistribution of the Program by
  206 +all those who receive copies directly or indirectly through you, then
  207 +the only way you could satisfy both it and this License would be to
  208 +refrain entirely from distribution of the Program.
  209 +
  210 +If any portion of this section is held invalid or unenforceable under
  211 +any particular circumstance, the balance of the section is intended to
  212 +apply and the section as a whole is intended to apply in other
  213 +circumstances.
  214 +
  215 +It is not the purpose of this section to induce you to infringe any
  216 +patents or other property right claims or to contest validity of any
  217 +such claims; this section has the sole purpose of protecting the
  218 +integrity of the free software distribution system, which is
  219 +implemented by public license practices. Many people have made
  220 +generous contributions to the wide range of software distributed
  221 +through that system in reliance on consistent application of that
  222 +system; it is up to the author/donor to decide if he or she is willing
  223 +to distribute software through any other system and a licensee cannot
  224 +impose that choice.
  225 +
  226 +This section is intended to make thoroughly clear what is believed to
  227 +be a consequence of the rest of this License.
  228 +
  229 + 8. If the distribution and/or use of the Program is restricted in
  230 +certain countries either by patents or by copyrighted interfaces, the
  231 +original copyright holder who places the Program under this License
  232 +may add an explicit geographical distribution limitation excluding
  233 +those countries, so that distribution is permitted only in or among
  234 +countries not thus excluded. In such case, this License incorporates
  235 +the limitation as if written in the body of this License.
  236 +
  237 + 9. The Free Software Foundation may publish revised and/or new versions
  238 +of the General Public License from time to time. Such new versions will
  239 +be similar in spirit to the present version, but may differ in detail to
  240 +address new problems or concerns.
  241 +
  242 +Each version is given a distinguishing version number. If the Program
  243 +specifies a version number of this License which applies to it and "any
  244 +later version", you have the option of following the terms and conditions
  245 +either of that version or of any later version published by the Free
  246 +Software Foundation. If the Program does not specify a version number of
  247 +this License, you may choose any version ever published by the Free Software
  248 +Foundation.
  249 +
  250 + 10. If you wish to incorporate parts of the Program into other free
  251 +programs whose distribution conditions are different, write to the author
  252 +to ask for permission. For software which is copyrighted by the Free
  253 +Software Foundation, write to the Free Software Foundation; we sometimes
  254 +make exceptions for this. Our decision will be guided by the two goals
  255 +of preserving the free status of all derivatives of our free software and
  256 +of promoting the sharing and reuse of software generally.
  257 +
  258 + NO WARRANTY
  259 +
  260 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  261 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
  262 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  263 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  264 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  265 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
  266 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
  267 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  268 +REPAIR OR CORRECTION.
  269 +
  270 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  271 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  272 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  273 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  274 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  275 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  276 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  277 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  278 +POSSIBILITY OF SUCH DAMAGES.
  279 +
  280 + END OF TERMS AND CONDITIONS
  281 +
  282 + How to Apply These Terms to Your New Programs
  283 +
  284 + If you develop a new program, and you want it to be of the greatest
  285 +possible use to the public, the best way to achieve this is to make it
  286 +free software which everyone can redistribute and change under these terms.
  287 +
  288 + To do so, attach the following notices to the program. It is safest
  289 +to attach them to the start of each source file to most effectively
  290 +convey the exclusion of warranty; and each file should have at least
  291 +the "copyright" line and a pointer to where the full notice is found.
  292 +
  293 + <one line to give the program's name and a brief idea of what it does.>
  294 + Copyright (C) <year> <name of author>
  295 +
  296 + This program is free software; you can redistribute it and/or modify
  297 + it under the terms of the GNU General Public License as published by
  298 + the Free Software Foundation; either version 2 of the License, or
  299 + (at your option) any later version.
  300 +
  301 + This program is distributed in the hope that it will be useful,
  302 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  303 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  304 + GNU General Public License for more details.
  305 +
  306 + You should have received a copy of the GNU General Public License
  307 + along with this program; if not, write to the Free Software
  308 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  309 +
  310 +
  311 +Also add information on how to contact you by electronic and paper mail.
  312 +
  313 +If the program is interactive, make it output a short notice like this
  314 +when it starts in an interactive mode:
  315 +
  316 + Gnomovision version 69, Copyright (C) year name of author
  317 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  318 + This is free software, and you are welcome to redistribute it
  319 + under certain conditions; type `show c' for details.
  320 +
  321 +The hypothetical commands `show w' and `show c' should show the appropriate
  322 +parts of the General Public License. Of course, the commands you use may
  323 +be called something other than `show w' and `show c'; they could even be
  324 +mouse-clicks or menu items--whatever suits your program.
  325 +
  326 +You should also get your employer (if you work as a programmer) or your
  327 +school, if any, to sign a "copyright disclaimer" for the program, if
  328 +necessary. Here is a sample; alter the names:
  329 +
  330 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  331 + `Gnomovision' (which makes passes at compilers) written by James Hacker.
  332 +
  333 + <signature of Ty Coon>, 1 April 1989
  334 + Ty Coon, President of Vice
  335 +
  336 +This General Public License does not permit incorporating your program into
  337 +proprietary programs. If your program is a subroutine library, you may
  338 +consider it more useful to permit linking proprietary applications with the
  339 +library. If this is what you want to do, use the GNU Library General
  340 +Public License instead of this License.
... ... @@ -0,0 +1,115 @@
  1 +2012-01-21 0.3.25 Silvan Calarco <silvan.calarco@mambasoft.it>
  2 + - initscript:
  3 + - load applesmc module
  4 + - macbook-lightd:
  5 + - check for sensor file existence or exit
  6 +
  7 +2011-09-01 0.3.24 Silvan Calarco <silvan.calarco@mambasoft.it>
  8 + - initscript:
  9 + - configure it-macbook in /etc/vconsole.conf when Apple computer is detected;
  10 + - remove it-macbook KEYMAP configuration for non Apple computers
  11 +
  12 +2009-08-03 0.3.23 Silvan Calarco <silvan.calarco@mambasoft.it>
  13 + - macbook-lightd: small fix to algorithm
  14 +
  15 +2009-07-25 0.3.22 Silvan Calarco <silvan.calarco@mambasoft.it>
  16 + - modprobe.conf.d/macbook: install as /etc/modprobe.d/macbook.conf
  17 +
  18 +2009-06-29 0.3.21 Silvan Calarco <silvan.calarco@mambasoft.it>
  19 + - initscript: redirect macbook-light output to fix multithreaded init lockup
  20 +
  21 +2009-06-23 0.3.20 Silvan Calarco <silvan.calarco@mambasoft.it>:
  22 + - initscript: disabled LCD backlight setting (managed by HAL/KDE)
  23 + - macbook-lightd: modified and re-enabled in initscript
  24 +
  25 +2009-02-24 0.3.19 Silvan Calarco <silvan.calarco@mambasoft.it>:
  26 + - modprobe.conf.d/macbook: st fnmode for hid_apple not for hid (kernel 2.6.28)
  27 +
  28 +2008-04-14 0.3.18 Silvan Calarco <silvan.calarco@mambasoft.it>:
  29 + - isight-firmware-loaded: removed as it is now provided by external package
  30 +
  31 +2008-03-09 0.3.17 Silvan Calarco <silvan.calarco@mambasoft.it>:
  32 + - initscript: fix check for SYSTEM_MANUFACTURER against new postplug
  33 +
  34 +2008-02-01 0.3.16 Silvan Calarco <silvan.calarco@mambasoft.it>:
  35 + - macbook-set-input: don't execute xbindkeys and xmodmap as they are
  36 + now handled by xbindkeys-start
  37 + - initscript: use /etc/sysconfig/machine to detect manufacturer
  38 +
  39 +2008-01-08 0.3.15 Silvan Calarco <silvan.calarco@mambasoft.it>:
  40 + - Makefile: build statically against libpci
  41 +
  42 +2007-11-10 0.3.14 Silvan Calarco <silvan.calarco@mambasoft.it>:
  43 + - initscript: remove mapping of <SUPER> button to central mouse key
  44 +
  45 +2007-09-12 0.3.13 Silvan Calarco <silvan.calarco@mambasoft.it>:
  46 + - initscripts: replace loading of module speedstep-centrino (obsolete)
  47 + with acpi_cpufreqd
  48 +
  49 +2007-09-10 0.3.12 Silvan Calarco <silvan.calarco@mambasoft.it>:
  50 + - swapped right-Apple and numpad enter association (respectively they
  51 + are now ISO_Level3_Shift and right mouse key
  52 +
  53 +2007-08-31 0.3.11 Silvan Calarco <silvan.calarco@mambasoft.it>:
  54 + - initscript: set mause button emulation to apple keys
  55 + - modprobe: enable pb_fnmode=2 option of hid module
  56 + - macbook_set_input: xprofile script moved to /usr/bin/macbook_set_input
  57 + and called by kde autostart desktop file
  58 +
  59 +2007-08-15 0.3.10 Silvan Calarco <silvan.calarco@mambasoft.it>:
  60 + - initscript: don't install suid root
  61 +
  62 +2007-08-06 0.3.9 Silvan Calarco <silvan.calarco@mambasoft.it>:
  63 + - initscript: load specific modules here instead of /etc/modules.d/macbook
  64 + - /etc/modules.d/macbook: remove
  65 + - initscript: change chkconfig priority from 44 to 42 (before cpufreqd)
  66 +
  67 +2007-08-03 0.3.8 Silvan Calarco <silvan.calarco@mambasoft.it>:
  68 + - initscript: added support for macmini configuration in lirc
  69 + - modprobe: removed loading of appletouch (now automatic) and appleir
  70 + (obsolete)
  71 + - udev: removed macbook file installation
  72 + - scripts: added check for Apple chassis so this package can be installed
  73 + harmlessy also on non macbook computers
  74 +
  75 +2007-03-08 0.3.7 Silvan Calarco <silvan.calarco@mambasoft.it>:
  76 + - modprobe macbook: fix appleir and appletouch loading before usbhid
  77 +
  78 +2007-03-06 0.3.6 Silvan Calarco <silvan.calarco@mambasoft.it>:
  79 + - use xprofile.d instead of autostart desktop file
  80 +
  81 +2006-10-20 0.3.5 Silvan Calarco <silvan.calarco@mambasoft.it>:
  82 + - fix xmodmap file to match new keyboard layout fixes in kernel 2.6.18.3
  83 +
  84 +2006-10-12 0.3.4 Silvan Calarco <silvan.calarco@mambasoft.it>:
  85 + - fix udev rule to match KERNEL event device
  86 + - appleir: load before usbhid
  87 +
  88 +2006-10-10 0.3.3 Silvan Calarco <silvan.calarco@mambasoft.it>:
  89 + - add udev rule for appleir
  90 +
  91 +2006-10-08 0.3.2 Silvan Calarco <silvan.calarco@mambasoft.it>:
  92 + - add lircd support
  93 + - load uvcvideo on boot
  94 +
  95 +2006-10-02 0.3 Silvan Calarco <silvan.calarco@mambasoft.it>:
  96 + - add more complete kbd support (Function keys mapping and commands)
  97 + - set keyboard configuration on X session startup
  98 +
  99 +2006-10-02 0.2.2 Silvan Calarco <silvan.calarco@mambasoft.it>:
  100 + - appletouch: load before usbhid (needs usbhid compiled as a module)
  101 +
  102 +2006-07-24 0.2.1 Silvan Calarco <silvan.calarco@mambasoft.it>:
  103 + - add modprobe.conf.d file for automatic firmware loading
  104 +
  105 +2006-07-24 0.2 Silvan Calarco <silvan.calarco@mambasoft.it>:
  106 + - added isight firmware loader tool
  107 + - applesmc: resync from original macbook-tools 0.1.1
  108 + - macbook-lightd: added very simple daemon for keyboard backlight control
  109 +
  110 +2006-07-13 0.1a Silvan Calarco <silvan.calarco@mambasoft.it>:
  111 + - backlight tool updated
  112 + - added applesmc tool for keyboard backlight control
  113 +
  114 +2006-07-09 0.1:
  115 + - first official release with backlight tool by Nicolas Boichat <nicolas@boichat.ch>
... ... @@ -0,0 +1,48 @@
  1 +include VERSION
  2 +
  3 +BINDIR:=/usr/bin
  4 +SBIN:=/sbin
  5 +SBINDIR:=/usr/sbin
  6 +SYSCONFDIR:=/etc
  7 +DESTDIR:=
  8 +DATADIR:=/usr/share
  9 +INITDIR:=/etc/rc.d/init.d
  10 +RPMSOURCEDIR:=/usr/src/RPM/SOURCES
  11 +KDEAUTOSTART:=/opt/kde3/share/autostart/
  12 +
  13 +all: applesmc backlight
  14 +
  15 +applesmc: applesmc.c Makefile
  16 + gcc -DVERSION=\"$(VERSION)\" -Wall applesmc.c -o applesmc
  17 +backlight: backlight.c Makefile
  18 + gcc -DVERSION=\"$(VERSION)\" -Wall backlight.c -o backlight -lpci -static
  19 +
  20 +install: backlight applesmc
  21 + install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(INITDIR) \
  22 + $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(SYSCONFDIR)/modprobe.d \
  23 + $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) \
  24 + $(DESTDIR)$(SYSCONFDIR)/sysconfig $(DESTDIR)$(KDEAUTOSTART)
  25 + install -s -m 4755 applesmc $(DESTDIR)$(BINDIR)
  26 + install -s -m 4755 backlight $(DESTDIR)$(BINDIR)
  27 + install -m 0755 macbook-set-input $(DESTDIR)$(BINDIR)/
  28 + install -m 0755 macbook-tools-init $(DESTDIR)$(INITDIR)/macbook-tools
  29 + install -m 644 macbook-tools-sysconfig $(DESTDIR)$(SYSCONFDIR)/sysconfig/macbook-tools
  30 + install -m 0755 macbook-lightd $(DESTDIR)$(SBINDIR)/
  31 + install -m 0644 macbook-modprobe $(DESTDIR)$(SYSCONFDIR)/modprobe.d/macbook.conf
  32 + install -m 0644 macbook_set_input.desktop $(DESTDIR)$(KDEAUTOSTART)/macbook_set_input.desktop
  33 +
  34 +clean:
  35 + rm -f backlight
  36 + rm -f applesmc
  37 + rm -f *~
  38 +
  39 +dist: clean
  40 + rm -rf macbook-tools-$(VERSION)
  41 + rm -rf macbook-tools-$(VERSION).tar.bz2
  42 + mkdir macbook-tools-$(VERSION)
  43 + find . -maxdepth 1 -exec cp {} macbook-tools-$(VERSION) \;
  44 + tar cvfj macbook-tools-$(VERSION).tar.bz2 macbook-tools-$(VERSION)
  45 + rm -rf macbook-tools-$(VERSION)
  46 +
  47 +dist-rpm: dist
  48 + cp macbook-tools-$(VERSION).tar.bz2 $(RPMSOURCEDIR)
... ... @@ -0,0 +1,2 @@
  1 +VERSION = 0.3.25
  2 +
... ... @@ -0,0 +1,286 @@
  1 +/*
  2 + * Apple Macbook Pro SMC control
  3 + *
  4 + * Copyright (C) 2006 Nicolas Boichat <nicolas@boichat.ch>
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this program; if not, write to the Free Software
  18 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19 + *
  20 + */
  21 +
  22 +#include <stdio.h>
  23 +#include <sys/io.h>
  24 +#include <stdlib.h>
  25 +#include <string.h>
  26 +#include <unistd.h>
  27 +#include <sys/time.h>
  28 +
  29 +#define LIGHT_SENSOR_LEFT_KEY "ALV0" //0x414c5630, r-o length 6
  30 +#define LIGHT_SENSOR_RIGHT_KEY "ALV1" //0x414c5631, r-o length 6
  31 +#define BACKLIGHT_KEY "LKSB" //0x4c4b5342, w-o
  32 +#define CLAMSHELL_KEY "MSLD" //0x4d534c44, r-o length 1 (unused)
  33 +#define MOTION_SENSOR_X_KEY "MO_X" //0x4d4f5f58, r-o length 2
  34 +#define MOTION_SENSOR_Y_KEY "MO_Y" //0x4d4f5f58, r-o length 2
  35 +#define MOTION_SENSOR_Z_KEY "MO_Z" //0x4d4f5f58, r-o length 2
  36 +#define MOTION_SENSOR_KEY "MOCN" //0x4d4f434e, r/w length 2
  37 +
  38 +
  39 +static int debug = 0;
  40 +
  41 +static struct timeval lasttv;
  42 +static struct timeval newtv;
  43 +
  44 +void inline ssleep(const int usec) {
  45 + gettimeofday(&lasttv, NULL);
  46 + while (1) {
  47 + gettimeofday(&newtv, NULL);
  48 + if (((newtv.tv_usec - lasttv.tv_usec) + ((newtv.tv_sec - lasttv.tv_sec)*1000000)) > usec) {
  49 + break;
  50 + }
  51 + }
  52 +}
  53 +
  54 +unsigned char get_status() {
  55 + return inb(0x304);
  56 +}
  57 +
  58 +int waitfree(char num) {
  59 + char c, pc = -1;
  60 + int retry = 100;
  61 + while (((c = get_status())&0x0F) != num && retry) {
  62 + ssleep(10);
  63 + retry--;
  64 + if (pc != c) {
  65 + //printf("%x-%d:", c, retry);
  66 + pc = c;
  67 + }
  68 + }
  69 + if (retry == 0) {
  70 + printf("Waitfree failed %x != %x.\n", c, num);
  71 + return 0;
  72 + }
  73 + /*else
  74 + printf("Waitfree ok %x.\n", c);*/
  75 +
  76 + return 1;
  77 +}
  78 +
  79 +int writekey(char* key, char len, unsigned char* buffer) {
  80 + int i;
  81 +
  82 + outb(0x11, 0x304);
  83 + if (!waitfree(0x0c)) return 0;
  84 +
  85 + for (i = 0; i < 4; i++) {
  86 + outb(key[i], 0x300);
  87 + if (!waitfree(0x04)) return 0;
  88 + }
  89 + if (debug) printf(">%s", key);
  90 +
  91 + outb(len, 0x300);
  92 + if (debug) printf(">%x", len);
  93 +
  94 + for (i = 0; i < len; i++) {
  95 + if (!waitfree(0x04)) return 0;
  96 + outb(buffer[i], 0x300);
  97 + if (debug) printf(">%x", buffer[i]);
  98 + }
  99 + if (debug) printf("\n");
  100 + return 1;
  101 +}
  102 +
  103 +int readkey(char* key, char len, unsigned char* buffer) {
  104 + int i; unsigned char c;
  105 +
  106 + outb(0x10, 0x304);
  107 + if (!waitfree(0x0c)) return 0;
  108 +
  109 + for (i = 0; i < 4; i++) {
  110 + outb(key[i], 0x300);
  111 + if (!waitfree(0x04)) return 0;
  112 + }
  113 + if (debug) printf("<%s", key);
  114 +
  115 + outb(len, 0x300);
  116 + if (debug) printf(">%x", len);
  117 +
  118 + for (i = 0; i < len; i++) {
  119 + if (!waitfree(0x05)) return 0;
  120 + c = inb(0x300);
  121 + buffer[i] = c;
  122 + if (debug) printf("<%x", c);
  123 + }
  124 + if (debug) printf("\n");
  125 + return 1;
  126 +}
  127 +
  128 +int read_light_sensor(int left) {
  129 + unsigned char buffer[6];
  130 + if (readkey(left ? LIGHT_SENSOR_LEFT_KEY : LIGHT_SENSOR_RIGHT_KEY, 6, buffer))
  131 + return buffer[2];
  132 + else
  133 + return -1;
  134 +}
  135 +
  136 +int set_keyboard_backlight(char value) {
  137 + unsigned char buffer[2];
  138 + buffer[0] = value;
  139 + buffer[1] = 0x00;
  140 + return writekey(BACKLIGHT_KEY, 2, buffer);
  141 +}
  142 +
  143 +int init_motion_sensor() {
  144 + unsigned char buffer[2];
  145 + int retry = 50;
  146 + int ret;
  147 +
  148 + while (retry) {
  149 + ret = readkey(MOTION_SENSOR_KEY, 2, buffer);
  150 + if (ret) {
  151 + if (buffer[0] || buffer[1]) {
  152 + return 1;
  153 + }
  154 + }
  155 + else {
  156 + usleep(100000);
  157 + retry--;
  158 + continue;
  159 + }
  160 + buffer[0] = 0xe0;
  161 + buffer[1] = 0;
  162 + writekey(MOTION_SENSOR_KEY, 2, buffer);
  163 + retry--;
  164 + usleep(100000);
  165 + }
  166 + return 0;
  167 +}
  168 +
  169 +int read_motion_sensor(int index) {
  170 + unsigned char buffer[2];
  171 + int ret;
  172 +
  173 + switch (index) {
  174 + case 0:
  175 + ret = readkey(MOTION_SENSOR_X_KEY, 2, buffer);
  176 + break;
  177 + case 1:
  178 + ret = readkey(MOTION_SENSOR_Y_KEY, 2, buffer);
  179 + break;
  180 + case 2:
  181 + ret = readkey(MOTION_SENSOR_Z_KEY, 2, buffer);
  182 + break;
  183 + }
  184 + //printf("%d %x %x\n", index, buffer[0], buffer[1]);
  185 + if (ret) {
  186 + return (short)(buffer[0] << 8 | buffer[1]);
  187 + }
  188 + else {
  189 + return 0x0FFFFFFF;
  190 + }
  191 +}
  192 +
  193 +/* Brute-force device probing... */
  194 +void probe() {
  195 + char key[5];
  196 + char chars[37];
  197 + unsigned char buffer[2];
  198 + int i, j, k, l;
  199 +
  200 + for (i = 0; i < 26; i++) {
  201 + chars[i] = 'A'+i;
  202 + }
  203 + for (i = 0; i < 10; i++) {
  204 + chars[i+26] = '0'+i;
  205 + }
  206 + chars[36] = '_';
  207 +
  208 + key[4] = 0;
  209 + for (i = 0; i < 37; i++) {
  210 + key[0] = chars[i];
  211 + for (j = 0; j < 37; j++) {
  212 + key[1] = chars[j];
  213 + for (k = 0; k < 37; k++) {
  214 + key[2] = chars[k];
  215 + for (l = 0; l < 37; l++) {
  216 + key[3] = chars[l];
  217 + printf("key=%s\n", key);
  218 + readkey(key, 2, buffer);
  219 + }
  220 + }
  221 + }
  222 + }
  223 +}
  224 +
  225 +void usage(char* argv0) {
  226 + printf("Apple Macbook (pro) SMC control " VERSION);
  227 + printf("\n");
  228 + printf("Usage:\n");
  229 + printf("%s [-d]: read light/motion sensors values\n", argv0);
  230 + printf("%s [-d] value: write keyboard backlight value [0-255]\n", argv0);
  231 +}
  232 +
  233 +int main(int argc, char** argv) {
  234 + int argi = 1;
  235 + if (argc > 3) {
  236 + usage(argv[0]);
  237 + return 1;
  238 + }
  239 +
  240 + if (ioperm(0x300, 0x304, 1) < 0) {
  241 + perror("ioperm failed (you should be root).");
  242 + exit(1);
  243 + }
  244 +
  245 + if ((argc > 1) && !strcmp(argv[1], "-d")) {
  246 + debug = 1;
  247 + argi = 2;
  248 + }
  249 +
  250 + if (argc-argi == 1) {
  251 + char* endptr;
  252 + long value = strtol(argv[argi], &endptr, 10);
  253 + if ((value < 0) || (value > 255) || (endptr[0])) {
  254 + printf("Invalid value \"%s\" (should be an integer between 0 and 255).\n", argv[1]);
  255 + usage(argv[0]);
  256 + return 1;
  257 + }
  258 + else {
  259 + set_keyboard_backlight(value);
  260 + }
  261 + }
  262 + else {
  263 + init_motion_sensor();
  264 + printf("Light: Left: %d, Right: %d\n", read_light_sensor(1), read_light_sensor(0));
  265 + printf("Motion: X: %d, Y: %d, Z: %d\n", read_motion_sensor(0), read_motion_sensor(1), read_motion_sensor(2));
  266 + /*while (1) {
  267 + printf("Motion: X: %d, Y: %d, Z: %d\n", read_motion_sensor(0), read_motion_sensor(1), read_motion_sensor(2));
  268 + sleep(1);
  269 + }
  270 + int x, y, z, ox, oy, oz;
  271 + ox = read_motion_sensor(0);
  272 + oy = read_motion_sensor(1);
  273 + oz = read_motion_sensor(2);
  274 + while (1) {
  275 + x = read_motion_sensor(0);
  276 + y = read_motion_sensor(1);
  277 + z = read_motion_sensor(2);
  278 + if ((x-ox)*(x-ox)+(y-oy)*(y-oy)+(z-oz)*(z-oz) > 50)
  279 + printf("Accel: X: %d, Y: %d, Z: %d (%d %d)\n", x-ox, y-oy, z-oz, z, oz);
  280 + usleep(1000000);
  281 + ox = x; oy = y; oz = z;
  282 + }*/
  283 + }
  284 +
  285 + return 0;
  286 +}
... ... @@ -0,0 +1,194 @@
  1 +/*
  2 + * Apple Macbook Pro LCD backlight control
  3 + *
  4 + * Copyright (C) 2006 Nicolas Boichat <nicolas@boichat.ch>
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this program; if not, write to the Free Software
  18 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19 + *
  20 + */
  21 +
  22 +#include <stdio.h>
  23 +#include <sys/io.h>
  24 +#include <stdlib.h>
  25 +#include <string.h>
  26 +#include <sys/mman.h>
  27 +#include <sys/types.h>
  28 +#include <sys/stat.h>
  29 +#include <fcntl.h>
  30 +#include <unistd.h>
  31 +
  32 +#include <pci/pci.h>
  33 +
  34 +char* memory;
  35 +
  36 +static inline unsigned int readl(const volatile void *addr)
  37 +{
  38 + return *(volatile unsigned int*) addr;
  39 +}
  40 +
  41 +static inline void writel(unsigned int b, volatile void *addr)
  42 +{
  43 + *(volatile unsigned int*) addr = b;
  44 +}
  45 +
  46 +#define INREG(addr) readl(memory+addr)
  47 +#define OUTREG(addr,val) writel(val, memory+addr)
  48 +
  49 +unsigned char read_backlight() {
  50 + return INREG(0x7af8) >> 8;
  51 +}
  52 +
  53 +void write_backlight_value(unsigned char value) {
  54 + OUTREG(0x7af8, 0x00000001 | ((unsigned int)value << 8));
  55 +}
  56 +
  57 +void write_backlight(unsigned char value) {
  58 + unsigned int current = read_backlight();
  59 +
  60 + if (current < value) {
  61 + while (current < value) {
  62 + current += 5;
  63 + if (current > value)
  64 + current = value;
  65 + write_backlight_value((unsigned char)current);
  66 + usleep(50000);
  67 + }
  68 + }
  69 + else {
  70 + while (current > value) {
  71 + current -= 5;
  72 + if (current < value)
  73 + current = value;
  74 + write_backlight_value((unsigned char)current);
  75 + usleep(50000);
  76 + }
  77 + }
  78 +}
  79 +
  80 +void usage(char* argv0) {
  81 + printf("Apple Macbook (pro) backlight control " VERSION);
  82 + printf("\n");
  83 + printf("Usage:\n");
  84 + printf("%s: read current value\n", argv0);
  85 + printf("%s value: write value [0-255]\n", argv0);
  86 + printf("%s +n: increase value by n\n", argv0);
  87 + printf("%s -n: decrease value by n\n", argv0);
  88 +}
  89 +
  90 +int main(int argc, char** argv) {
  91 + if (argc > 2) {
  92 + usage(argv[0]);
  93 + return 1;
  94 + }
  95 +
  96 + char* endptr;
  97 + int ret = 0;
  98 + long address = 0;
  99 + long length = 0;
  100 + int fd;
  101 + int state;
  102 +
  103 + /* Search for the graphics card. */
  104 + /* Default values: */
  105 + /* address = 0x90300000; */
  106 + /* length = 0x20000; */
  107 +
  108 + struct pci_access *pacc = pci_alloc();
  109 + pci_init(pacc);
  110 + pci_scan_bus(pacc);
  111 + struct pci_dev *dev;
  112 + for(dev=pacc->devices; dev; dev=dev->next) { /* Iterate over all devices */
  113 + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);
  114 + if ((dev->vendor_id == 0x1002) && (dev->device_id == 0x71c5)) { // ATI X1600
  115 + address = dev->base_addr[2];
  116 + length = dev->size[2];
  117 + }
  118 + }
  119 + pci_cleanup(pacc);
  120 +
  121 + if (!address) {
  122 + printf("Failed to detect ATI X1600, aborting...\n");
  123 + return 1;
  124 + }
  125 +
  126 + fd = open("/dev/mem", O_RDWR);
  127 +
  128 + if (fd < 0) {
  129 + perror("cannot open /dev/mem");
  130 + return 1;
  131 + }
  132 +
  133 + memory = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, address);
  134 +
  135 + if (memory == MAP_FAILED) {
  136 + perror("mmap failed");
  137 + return 1;
  138 + }
  139 +
  140 + /* Is it really necessary ? */
  141 + OUTREG(0x4dc, 0x00000005);
  142 + state = INREG(0x7ae4);
  143 + OUTREG(0x7ae4, state);
  144 +
  145 + if (argc == 2) {
  146 + if (argv[1][0] == '+') {
  147 + long value = strtol(&argv[1][1], &endptr, 10);
  148 + if ((value < 0) || (value > 255) || (endptr[0])) {
  149 + printf("Invalid value \"%s\" (should be an integer between 0 and 255).\n", &argv[1][1]);
  150 + usage(argv[0]);
  151 + ret = 1;
  152 + }
  153 + else {
  154 + value = read_backlight()+value;
  155 + if (value > 255)
  156 + value = 255;
  157 + write_backlight(value);
  158 + }
  159 + }
  160 + else if (argv[1][0] == '-') {
  161 + long value = strtol(&argv[1][1], &endptr, 10);
  162 + if ((value < 0) || (value > 255) || (endptr[0])) {
  163 + printf("Invalid value \"%s\" (should be an integer between 0 and 255).\n", &argv[1][1]);
  164 + usage(argv[0]);
  165 + ret = 1;
  166 + }
  167 + else {
  168 + value = read_backlight()-value;
  169 + if (value < 0)
  170 + value = 0;
  171 + write_backlight(value);
  172 + }
  173 + }
  174 + else {
  175 + long value = strtol(argv[1], &endptr, 10);
  176 + if ((value < 0) || (value > 255) || (endptr[0])) {
  177 + printf("Invalid value \"%s\" (should be an integer between 0 and 255).\n", argv[1]);
  178 + usage(argv[0]);
  179 + ret = 1;
  180 + }
  181 + else {
  182 + write_backlight(value);
  183 + }
  184 + }
  185 + }
  186 + else {
  187 + printf("%d\n", read_backlight());
  188 + }
  189 +
  190 + munmap(memory, length);
  191 + close(fd);
  192 +
  193 + return ret;
  194 +}
... ... @@ -0,0 +1,54 @@
  1 +#!/bin/bash
  2 +
  3 +# set the keyboard brigthness on a Apple MacBook computer
  4 +# Copyright (C) 2006 Ludovic Rousseau <ludovic.rousseau@free.fr>
  5 +#
  6 +# This program is free software; you can redistribute it and/or modify
  7 +# it under the terms of the GNU General Public License as published by
  8 +# the Free Software Foundation; either version 2 of the License, or
  9 +# (at your option) any later version.
  10 +#
  11 +# This program is distributed in the hope that it will be useful,
  12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 +# GNU General Public License for more details.
  15 +#
  16 +# You should have received a copy of the GNU General Public License along
  17 +# with this program; if not, write to the Free Software Foundation, Inc.,
  18 +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19 +
  20 +#set -v
  21 +#set -x
  22 +BRIGHTNESS=/sys/class/leds/smc\:kbd_backlight/brightness
  23 +value=$(cat $BRIGHTNESS)
  24 +
  25 +if [ -z "$1" ]; then
  26 + echo $value
  27 + exit
  28 +fi
  29 +
  30 +if [ "$1" = "-h" ]; then
  31 + echo "Usage: $0 [-h|arg|+arg|-arg]"
  32 + echo
  33 + echo "Change the keyboard brigthness to:"
  34 + echo " arg"
  35 + echo " or current value + arg"
  36 + echo " or current value - arg"
  37 + echo
  38 + echo "Without argument it return the current value"
  39 + exit
  40 +fi
  41 +
  42 +if [ $(expr match "$1" "[+-]") = "1" ]; then
  43 + value=$((value$1))
  44 +else
  45 + value=$1
  46 +fi
  47 +
  48 +if [ $value -lt 0 ]; then
  49 + value=0
  50 +fi
  51 +
  52 +echo $value > $BRIGHTNESS
  53 +cat $BRIGHTNESS
  54 +
... ... @@ -0,0 +1,40 @@
  1 +
  2 +# Please make this file available to others
  3 +# by sending it to <lirc@bartelmus.de>
  4 +#
  5 +# this config file was automatically generated
  6 +# using lirc-0.8.0(devinput) on Fri Aug 25 23:48:04 2006
  7 +#
  8 +# contributed by
  9 +#
  10 +# brand: lircd.conf
  11 +# model no. of remote control:
  12 +# devices being controlled by this remote:
  13 +#
  14 +
  15 +begin remote
  16 +
  17 + name apple-frontrow
  18 + bits 8
  19 + eps 30
  20 + aeps 100
  21 +