debian/0000775000000000000000000000000011756647557007217 5ustar debian/copyright0000664000000000000000000000360611671231703011131 0ustar This package was debianized by Michael Vogt on Sat, 23 Sep 2000 12:29:17 +0200. Previous maintainer was Rene Engelhard Current maintainer is Giuseppe Iuculano It was downloaded from http://www.schwieters.org/toshset/ Upstream Author: Charles Schwieters Copyright Holders: Copyright (c) 2002-4 Charles D. Schwieters Copyright (c) 1998, 1999 Jonathan A. Buzzard (jab@hex.prestel.co.uk) Copyright 1991 by the Massachusetts Institute of Technology License: This package 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 package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. debian/toshiba-acpi/2.6.26/toshiba_acpi.c: Copyright (C) 2002-2004 John Belmonte License: GPL, see above. debian/toshiba-acpi/2.6.28/toshiba_acpi.c: Copyright (C) 2002-2004 John Belmonte Copyright (C) 2008 Philip Langdale License: GPL, see above. debian/patches/03_toshsat1800-irdasetup.patch: Copyright (C) 2002, Daniele Peri License: GPL, see above. The Debian packaging is: Copyright © 2009, Giuseppe Iuculano and is licensed under the GPL, see above. debian/changelog0000664000000000000000000003744111756647546011100 0ustar toshset (1.76-4) unstable; urgency=low * QA upload. * Fix build failure with GCC 4.7. Closes: #672026. -- Matthias Klose Tue, 22 May 2012 08:28:58 +0000 toshset (1.76-3) unstable; urgency=low * QA upload * debian/rules: build-stamp, not build, must depend on configure-stamp (closes: #666347). -- Ralf Treinen Thu, 05 Apr 2012 22:32:04 +0200 toshset (1.76-2) unstable; urgency=low * QA upload. * Update 08_novatel_3g_suspend.patch: allow suspend / hibernate if device doesn't exist, otherwise system may not suspend properly. Thanks Brian Murray for the patch (Closes: #633555). * Bump Standards-Version to 3.9.2. -- Paolo Rotolo Sun, 11 Dec 2011 18:28:25 +0100 toshset (1.76-1) unstable; urgency=low * QA upload. * New upstream release (Closes: #614375) + Patch in the novatel_3g_suspend script, which was omitted by upstream * Bump to Standards-Version 3.9.1 (no changes needed) * Remove Vcs-* fields from debian/control since package is orphaned * Do not compress .c source files (Closes: #580860) * Specify Debian source format as '3.0 (quilt)' -- Roberto C. Sanchez Sun, 13 Mar 2011 22:08:49 -0400 toshset (1.75-2) unstable; urgency=low * [b3110f4] Orphaning package * [10b9dcc] Bump to Standards-Version 3.8.3 (no changes needed) -- Giuseppe Iuculano Sat, 23 Jan 2010 10:47:07 +0100 toshset (1.75-1) unstable; urgency=low * [d1ba896] Imported Upstream version 1.75 * [136f89a] Updated to standards version 3.8.1 (No changes needed). * [8076305] Refreshed 04_toshset_man_page.patch. * [a9a727a] Remove /etc/modprobe.d/toshset on upgrade only if unmodified. -- Giuseppe Iuculano Tue, 16 Jun 2009 15:45:17 +0200 toshset (1.74-3) unstable; urgency=low * [f2d1948] Document quilt usage in README.source * [a0d6cf2] Do not install /etc/modprobe.d/toshset, the new standard /etc/modprobe.d/aliases file already contain the alias needed. (Closes: #518243) * [27bcd14] debian/control: Added ${misc:Depends} in Depends * [b504404] debian/toshset.preinst: Remove /etc/modprobe.d/toshset -- Giuseppe Iuculano Thu, 05 Mar 2009 11:22:24 +0100 toshset (1.74-2) unstable; urgency=low * [898b969] debian/patches/06_fix_FTBFS_with_gcc4.4.patch: Adding a missing include and fix FTBFS with gcc-4.4. Thanks Martin Michlmayr. (Closes: #505345) * [482e141] debian/control: Clarify that toshset needs an experimental version of the toshiba_acpi kernel module (Closes: #487154) * [4f496cc] Provide /etc/modprobe.d/toshset to register toshiba kernel module * [aa29466] Added in the doc directory source and a script to install the experimental toshiba_acpi kernel module. * [bf88b61] debian/README.Debian: Updated * [39d2e0f] Clarify in README.Debian and debian/control that Ubuntu users don't need the experimental driver. * [75cbe9e] debian/copyright: Updated -- Giuseppe Iuculano Fri, 27 Feb 2009 15:37:19 +0100 toshset (1.74-1) unstable; urgency=low * [855cd19] New Upstream Version * [0b495dd] Switch to quilt * [ac18676] debian/control: Added DM-Upload-Allowed control field * [6272f8e] debian/control: Added VCS control field * [968a09d] Bump to debhelper 7 compatibility levels * [740010a] debian/rules: dh_clean -k is deprecated, use dh_prep and fix dh-clean-k-is-deprecated lintian warning * [93002a8] Updated debian/copyright and fixed copyright-refers-to- versionless-license-file lintian warning -- Giuseppe Iuculano Sun, 15 Feb 2009 18:12:28 +0100 toshset (1.73-3) unstable; urgency=low * New maintainer, thanks to Roberto C. Sanchez for the prior work on toshset (closes: #403683) * Updated to standards version 3.8.0 * Added a commented watch file (toshet upstream uses a distribution mechanism that cannot be meaningfully monitored) * Fixed dpatch-missing-description lintian warning for 01_honor_CXX.dpatch * debian/patches/04_toshset_man_page.dpatch: Fixed manpage-has-errors-from-man lintian warning (Removed pointless .hr) * debian/patches/03_toshsat1800-irdasetup.dpatch: Include stdlib.h and string.h to fix compiler warnings. * debian/rules: Do not use .bak, simply remove configure config.sub config.log confdefs.h in clean target -- Giuseppe Iuculano Tue, 21 Oct 2008 18:32:46 +0200 toshset (1.73-2) unstable; urgency=low * QA upload. * Change to build with libpci-dev, fixes FTBFS (Closes: #478391) -- Roberto C. Sanchez Tue, 29 Apr 2008 01:43:10 -0400 toshset (1.73-1) unstable; urgency=low * QA upload. * New upstream release. * Add amd64 to list of available architectures. -- Roberto C. Sanchez Fri, 21 Mar 2008 22:31:06 -0400 toshset (1.72-7) unstable; urgency=low * QA upload. * Update to Standards-Version 3.7.3 (no changes required) * Update to debhelper compatibility level 5 (no changes required) * Fix bashism in debian/rules (Closes: #452086) -- Roberto C. Sanchez Mon, 21 Jan 2008 14:59:37 -0500 toshset (1.72-6) unstable; urgency=low * QA upload. * debian/rules: Honor nostrip option (Closes: #438215) * debian/rules: Change call to '$(MAKE) distclean' to satisfy lintian -- Roberto C. Sanchez Mon, 17 Sep 2007 19:03:26 -0400 toshset (1.72-5) unstable; urgency=high * QA upload. * Fix FTBFS (Closes: #433283): - Remove linux-kernel-headers from the Build-Depends, now replaced by linux-libc-dev, which is pulled by libc6-dev. - Replace the ``asm/io.h'' include by an ``sys/io.h'' include in the following patch: 03_toshsat1800-irdasetup.dpatch * Urgency set to `high' accordingly. -- Cyril Brulebois Tue, 17 Jul 2007 17:15:52 +0200 toshset (1.72-4) unstable; urgency=low * QA Upload. * Remove toshsat-irdasetup directory in clean target (Closes: #424214) -- Roberto C. Sanchez Tue, 15 May 2007 19:27:54 -0400 toshset (1.72-3) unstable; urgency=low * Orphaning this package. Maintainer set to Debian QA Group. * Add Build-Depend on zlib1g-dev and explicit -lz (Closes: #419675). -- Roberto C. Sanchez Sun, 22 Apr 2007 18:30:19 -0400 toshset (1.72-2) unstable; urgency=low * Fixed formatting of Homepage: in description * Minor fixes to debian/rules file. -- Roberto C. Sanchez Sun, 15 Oct 2006 09:19:32 -0400 toshset (1.72-1) unstable; urgency=low * New upstream release. * Acknowledge NMU (Closes: #376011) * Updated to Standards-Version 3.7.2 * Updated maintainer email address * Added Build-Depends on autotools-dev * Made whatis description for toshsat1800-irdasetup(1) more descriptive * Removed unnecessary Build-Depend on gcc and g++ -- Roberto C. Sanchez Sat, 14 Oct 2006 20:57:14 -0400 toshset (1.71-1.1) unstable; urgency=high * Non-maintainer upload. * Replace config.sub with the version from latest autotools-dev, to avoid FTBFS when using an amd64 kernel with i386 userspace. * 05_toshsat1800-irdasetup_types.dpatch: Replace usage of the obsolete "byte" type with "u8"; fixes FTBFS, patch from Matej Vela. (Closes: #374721) -- Steinar H. Gunderson Thu, 29 Jun 2006 18:17:56 +0200 toshset (1.71-1) unstable; urgency=low * New upstream release. -- Roberto C. Sanchez Mon, 24 Oct 2005 12:31:01 -0400 toshset (1.70-1) unstable; urgency=low * New upstream release. (Closes: #315704) * Added a patch to correct lintian warnings on the toshset.1 man page. -- Roberto C. Sanchez Sat, 13 Aug 2005 13:12:12 -0400 toshset (1.69-2) unstable; urgency=low * Added a patch that includes the toshsat1800-irdasetup utility. (Closes: #253858) * Added a patch that fixes a build failure with g++-4.0. -- Roberto C. Sanchez Fri, 12 Aug 2005 18:31:57 -0400 toshset (1.69-1) unstable; urgency=low * New upstream release. -- Roberto C. Sanchez Mon, 27 Jun 2005 15:01:35 -0400 toshset (1.68-2) unstable; urgency=low * Updated to new standards version (3.6.2). * Updated copyright information and upstream URL. -- Roberto C. Sanchez Mon, 20 Jun 2005 09:09:38 -0400 toshset (1.68-1) unstable; urgency=low * New upstream release. * New maintainer. (Closes: #301978) * Added upstream homepage to the package description. * Removed debconf check for ACPI since newer versions of toshset work with ACPI or APM. -- Roberto C. Sanchez Sun, 19 Jun 2005 22:16:42 -0400 toshset (1.67-1) experimental; urgency=low * New upstream release -- Rene Engelhard Tue, 21 Sep 2004 21:22:17 +0200 toshset (1.66-1) experimental; urgency=low * New upstream release -- Rene Engelhard Mon, 12 Jul 2004 00:43:47 +0200 toshset (1.65-1) experimental; urgency=low * New upstream release (closes: #251984) -- Rene Engelhard Tue, 1 Jun 2004 00:50:41 +0200 toshset (1.64-2) unstable; urgency=low * updated danish debconf template translation, thanks Morten Brix Pedersen (closes: #243222) -- Rene Engelhard Tue, 13 Apr 2004 22:37:59 +0200 toshset (1.64-1) unstable; urgency=low * New upstream release -- Rene Engelhard Sun, 7 Mar 2004 03:59:31 +0100 toshset (1.63-1) unstable; urgency=low * New upstream release - -DUSE_KERNEL_INTERFACE now default - now experimental ACPI support when using John Belmonte's experimental toshiba_acpi patch from http://memebeam.org/free-software/toshiba_acpi/toshiba_acpi_0.17-dev_toshiba_test2.patch * use l-k-h's toshiba.h now again since it's fixed; Build-Depend on linux-kernel-headers (>= 2.5.999-test7-bk-14) -- Rene Engelhard Tue, 2 Mar 2004 04:40:32 +0100 toshset (1.62-1) unstable; urgency=low * New upstream release * reeanable kernel interface, make and use our own toshiba.h, based on the one from linux-kernel-headers 2.5.999-test7-bk-9 * remove 03_fallback_prinout again, it definitely prints out the message too often :-) * install README.video -- Rene Engelhard Wed, 26 Nov 2003 20:41:37 +0100 toshset (1.61-1) experimental; urgency=low * New upstream release * disable kernel interface method for now but add new patch 03_fallback_printout to print out that we fallback from kernel interface to native access when kernel interface is enabled but not available * delete configure in clean target * minor debian/rules and debian/copyright cleanup * fix 02_march_i386.dpatch * I think toshset is better suited in utils, move to there... -- Rene Engelhard Fri, 14 Nov 2003 21:04:52 +0100 toshset (1.60-4) unstable; urgency=low * add dutch debconf template translation, thanks Bart Cornelis (closes: #206331) * Standards-Version: 3.6.1 -- Rene Engelhard Wed, 20 Aug 2003 19:33:04 +0200 toshset (1.60-3) unstable; urgency=low * *sigh* s/dbs/dpatch/ in Build-Depends: (closes: #197709 -- Rene Engelhard Tue, 17 Jun 2003 12:23:04 +0200 toshset (1.60-2) unstable; urgency=low * The "Where-is-the-brown-papaer-bag" release. * Build-Depend on gcc (>= 3:3.0), g++ (>= 3:3.0) as toshset does no compile with older ones anymore...; remove Build-Depends on gcc-2.95, g++-2.95 which were left over... * rm *-stamp in clean which was forgotten for the conversion to dpatch *sigh* -- Rene Engelhard Mon, 16 Jun 2003 19:18:58 +0200 toshset (1.60-1) unstable; urgency=low * new upstream release - updated machine ID description for 0xfc08 to display CDS/CDT (closes: #196105) * compile now with default g++ * include da.po for po-debconf from DDTP -- Rene Engelhard Mon, 16 Jun 2003 18:18:45 +0200 toshset (1.59-2) unstable; urgency=low * add fr.po for po-debconf (thanks Christian Perrier) (closes: #190114) -- Rene Engelhard Tue, 22 Apr 2003 08:54:37 +0200 toshset (1.59-1) unstable; urgency=low * new upstream release * minor corrections/improvements in rules and control -- Rene Engelhard Sun, 23 Mar 2003 15:09:06 +0100 toshset (1.58-3) unstable; urgency=medium * compile with -DUSE_KERNEL_INTERFACE; uses kernel interface and when that fails toshset tries to communicate directly with the BIOS * add debconf note mentioning that toshset doesn't work correctly with an ACPI-kernel.... - use po-debconf => Build-Depend: on debhelper (>> 4.1.16) * extract toshiba machine ID's from toshibaIDs.cc to create a supported-models.txt in /usr/share/doc/toshset * debhelper compat v4 -- Rene Engelhard Sat, 8 Mar 2003 19:04:51 +0100 toshset (1.58-2) unstable; urgency=low * Oops, change Maintainer: field actually now -- Rene Engelhard Mon, 20 Jan 2003 17:51:42 +0100 toshset (1.58-1) unstable; urgency=low * New maintainer (thanks, Michael) * New upstream release * DBS'ized * addded ./configure check for CXX and compile with g{cc,++}-2.95 because toshset segfaults when compiled with g{cc,++}-3.2 for some reason....; Build-Depend: on g{cc,++}-2.95 * compile with -march=i386.... * fix lintian warnings W: toshset source: dh_suidregister-is-obsolete W: toshset source: configure-generated-file-in-source debian/config.log W: toshset: copyright-lists-upstream-authors-with-dh_make-boilerplate W: toshset: description-synopsis-might-not-be-phrased-properly * little cleanup in debian/rules; use newer DH_COMPAT * Bumped Standards-Version: to 3.5.8 -- Rene Engelhard Sun, 19 Jan 2003 12:57:18 +0100 toshset (1.55-1) unstable; urgency=low * New upstream release -- Michael Vogt Wed, 18 Sep 2002 01:52:47 +0200 toshset (1.54-1) unstable; urgency=low * new upstream version -- Michael Vogt Sat, 17 Aug 2002 21:22:26 +0200 toshset (1.53-1) unstable; urgency=low * new upstream release -- Michael Vogt Fri, 12 Jul 2002 16:23:51 +0200 toshset (1.52-1) unstable; urgency=low * new upstream release -- Michael Vogt Mon, 27 May 2002 00:26:28 +0200 toshset (1.51-1) unstable; urgency=low * new upstream release -- Michael Vogt Sat, 27 Apr 2002 19:37:40 +0200 toshset (1.50-1) unstable; urgency=low * new upstream release -- Michael Vogt Thu, 4 Apr 2002 10:43:54 +0200 toshset (1.46-1) unstable; urgency=low * new upstream -- Michael Vogt Tue, 29 Jan 2002 10:04:32 +0100 toshset (1.45-1) unstable; urgency=low * new upstream release (closes: #126148) -- Michael Vogt Mon, 21 Jan 2002 16:09:07 +0100 toshset (1.44-1) unstable; urgency=low * removed all *.ex files in debian/ (closes: #128740) * new upstream version -- Michael Vogt Sat, 19 Jan 2002 14:49:34 +0100 toshset (1.41-4) unstable; urgency=low * closes: #82644 * clarified the relationship between toshset and toshutils -- Michael Vogt Thu, 15 Feb 2001 10:42:47 +0100 toshset (1.41-3) unstable; urgency=low * better description (thanks to Colin Marquardt) -- Michael Vogt Fri, 29 Sep 2000 01:32:01 +0200 toshset (1.41-2) unstable; urgency=low * fixed control file, set arch to i386 * changed section to utils (as used by toshutils) * added a line to the description -- Michael Vogt Tue, 26 Sep 2000 12:00:42 +0200 toshset (1.41-1) unstable; urgency=low * Initial Release. -- Michael Vogt Sat, 23 Sep 2000 12:29:17 +0200 debian/source/0000775000000000000000000000000011537466724010507 5ustar debian/source/format0000664000000000000000000000001411537274277011715 0ustar 3.0 (quilt) debian/compat0000664000000000000000000000000211536711042010366 0ustar 7 debian/README.Debian0000664000000000000000000000155011536711252011235 0ustar toshset ------- As of version 1.69-2, this package contains an additional utility that is not a part of the upstream toshset package. The utility is toshsat1800-irdasetup. It was requested by a user and since it is too small to be placed into its own package, I have included it with toshset. Please read the README.IrDA for details on how to use it. Toshset requires an experimental version of the toshiba_acpi kernel module with an ACPI-enabled kernel. Otherwise it works only if the laptop supports the old APM BIOS. (The last of these was produced something like 5 years ago.) In /usr/share/doc/toshset/toshiba-acpi you can find the experimental version of the toshiba_acpi kernel module. You can run 'sh install.sh' for compiling and install the module. (Ubuntu users don't need it) -- Giuseppe Iuculano Fri, 27 Feb 2009 14:46:08 +0100 debian/toshset.modprobe0000664000000000000000000000000011536711501012400 0ustar debian/dirs0000664000000000000000000000004711671234077010065 0ustar usr/bin usr/sbin usr/share/doc/toshset debian/control0000664000000000000000000000251311671233317010600 0ustar Source: toshset Section: utils Priority: optional Maintainer: Debian QA Group Standards-Version: 3.9.2 Build-Depends: debhelper (>= 7), autoconf, quilt (>= 0.40), libpci-dev, autotools-dev, zlib1g-dev Homepage: http://www.schwieters.org/toshset/ Package: toshset Architecture: i386 amd64 Depends: ${shlibs:Depends}, ${misc:Depends} Description: Access much of the Toshiba laptop hardware interface Toshset is a command-line tool to allow access to much of the Toshiba laptop hardware interface developed by Jonathan Buzzard. It can do things like set the hard drive spin-down time, turn off the display and set the fan speed without the help of the kernel. Toshset requires an experimental version of the toshiba_acpi kernel module with an ACPI-enabled kernel. Otherwise it works only if the laptop supports the old APM BIOS. (The last of these was produced something like 5 years ago) Please read README.Debian how to install the experimental version of the toshiba_acpi kernel module. (Ubuntu users don't need it) . This package also includes the Toshsat1800-irdasetup by Daniele Peri. It can be used to configure IrDA for laptops with ALI1533 bridge (LPC47N227 SuperIO), smc-ircc and not initializing BIOS (tested on Toshiba Satellite 1800-514). Homepage: http://www.csai.unipa.it/peri/toshsat1800-irdasetup/ debian/toshset.preinst0000664000000000000000000000054011536712106012270 0ustar #!/bin/sh set -e if [ "$1" = install ] || [ "$1" = upgrade ]; then if [ -e "/etc/modprobe.d/toshset" ]; then if [ "`md5sum \"/etc/modprobe.d/toshset\" | sed -e \"s/ .*//\"`" = \ "`dpkg-query -W -f='${Conffiles}' toshset | sed -n -e \"\\\\' /etc/modprobe.d/toshset's/.* //p\"`" ] then rm -f /etc/modprobe.d/toshset fi fi fi #DEBHELPER# debian/watch0000664000000000000000000000033211536710021010213 0ustar # toshet upstream uses a distribution mechanism that cannot be meaningfully monitored by # uscan and the Debian External Health Status project. # Latest version is always: http://www.schwieters.org/toshset/toshset.tgz debian/README.source0000664000000000000000000000036311671234077011361 0ustar This package uses quilt to manage all modifications to the upstream source. Changes are stored in the source package as diffs in debian/patches and applied during the build. See /usr/share/doc/quilt/README.source for a detailed explanation. debian/toshiba-acpi/0000775000000000000000000000000011537466724011552 5ustar debian/toshiba-acpi/2.6.26/0000775000000000000000000000000011537466724012305 5ustar debian/toshiba-acpi/2.6.26/install.sh0000664000000000000000000000034311536711252014273 0ustar #!/bin/sh apt-get install build-essential libncurses5-dev kernel-package linux-headers-`uname -r` cd /usr/share/doc/toshset/toshiba-acpi/2.6.26 make cp toshiba_acpi.ko /lib/modules/`uname -r`/kernel/drivers/acpi/ depmod -a debian/toshiba-acpi/2.6.26/Makefile0000664000000000000000000000024211536711252013727 0ustar obj-m += toshiba_acpi.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean debian/toshiba-acpi/2.6.26/toshiba_acpi.c0000664000000000000000000004705011536711252015070 0ustar /* * toshiba_acpi.c - Toshiba Laptop ACPI Extras * * * Copyright (C) 2002-2004 John Belmonte * * 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 * * * The devolpment page for this driver is located at * http://memebeam.org/toys/ToshibaAcpiDriver. * * Credits: * Jonathan A. Buzzard - Toshiba HCI info, and critical tips on reverse * engineering the Windows drivers * Yasushi Nagato - changes for linux kernel 2.4 -> 2.5 * Rob Miller - TV out and hotkeys help * * PLEASE NOTE * * This is an experimental version of toshiba_acpi which includes emulation * of the original toshiba driver's /proc/toshiba and /dev/toshiba, * allowing Toshiba userspace utilities to work. The relevant code was * based on toshiba.c (copyright 1996-2001 Jonathan A. Buzzard) and * incorporated into this driver with help from Gintautas Miliauskas, * Charles Schwieters, and Christoph Burger-Scheidlin. * * Caveats: * * hotkey status in /proc/toshiba is not implemented * * to make accesses to /dev/toshiba load this driver instead of * the original driver, you will have to modify your module * auto-loading configuration * * TODO * */ #define TOSHIBA_ACPI_VERSION "0.19-dev" #define PROC_INTERFACE_VERSION 1 #include #include #include #include #include #include #include #include #include #include #include #include MODULE_AUTHOR("John Belmonte"); MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); MODULE_LICENSE("GPL"); #define MY_LOGPREFIX "toshiba_acpi: " #define MY_ERR KERN_ERR MY_LOGPREFIX #define MY_NOTICE KERN_NOTICE MY_LOGPREFIX #define MY_INFO KERN_INFO MY_LOGPREFIX /* Toshiba ACPI method paths */ #define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM" #define METHOD_HCI_1 "\\_SB_.VALD.GHCI" #define METHOD_HCI_2 "\\_SB_.VALZ.GHCI" #define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" /* Toshiba HCI interface definitions * * HCI is Toshiba's "Hardware Control Interface" which is supposed to * be uniform across all their models. Ideally we would just call * dedicated ACPI methods instead of using this primitive interface. * However the ACPI methods seem to be incomplete in some areas (for * example they allow setting, but not reading, the LCD brightness value), * so this is still useful. */ #define HCI_WORDS 6 /* operations */ #define HCI_SET 0xff00 #define HCI_GET 0xfe00 /* return codes */ #define HCI_SUCCESS 0x0000 #define HCI_FAILURE 0x1000 #define HCI_NOT_SUPPORTED 0x8000 #define HCI_EMPTY 0x8c00 /* registers */ #define HCI_FAN 0x0004 #define HCI_SYSTEM_EVENT 0x0016 #define HCI_VIDEO_OUT 0x001c #define HCI_HOTKEY_EVENT 0x001e #define HCI_LCD_BRIGHTNESS 0x002a /* field definitions */ #define HCI_LCD_BRIGHTNESS_BITS 3 #define HCI_LCD_BRIGHTNESS_SHIFT (16-HCI_LCD_BRIGHTNESS_BITS) #define HCI_LCD_BRIGHTNESS_LEVELS (1 << HCI_LCD_BRIGHTNESS_BITS) #define HCI_VIDEO_OUT_LCD 0x1 #define HCI_VIDEO_OUT_CRT 0x2 #define HCI_VIDEO_OUT_TV 0x4 static const struct acpi_device_id toshiba_device_ids[] = { {"TOS6200", 0}, {"TOS1900", 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); /* utility */ static __inline__ void _set_bit(u32 * word, u32 mask, int value) { *word = (*word & ~mask) | (mask * value); } /* acpi interface wrappers */ static int is_valid_acpi_path(const char *methodName) { acpi_handle handle; acpi_status status; status = acpi_get_handle(NULL, (char *)methodName, &handle); return !ACPI_FAILURE(status); } static int write_acpi_int(const char *methodName, int val) { struct acpi_object_list params; union acpi_object in_objs[1]; acpi_status status; params.count = ARRAY_SIZE(in_objs); params.pointer = in_objs; in_objs[0].type = ACPI_TYPE_INTEGER; in_objs[0].integer.value = val; status = acpi_evaluate_object(NULL, (char *)methodName, ¶ms, NULL); return (status == AE_OK); } #if 0 static int read_acpi_int(const char *methodName, int *pVal) { struct acpi_buffer results; union acpi_object out_objs[1]; acpi_status status; results.length = sizeof(out_objs); results.pointer = out_objs; status = acpi_evaluate_object(0, (char *)methodName, 0, &results); *pVal = out_objs[0].integer.value; return (status == AE_OK) && (out_objs[0].type == ACPI_TYPE_INTEGER); } #endif static const char *method_hci /*= 0*/ ; /* Perform a raw HCI call. Here we don't care about input or output buffer * format. */ static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) { struct acpi_object_list params; union acpi_object in_objs[HCI_WORDS]; struct acpi_buffer results; union acpi_object out_objs[HCI_WORDS + 1]; acpi_status status; int i; params.count = HCI_WORDS; params.pointer = in_objs; for (i = 0; i < HCI_WORDS; ++i) { in_objs[i].type = ACPI_TYPE_INTEGER; in_objs[i].integer.value = in[i]; } results.length = sizeof(out_objs); results.pointer = out_objs; status = acpi_evaluate_object(NULL, (char *)method_hci, ¶ms, &results); if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { for (i = 0; i < out_objs->package.count; ++i) { out[i] = out_objs->package.elements[i].integer.value; } } return status; } /* common hci tasks (get or set one value) * * In addition to the ACPI status, the HCI system returns a result which * may be useful (such as "not supported"). */ static acpi_status hci_write1(u32 reg, u32 in1, u32 * result) { u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } static acpi_status hci_read1(u32 reg, u32 * out1, u32 * result) { u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *out1 = out[2]; *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; static struct backlight_device *toshiba_backlight_device; static int force_fan; static int last_key_event; static int key_event_valid; typedef struct _ProcItem { const char *name; char *(*read_func) (char *); unsigned long (*write_func) (const char *, unsigned long); } ProcItem; /* proc file handlers */ static int dispatch_read(char *page, char **start, off_t off, int count, int *eof, ProcItem * item) { char *p = page; int len; if (off == 0) p = item->read_func(p); /* ISSUE: I don't understand this code */ len = (p - page); if (len <= off + count) *eof = 1; *start = page + off; len -= off; if (len > count) len = count; if (len < 0) len = 0; return len; } static int dispatch_write(struct file *file, const char __user * buffer, unsigned long count, ProcItem * item) { int result; char *tmp_buffer; /* Arg buffer points to userspace memory, which can't be accessed * directly. Since we're making a copy, zero-terminate the * destination so that sscanf can be used on it safely. */ tmp_buffer = kmalloc(count + 1, GFP_KERNEL); if (!tmp_buffer) return -ENOMEM; if (copy_from_user(tmp_buffer, buffer, count)) { result = -EFAULT; } else { tmp_buffer[count] = 0; result = item->write_func(tmp_buffer, count); } kfree(tmp_buffer); return result; } static int get_lcd(struct backlight_device *bd) { u32 hci_result; u32 value; hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) { return (value >> HCI_LCD_BRIGHTNESS_SHIFT); } else return -EFAULT; } static char *read_lcd(char *p) { int value = get_lcd(NULL); if (value >= 0) { p += sprintf(p, "brightness: %d\n", value); p += sprintf(p, "brightness_levels: %d\n", HCI_LCD_BRIGHTNESS_LEVELS); } else { printk(MY_ERR "Error reading LCD brightness\n"); } return p; } static int set_lcd(int value) { u32 hci_result; value = value << HCI_LCD_BRIGHTNESS_SHIFT; hci_write1(HCI_LCD_BRIGHTNESS, value, &hci_result); if (hci_result != HCI_SUCCESS) return -EFAULT; return 0; } static int set_lcd_status(struct backlight_device *bd) { return set_lcd(bd->props.brightness); } static unsigned long write_lcd(const char *buffer, unsigned long count) { int value; int ret; if (sscanf(buffer, " brightness : %i", &value) == 1 && value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { ret = set_lcd(value); if (ret == 0) ret = count; } else { ret = -EINVAL; } return ret; } static char *read_video(char *p) { u32 hci_result; u32 value; hci_read1(HCI_VIDEO_OUT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; p += sprintf(p, "lcd_out: %d\n", is_lcd); p += sprintf(p, "crt_out: %d\n", is_crt); p += sprintf(p, "tv_out: %d\n", is_tv); } else { printk(MY_ERR "Error reading video out status\n"); } return p; } static unsigned long write_video(const char *buffer, unsigned long count) { int value; int remain = count; int lcd_out = -1; int crt_out = -1; int tv_out = -1; u32 hci_result; u32 video_out; /* scan expression. Multiple expressions may be delimited with ; * * NOTE: to keep scanning simple, invalid fields are ignored */ while (remain) { if (sscanf(buffer, " lcd_out : %i", &value) == 1) lcd_out = value & 1; else if (sscanf(buffer, " crt_out : %i", &value) == 1) crt_out = value & 1; else if (sscanf(buffer, " tv_out : %i", &value) == 1) tv_out = value & 1; /* advance to one character past the next ; */ do { ++buffer; --remain; } while (remain && *(buffer - 1) != ';'); } hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); if (hci_result == HCI_SUCCESS) { int new_video_out = video_out; if (lcd_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out); if (crt_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_CRT, crt_out); if (tv_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_TV, tv_out); /* To avoid unnecessary video disruption, only write the new * video setting if something changed. */ if (new_video_out != video_out) write_acpi_int(METHOD_VIDEO_OUT, new_video_out); } else { return -EFAULT; } return count; } static char *read_fan(char *p) { u32 hci_result; u32 value; hci_read1(HCI_FAN, &value, &hci_result); if (hci_result == HCI_SUCCESS) { p += sprintf(p, "running: %d\n", (value > 0)); p += sprintf(p, "force_on: %d\n", force_fan); } else { printk(MY_ERR "Error reading fan status\n"); } return p; } static unsigned long write_fan(const char *buffer, unsigned long count) { int value; u32 hci_result; if (sscanf(buffer, " force_on : %i", &value) == 1 && value >= 0 && value <= 1) { hci_write1(HCI_FAN, value, &hci_result); if (hci_result != HCI_SUCCESS) return -EFAULT; else force_fan = value; } else { return -EINVAL; } return count; } static char *read_keys(char *p) { u32 hci_result; u32 value; if (!key_event_valid) { hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { key_event_valid = 1; last_key_event = value; } else if (hci_result == HCI_EMPTY) { /* better luck next time */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* This is a workaround for an unresolved issue on * some machines where system events sporadically * become disabled. */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); printk(MY_NOTICE "Re-enabled hotkeys\n"); } else { printk(MY_ERR "Error reading hotkey status\n"); goto end; } } p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); end: return p; } static unsigned long write_keys(const char *buffer, unsigned long count) { int value; if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) { key_event_valid = 0; } else { return -EINVAL; } return count; } static char *read_version(char *p) { p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION); p += sprintf(p, "proc_interface: %d\n", PROC_INTERFACE_VERSION); return p; } /* /dev/toshiba and /proc/toshiba handlers {{{ * * ISSUE: lots of magic numbers and mysterious code */ #define TOSH_MINOR_DEV 181 #define OLD_PROC_TOSHIBA "toshiba" static int tosh_acpi_bridge(SMMRegisters* regs) { acpi_status status; /* assert(sizeof(SMMRegisters) == sizeof(u32)*HCI_WORDS); */ status = hci_raw((u32*)regs, (u32*)regs); if (status == AE_OK && (regs->eax & 0xff00) == HCI_SUCCESS) return 0; return -EINVAL; } static int tosh_ioctl(struct inode* ip, struct file* fp, unsigned int cmd, unsigned long arg) { SMMRegisters regs; unsigned short ax,bx; int err; if ((!arg) || (cmd != TOSH_SMM)) return -EINVAL; if (copy_from_user(®s, (SMMRegisters*)arg, sizeof(SMMRegisters))) return -EFAULT; ax = regs.eax & 0xff00; bx = regs.ebx & 0xffff; /* block HCI calls to read/write memory & PCI devices */ if (((ax==HCI_SET) || (ax==HCI_GET)) && (bx>0x0069)) return -EINVAL; err = tosh_acpi_bridge(®s); if (copy_to_user((SMMRegisters*)arg, ®s, sizeof(SMMRegisters))) return -EFAULT; return err; } static int tosh_get_machine_id(void __iomem *bios) { int id; unsigned short bx,cx; unsigned long address; id = (0x100*(int) readb(bios+0xfffe))+((int) readb(bios+0xfffa)); /* do we have a SCTTable machine identication number on our hands */ if (id==0xfc2f) { bx = 0xe6f5; /* cheat */ /* now twiddle with our pointer a bit */ address = 0x00000000 + bx; cx = readw(bios + address); address = 0x00000009 + bx + cx; cx = readw(bios + address); address = 0x0000000a + cx; cx = readw(bios + address); /* now construct our machine identification number */ id = ((cx & 0xff)<<8)+((cx & 0xff00)>>8); } return id; } static int tosh_id; static int tosh_bios; static int tosh_date; static int tosh_sci; static struct file_operations tosh_fops = { .owner = THIS_MODULE, .ioctl = tosh_ioctl }; static struct miscdevice tosh_device = { TOSH_MINOR_DEV, "toshiba", &tosh_fops }; static void setup_tosh_info(void __iomem *bios) { int major, minor; int day, month, year; tosh_id = tosh_get_machine_id(bios); /* get the BIOS version */ major = readb(bios + 0xe009)-'0'; minor = ((readb(bios + 0xe00b)-'0')*10)+(readb(bios + 0xe00c)-'0'); tosh_bios = (major*0x100)+minor; /* get the BIOS date */ day = ((readb(bios + 0xfff5)-'0')*10)+(readb(bios + 0xfff6)-'0'); month = ((readb(bios + 0xfff8)-'0')*10)+(readb(bios + 0xfff9)-'0'); year = ((readb(bios + 0xfffb)-'0')*10)+(readb(bios + 0xfffc)-'0'); tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6) | ((day & 0x1f)<<1); } /* /proc/toshiba read handler */ static int tosh_proc_show(struct seq_file *m, void *v) { /* TODO: tosh_fn_status() */ int key = 0; /* Format: * 0) Linux driver version (this will change if format changes) * 1) Machine ID * 2) SCI version * 3) BIOS version (major, minor) * 4) BIOS date (in SCI date format) * 5) Fn Key status */ seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n", tosh_id, (tosh_sci & 0xff00)>>8, tosh_sci & 0xff, (tosh_bios & 0xff00)>>8, tosh_bios & 0xff, tosh_date, key); return 0; } static int tosh_proc_open(struct inode *inode, struct file *file) { return single_open(file, tosh_proc_show, NULL); } static const struct file_operations tosh_proc_fops = { .owner = THIS_MODULE, .open = tosh_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int __init old_driver_emulation_init(void) { int status; void __iomem *bios = ioremap(0xf0000, 0x10000); if (!bios) return -ENOMEM; if ((status = misc_register(&tosh_device))) { printk(MY_ERR "failed to register misc device %d (\"%s\")\n", tosh_device.minor, tosh_device.name); return status; } setup_tosh_info(bios); proc_create(OLD_PROC_TOSHIBA, 0, NULL, &tosh_proc_fops); iounmap(bios); return 0; } static void __exit old_driver_emulation_exit(void) { remove_proc_entry(OLD_PROC_TOSHIBA, NULL); misc_deregister(&tosh_device); } /* }}} end of /dev/toshiba and /proc/toshiba handlers */ /* proc and module init */ #define PROC_TOSHIBA "toshiba" static ProcItem proc_items[] = { {"lcd", read_lcd, write_lcd}, {"video", read_video, write_video}, {"fan", read_fan, write_fan}, {"keys", read_keys, write_keys}, {"version", read_version, NULL}, {NULL} }; static acpi_status __init add_device(void) { struct proc_dir_entry *proc; ProcItem *item; for (item = proc_items; item->name; ++item) { proc = create_proc_read_entry(item->name, S_IFREG | S_IRUGO | S_IWUSR, toshiba_proc_dir, (read_proc_t *) dispatch_read, item); if (proc) proc->owner = THIS_MODULE; if (proc && item->write_func) proc->write_proc = (write_proc_t *) dispatch_write; } return AE_OK; } static acpi_status remove_device(void) { ProcItem *item; for (item = proc_items; item->name; ++item) remove_proc_entry(item->name, toshiba_proc_dir); return AE_OK; } static struct backlight_ops toshiba_backlight_data = { .get_brightness = get_lcd, .update_status = set_lcd_status, }; static void toshiba_acpi_exit(void) { if (toshiba_backlight_device) backlight_device_unregister(toshiba_backlight_device); remove_device(); if (toshiba_proc_dir) remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); old_driver_emulation_exit(); return; } static int __init toshiba_acpi_init(void) { acpi_status status = AE_OK; u32 hci_result; int status2; if (acpi_disabled) return -ENODEV; /* simple device detection: look for HCI method */ if (is_valid_acpi_path(METHOD_HCI_1)) method_hci = METHOD_HCI_1; else if (is_valid_acpi_path(METHOD_HCI_2)) method_hci = METHOD_HCI_2; else return -ENODEV; printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n", TOSHIBA_ACPI_VERSION); printk(MY_INFO " HCI method: %s\n", method_hci); if ((status2 = old_driver_emulation_init())) return status2; force_fan = 0; key_event_valid = 0; /* enable event fifo */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); toshiba_proc_dir = proc_mkdir(PROC_TOSHIBA, acpi_root_dir); if (!toshiba_proc_dir) { status = AE_ERROR; } else { toshiba_proc_dir->owner = THIS_MODULE; status = add_device(); if (ACPI_FAILURE(status)) remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); } toshiba_backlight_device = backlight_device_register("toshiba",NULL, NULL, &toshiba_backlight_data); if (IS_ERR(toshiba_backlight_device)) { int ret = PTR_ERR(toshiba_backlight_device); printk(KERN_ERR "Could not register toshiba backlight device\n"); toshiba_backlight_device = NULL; toshiba_acpi_exit(); return ret; } toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; } module_init(toshiba_acpi_init); module_exit(toshiba_acpi_exit); debian/toshiba-acpi/2.6.28/0000775000000000000000000000000011537466724012307 5ustar debian/toshiba-acpi/2.6.28/install.sh0000664000000000000000000000034311536711252014275 0ustar #!/bin/sh apt-get install build-essential libncurses5-dev kernel-package linux-headers-`uname -r` cd /usr/share/doc/toshset/toshiba-acpi/2.6.28 make cp toshiba_acpi.ko /lib/modules/`uname -r`/kernel/drivers/acpi/ depmod -a debian/toshiba-acpi/2.6.28/Makefile0000664000000000000000000000024211536711252013731 0ustar obj-m += toshiba_acpi.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean debian/toshiba-acpi/2.6.28/toshiba_acpi.c0000664000000000000000000007425611536711252015102 0ustar /* * toshiba_acpi.c - Toshiba Laptop ACPI Extras * * * Copyright (C) 2002-2004 John Belmonte * Copyright (C) 2008 Philip Langdale * * 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 * * * The devolpment page for this driver is located at * http://memebeam.org/toys/ToshibaAcpiDriver. * * Credits: * Jonathan A. Buzzard - Toshiba HCI info, and critical tips on reverse * engineering the Windows drivers * Yasushi Nagato - changes for linux kernel 2.4 -> 2.5 * Rob Miller - TV out and hotkeys help * Daniel Silverstone - Punting of hotkeys via acpi using a thread * * PLEASE NOTE * * This is an experimental version of toshiba_acpi which includes emulation * of the original toshiba driver's /proc/toshiba and /dev/toshiba, * allowing Toshiba userspace utilities to work. The relevant code was * based on toshiba.c (copyright 1996-2001 Jonathan A. Buzzard) and * incorporated into this driver with help from Gintautas Miliauskas, * Charles Schwieters, and Christoph Burger-Scheidlin. * * Caveats: * * hotkey status in /proc/toshiba is not implemented * * to make accesses to /dev/toshiba load this driver instead of * the original driver, you will have to modify your module * auto-loading configuration * * TODO * */ #define TOSHIBA_ACPI_VERSION "0.19-dev-acpikeys" #define PROC_INTERFACE_VERSION 1 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include MODULE_AUTHOR("John Belmonte"); MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); MODULE_LICENSE("GPL"); #define MY_LOGPREFIX "toshiba_acpi: " #define MY_ERR KERN_ERR MY_LOGPREFIX #define MY_NOTICE KERN_NOTICE MY_LOGPREFIX #define MY_INFO KERN_INFO MY_LOGPREFIX /* Toshiba ACPI method paths */ #define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM" #define METHOD_HCI_1 "\\_SB_.VALD.GHCI" #define METHOD_HCI_2 "\\_SB_.VALZ.GHCI" #define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" /* Toshiba HCI interface definitions * * HCI is Toshiba's "Hardware Control Interface" which is supposed to * be uniform across all their models. Ideally we would just call * dedicated ACPI methods instead of using this primitive interface. * However the ACPI methods seem to be incomplete in some areas (for * example they allow setting, but not reading, the LCD brightness value), * so this is still useful. */ #define HCI_WORDS 6 /* operations */ #define HCI_SET 0xff00 #define HCI_GET 0xfe00 /* return codes */ #define HCI_SUCCESS 0x0000 #define HCI_FAILURE 0x1000 #define HCI_NOT_SUPPORTED 0x8000 #define HCI_EMPTY 0x8c00 /* registers */ #define HCI_FAN 0x0004 #define HCI_SYSTEM_EVENT 0x0016 #define HCI_VIDEO_OUT 0x001c #define HCI_HOTKEY_EVENT 0x001e #define HCI_LCD_BRIGHTNESS 0x002a #define HCI_WIRELESS 0x0056 /* field definitions */ #define HCI_LCD_BRIGHTNESS_BITS 3 #define HCI_LCD_BRIGHTNESS_SHIFT (16-HCI_LCD_BRIGHTNESS_BITS) #define HCI_LCD_BRIGHTNESS_LEVELS (1 << HCI_LCD_BRIGHTNESS_BITS) #define HCI_VIDEO_OUT_LCD 0x1 #define HCI_VIDEO_OUT_CRT 0x2 #define HCI_VIDEO_OUT_TV 0x4 #define HCI_WIRELESS_KILL_SWITCH 0x01 #define HCI_WIRELESS_BT_PRESENT 0x0f #define HCI_WIRELESS_BT_ATTACH 0x40 #define HCI_WIRELESS_BT_POWER 0x80 static const struct acpi_device_id toshiba_device_ids[] = { {"TOS6200", 0}, {"TOS6208", 0}, {"TOS1900", 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); /* utility */ static __inline__ void _set_bit(u32 * word, u32 mask, int value) { *word = (*word & ~mask) | (mask * value); } /* acpi interface wrappers */ static int is_valid_acpi_path(const char *methodName) { acpi_handle handle; acpi_status status; status = acpi_get_handle(NULL, (char *)methodName, &handle); return !ACPI_FAILURE(status); } static int write_acpi_int(const char *methodName, int val) { struct acpi_object_list params; union acpi_object in_objs[1]; acpi_status status; params.count = ARRAY_SIZE(in_objs); params.pointer = in_objs; in_objs[0].type = ACPI_TYPE_INTEGER; in_objs[0].integer.value = val; status = acpi_evaluate_object(NULL, (char *)methodName, ¶ms, NULL); return (status == AE_OK); } #if 0 static int read_acpi_int(const char *methodName, int *pVal) { struct acpi_buffer results; union acpi_object out_objs[1]; acpi_status status; results.length = sizeof(out_objs); results.pointer = out_objs; status = acpi_evaluate_object(0, (char *)methodName, 0, &results); *pVal = out_objs[0].integer.value; return (status == AE_OK) && (out_objs[0].type == ACPI_TYPE_INTEGER); } #endif static const char *method_hci /*= 0*/ ; /* Perform a raw HCI call. Here we don't care about input or output buffer * format. */ static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) { struct acpi_object_list params; union acpi_object in_objs[HCI_WORDS]; struct acpi_buffer results; union acpi_object out_objs[HCI_WORDS + 1]; acpi_status status; int i; params.count = HCI_WORDS; params.pointer = in_objs; for (i = 0; i < HCI_WORDS; ++i) { in_objs[i].type = ACPI_TYPE_INTEGER; in_objs[i].integer.value = in[i]; } results.length = sizeof(out_objs); results.pointer = out_objs; status = acpi_evaluate_object(NULL, (char *)method_hci, ¶ms, &results); if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { for (i = 0; i < out_objs->package.count; ++i) { out[i] = out_objs->package.elements[i].integer.value; } } return status; } /* common hci tasks (get or set one or two value) * * In addition to the ACPI status, the HCI system returns a result which * may be useful (such as "not supported"). */ static acpi_status hci_write1(u32 reg, u32 in1, u32 * result) { u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } static acpi_status hci_read1(u32 reg, u32 * out1, u32 * result) { u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *out1 = out[2]; *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } static acpi_status hci_write2(u32 reg, u32 in1, u32 in2, u32 *result) { u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } static acpi_status hci_read2(u32 reg, u32 *out1, u32 *out2, u32 *result) { u32 in[HCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; u32 out[HCI_WORDS]; acpi_status status = hci_raw(in, out); *out1 = out[2]; *out2 = out[3]; *result = (status == AE_OK) ? out[0] : HCI_FAILURE; return status; } struct toshiba_acpi_dev { struct platform_device *p_dev; struct rfkill *rfk_dev; struct input_polled_dev *poll_dev; const char *bt_name; const char *rfk_name; bool last_rfk_state; struct mutex mutex; }; static struct toshiba_acpi_dev toshiba_acpi = { .bt_name = "Toshiba Bluetooth", .rfk_name = "Toshiba RFKill Switch", .last_rfk_state = false, }; /* Bluetooth rfkill handlers */ static u32 hci_get_bt_present(bool *present) { u32 hci_result; u32 value, value2; value = 0; value2 = 0; hci_read2(HCI_WIRELESS, &value, &value2, &hci_result); if (hci_result == HCI_SUCCESS) *present = (value & HCI_WIRELESS_BT_PRESENT) ? true : false; return hci_result; } static u32 hci_get_bt_on(bool *on) { u32 hci_result; u32 value, value2; value = 0; value2 = 0x0001; hci_read2(HCI_WIRELESS, &value, &value2, &hci_result); if (hci_result == HCI_SUCCESS) *on = (value & HCI_WIRELESS_BT_POWER) && (value & HCI_WIRELESS_BT_ATTACH); return hci_result; } static u32 hci_get_radio_state(bool *radio_state) { u32 hci_result; u32 value, value2; value = 0; value2 = 0x0001; hci_read2(HCI_WIRELESS, &value, &value2, &hci_result); *radio_state = value & HCI_WIRELESS_KILL_SWITCH; return hci_result; } static int bt_rfkill_toggle_radio(void *data, enum rfkill_state state) { u32 result1, result2; u32 value; bool radio_state; struct toshiba_acpi_dev *dev = data; value = (state == RFKILL_STATE_UNBLOCKED); if (hci_get_radio_state(&radio_state) != HCI_SUCCESS) return -EFAULT; switch (state) { case RFKILL_STATE_UNBLOCKED: if (!radio_state) return -EPERM; break; case RFKILL_STATE_SOFT_BLOCKED: break; default: return -EINVAL; } mutex_lock(&dev->mutex); hci_write2(HCI_WIRELESS, value, HCI_WIRELESS_BT_POWER, &result1); hci_write2(HCI_WIRELESS, value, HCI_WIRELESS_BT_ATTACH, &result2); mutex_unlock(&dev->mutex); if (result1 != HCI_SUCCESS || result2 != HCI_SUCCESS) return -EFAULT; return 0; } static void bt_poll_rfkill(struct input_polled_dev *poll_dev) { bool state_changed; bool new_rfk_state; bool value; u32 hci_result; struct toshiba_acpi_dev *dev = poll_dev->private; hci_result = hci_get_radio_state(&value); if (hci_result != HCI_SUCCESS) return; /* Can't do anything useful */ new_rfk_state = value; mutex_lock(&dev->mutex); state_changed = new_rfk_state != dev->last_rfk_state; dev->last_rfk_state = new_rfk_state; mutex_unlock(&dev->mutex); if (unlikely(state_changed)) { rfkill_force_state(dev->rfk_dev, new_rfk_state ? RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_HARD_BLOCKED); input_report_switch(poll_dev->input, SW_RFKILL_ALL, new_rfk_state); input_sync(poll_dev->input); } } static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; static struct backlight_device *toshiba_backlight_device; static int force_fan; static int last_key_event; static int key_event_valid; static int hotkeys_over_acpi = 1; static int hotkeys_check_per_sec = 2; module_param(hotkeys_over_acpi, uint, 0400); module_param(hotkeys_check_per_sec, uint, 0400); typedef struct _ProcItem { const char *name; char *(*read_func) (char *); unsigned long (*write_func) (const char *, unsigned long); } ProcItem; /* proc file handlers */ static int dispatch_read(char *page, char **start, off_t off, int count, int *eof, ProcItem * item) { char *p = page; int len; if (off == 0) p = item->read_func(p); /* ISSUE: I don't understand this code */ len = (p - page); if (len <= off + count) *eof = 1; *start = page + off; len -= off; if (len > count) len = count; if (len < 0) len = 0; return len; } static int dispatch_write(struct file *file, const char __user * buffer, unsigned long count, ProcItem * item) { int result; char *tmp_buffer; /* Arg buffer points to userspace memory, which can't be accessed * directly. Since we're making a copy, zero-terminate the * destination so that sscanf can be used on it safely. */ tmp_buffer = kmalloc(count + 1, GFP_KERNEL); if (!tmp_buffer) return -ENOMEM; if (copy_from_user(tmp_buffer, buffer, count)) { result = -EFAULT; } else { tmp_buffer[count] = 0; result = item->write_func(tmp_buffer, count); } kfree(tmp_buffer); return result; } static int get_lcd(struct backlight_device *bd) { u32 hci_result; u32 value; hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) { return (value >> HCI_LCD_BRIGHTNESS_SHIFT); } else return -EFAULT; } static char *read_lcd(char *p) { int value = get_lcd(NULL); if (value >= 0) { p += sprintf(p, "brightness: %d\n", value); p += sprintf(p, "brightness_levels: %d\n", HCI_LCD_BRIGHTNESS_LEVELS); } else { printk(MY_ERR "Error reading LCD brightness\n"); } return p; } static int set_lcd(int value) { u32 hci_result; value = value << HCI_LCD_BRIGHTNESS_SHIFT; hci_write1(HCI_LCD_BRIGHTNESS, value, &hci_result); if (hci_result != HCI_SUCCESS) return -EFAULT; return 0; } static int set_lcd_status(struct backlight_device *bd) { return set_lcd(bd->props.brightness); } static unsigned long write_lcd(const char *buffer, unsigned long count) { int value; int ret; if (sscanf(buffer, " brightness : %i", &value) == 1 && value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { ret = set_lcd(value); if (ret == 0) ret = count; } else { ret = -EINVAL; } return ret; } static char *read_video(char *p) { u32 hci_result; u32 value; hci_read1(HCI_VIDEO_OUT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; p += sprintf(p, "lcd_out: %d\n", is_lcd); p += sprintf(p, "crt_out: %d\n", is_crt); p += sprintf(p, "tv_out: %d\n", is_tv); } else { printk(MY_ERR "Error reading video out status\n"); } return p; } static unsigned long write_video(const char *buffer, unsigned long count) { int value; int remain = count; int lcd_out = -1; int crt_out = -1; int tv_out = -1; u32 hci_result; u32 video_out; /* scan expression. Multiple expressions may be delimited with ; * * NOTE: to keep scanning simple, invalid fields are ignored */ while (remain) { if (sscanf(buffer, " lcd_out : %i", &value) == 1) lcd_out = value & 1; else if (sscanf(buffer, " crt_out : %i", &value) == 1) crt_out = value & 1; else if (sscanf(buffer, " tv_out : %i", &value) == 1) tv_out = value & 1; /* advance to one character past the next ; */ do { ++buffer; --remain; } while (remain && *(buffer - 1) != ';'); } hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); if (hci_result == HCI_SUCCESS) { unsigned int new_video_out = video_out; if (lcd_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out); if (crt_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_CRT, crt_out); if (tv_out != -1) _set_bit(&new_video_out, HCI_VIDEO_OUT_TV, tv_out); /* To avoid unnecessary video disruption, only write the new * video setting if something changed. */ if (new_video_out != video_out) write_acpi_int(METHOD_VIDEO_OUT, new_video_out); } else { return -EFAULT; } return count; } static char *read_fan(char *p) { u32 hci_result; u32 value; hci_read1(HCI_FAN, &value, &hci_result); if (hci_result == HCI_SUCCESS) { p += sprintf(p, "running: %d\n", (value > 0)); p += sprintf(p, "force_on: %d\n", force_fan); } else { printk(MY_ERR "Error reading fan status\n"); } return p; } static unsigned long write_fan(const char *buffer, unsigned long count) { int value; u32 hci_result; if (sscanf(buffer, " force_on : %i", &value) == 1 && value >= 0 && value <= 1) { hci_write1(HCI_FAN, value, &hci_result); if (hci_result != HCI_SUCCESS) return -EFAULT; else force_fan = value; } else { return -EINVAL; } return count; } static char *read_keys(char *p) { u32 hci_result; u32 value; if (!hotkeys_over_acpi) { if (!key_event_valid) { hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { key_event_valid = 1; last_key_event = value; } else if (hci_result == HCI_EMPTY) { /* better luck next time */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* This is a workaround for an * unresolved issue on some machines * where system events sporadically * become disabled. */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); printk(MY_NOTICE "Re-enabled hotkeys\n"); } else { printk(MY_ERR "Error reading hotkey status\n"); goto end; } } } else { key_event_valid = 0; last_key_event = 0; } p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); p += sprintf(p, "hotkeys_via_acpi: %d\n", hotkeys_over_acpi); end: return p; } static unsigned long write_keys(const char *buffer, unsigned long count) { int value; if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) { key_event_valid = 0; } else { return -EINVAL; } return count; } static char *read_version(char *p) { p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION); p += sprintf(p, "proc_interface: %d\n", PROC_INTERFACE_VERSION); return p; } /* /dev/toshiba and /proc/toshiba handlers {{{ * * ISSUE: lots of magic numbers and mysterious code */ #define TOSH_MINOR_DEV 181 #define OLD_PROC_TOSHIBA "toshiba" static int tosh_acpi_bridge(SMMRegisters* regs) { acpi_status status; /* assert(sizeof(SMMRegisters) == sizeof(u32)*HCI_WORDS); */ status = hci_raw((u32*)regs, (u32*)regs); if (status == AE_OK && (regs->eax & 0xff00) == HCI_SUCCESS) return 0; return -EINVAL; } static int tosh_ioctl(struct inode* ip, struct file* fp, unsigned int cmd, unsigned long arg) { SMMRegisters regs; unsigned short ax,bx; int err; if ((!arg) || (cmd != TOSH_SMM)) return -EINVAL; if (copy_from_user(®s, (SMMRegisters*)arg, sizeof(SMMRegisters))) return -EFAULT; ax = regs.eax & 0xff00; bx = regs.ebx & 0xffff; /* block HCI calls to read/write memory & PCI devices */ if (((ax==HCI_SET) || (ax==HCI_GET)) && (bx>0x0069)) return -EINVAL; err = tosh_acpi_bridge(®s); if (copy_to_user((SMMRegisters*)arg, ®s, sizeof(SMMRegisters))) return -EFAULT; return err; } static int tosh_get_machine_id(void __iomem *bios) { int id; unsigned short bx,cx; unsigned long address; id = (0x100*(int) readb(bios+0xfffe))+((int) readb(bios+0xfffa)); /* do we have a SCTTable machine identication number on our hands */ if (id==0xfc2f) { bx = 0xe6f5; /* cheat */ /* now twiddle with our pointer a bit */ address = 0x00000000 + bx; cx = readw(bios + address); address = 0x00000009 + bx + cx; cx = readw(bios + address); address = 0x0000000a + cx; cx = readw(bios + address); /* now construct our machine identification number */ id = ((cx & 0xff)<<8)+((cx & 0xff00)>>8); } return id; } static int tosh_id; static int tosh_bios; static int tosh_date; static int tosh_sci; static struct file_operations tosh_fops = { .owner = THIS_MODULE, .ioctl = tosh_ioctl }; static struct miscdevice tosh_device = { TOSH_MINOR_DEV, "toshiba", &tosh_fops }; static void setup_tosh_info(void __iomem *bios) { int major, minor; int day, month, year; tosh_id = tosh_get_machine_id(bios); /* get the BIOS version */ major = readb(bios + 0xe009)-'0'; minor = ((readb(bios + 0xe00b)-'0')*10)+(readb(bios + 0xe00c)-'0'); tosh_bios = (major*0x100)+minor; /* get the BIOS date */ day = ((readb(bios + 0xfff5)-'0')*10)+(readb(bios + 0xfff6)-'0'); month = ((readb(bios + 0xfff8)-'0')*10)+(readb(bios + 0xfff9)-'0'); year = ((readb(bios + 0xfffb)-'0')*10)+(readb(bios + 0xfffc)-'0'); tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6) | ((day & 0x1f)<<1); } /* /proc/toshiba read handler */ static int tosh_proc_show(struct seq_file *m, void *v) { /* TODO: tosh_fn_status() */ int key = 0; /* Format: * 0) Linux driver version (this will change if format changes) * 1) Machine ID * 2) SCI version * 3) BIOS version (major, minor) * 4) BIOS date (in SCI date format) * 5) Fn Key status */ seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n", tosh_id, (tosh_sci & 0xff00)>>8, tosh_sci & 0xff, (tosh_bios & 0xff00)>>8, tosh_bios & 0xff, tosh_date, key); return 0; } static int tosh_proc_open(struct inode *inode, struct file *file) { return single_open(file, tosh_proc_show, NULL); } static const struct file_operations tosh_proc_fops = { .owner = THIS_MODULE, .open = tosh_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int __init old_driver_emulation_init(void) { int status; void __iomem *bios = ioremap(0xf0000, 0x10000); if (!bios) return -ENOMEM; if ((status = misc_register(&tosh_device))) { printk(MY_ERR "failed to register misc device %d (\"%s\")\n", tosh_device.minor, tosh_device.name); return status; } setup_tosh_info(bios); proc_create(OLD_PROC_TOSHIBA, 0, NULL, &tosh_proc_fops); iounmap(bios); return 0; } static void __exit old_driver_emulation_exit(void) { remove_proc_entry(OLD_PROC_TOSHIBA, NULL); misc_deregister(&tosh_device); } /* }}} end of /dev/toshiba and /proc/toshiba handlers */ /* proc and module init */ #define PROC_TOSHIBA "toshiba" static ProcItem proc_items[] = { {"lcd", read_lcd, write_lcd}, {"video", read_video, write_video}, {"fan", read_fan, write_fan}, {"keys", read_keys, write_keys}, {"version", read_version, NULL}, {NULL} }; static acpi_status __init add_device(void) { struct proc_dir_entry *proc; ProcItem *item; for (item = proc_items; item->name; ++item) { proc = create_proc_read_entry(item->name, S_IFREG | S_IRUGO | S_IWUSR, toshiba_proc_dir, (read_proc_t *) dispatch_read, item); if (proc) proc->owner = THIS_MODULE; if (proc && item->write_func) proc->write_proc = (write_proc_t *) dispatch_write; } return AE_OK; } static acpi_status remove_device(void) { ProcItem *item; for (item = proc_items; item->name; ++item) remove_proc_entry(item->name, toshiba_proc_dir); return AE_OK; } static struct backlight_ops toshiba_backlight_data = { .get_brightness = get_lcd, .update_status = set_lcd_status, }; static struct semaphore thread_sem; static int thread_should_die; static struct acpi_device *threaded_device = 0; static void thread_deliver_button_event(u32 value) { if (!threaded_device) return; if( value == 0x0100 ) { /* Ignore FN on its own */ } else if( value & 0x80 ) { acpi_bus_generate_proc_event( threaded_device, 1, value & ~0x80 ); } else { acpi_bus_generate_proc_event( threaded_device, 0, value ); } } static int toshiba_acpi_thread(void *data) { int dropped = 0; u32 hci_result, value; daemonize("ktoshkeyd"); set_user_nice(current, 4); thread_should_die = 0; up(&thread_sem); do { /* In case we get stuck; we can rmmod the module here */ if (thread_should_die) break; hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { dropped++; } else if (hci_result == HCI_EMPTY) { /* better luck next time */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* This is a workaround for an unresolved issue on * some machines where system events sporadically * become disabled. */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); printk(MY_NOTICE "Re-enabled hotkeys\n"); } } while (hci_result != HCI_EMPTY); printk(MY_INFO "Dropped %d keys from the queue on startup\n", dropped); for (;;) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ / hotkeys_check_per_sec); if (thread_should_die) break; if (try_to_freeze()) continue; do { hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { thread_deliver_button_event(value); } else if (hci_result == HCI_EMPTY) { /* better luck next time */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* This is a workaround for an * unresolved issue on some machines * where system events sporadically * become disabled. */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); printk(MY_NOTICE "Re-enabled hotkeys\n"); } } while (hci_result == HCI_SUCCESS); } set_user_nice(current, -20); /* Become nasty so we are cleaned up * before the module exits making us oops */ up(&thread_sem); return 0; } static int acpi_toshkeys_add (struct acpi_device *device) { threaded_device = device; strcpy(acpi_device_name(device), "Toshiba laptop hotkeys"); strcpy(acpi_device_class(device), "hkey"); return 0; } static int acpi_toshkeys_remove (struct acpi_device *device, int type) { if (threaded_device == device) threaded_device = 0; return 0; } static const struct acpi_device_id acpi_toshkeys_ids[] = { { "TOS6200", 0 }, { "TOS6207", 0 }, { "TOS6208", 0 }, {"", 0} }; static struct acpi_driver acpi_threaded_toshkeys = { .name = "Toshiba laptop hotkeys driver", .class = "hkey", .ids = acpi_toshkeys_ids, .ops = { .add = acpi_toshkeys_add, .remove = acpi_toshkeys_remove, }, }; static int __init init_threaded_acpi(void) { acpi_status result = AE_OK; result = acpi_bus_register_driver(&acpi_threaded_toshkeys); if( result < 0 ) printk(MY_ERR "Registration of toshkeys acpi device failed\n"); return result; } static void kill_threaded_acpi(void) { acpi_bus_unregister_driver(&acpi_threaded_toshkeys); } static void toshiba_acpi_exit(void) { if (toshiba_acpi.poll_dev) { input_unregister_polled_device(toshiba_acpi.poll_dev); input_free_polled_device(toshiba_acpi.poll_dev); } if (toshiba_acpi.rfk_dev) rfkill_unregister(toshiba_acpi.rfk_dev); if (toshiba_backlight_device) backlight_device_unregister(toshiba_backlight_device); if (hotkeys_over_acpi) { thread_should_die = 1; down(&thread_sem); kill_threaded_acpi(); } remove_device(); if (toshiba_proc_dir) remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); old_driver_emulation_exit(); platform_device_unregister(toshiba_acpi.p_dev); return; } static int __init toshiba_acpi_init(void) { acpi_status status = AE_OK; u32 hci_result; bool bt_present; bool bt_on; bool radio_on; int ret = 0; if (acpi_disabled) return -ENODEV; /* simple device detection: look for HCI method */ if (is_valid_acpi_path(METHOD_HCI_1)) method_hci = METHOD_HCI_1; else if (is_valid_acpi_path(METHOD_HCI_2)) method_hci = METHOD_HCI_2; else return -ENODEV; printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n", TOSHIBA_ACPI_VERSION); printk(MY_INFO " HCI method: %s\n", method_hci); mutex_init(&toshiba_acpi.mutex); toshiba_acpi.p_dev = platform_device_register_simple("toshiba_acpi", -1, NULL, 0); if (IS_ERR(toshiba_acpi.p_dev)) { ret = PTR_ERR(toshiba_acpi.p_dev); printk(MY_ERR "unable to register platform device\n"); toshiba_acpi.p_dev = NULL; toshiba_acpi_exit(); return ret; } if ((ret = old_driver_emulation_init())) return ret; force_fan = 0; key_event_valid = 0; /* enable event fifo */ hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); toshiba_proc_dir = proc_mkdir(PROC_TOSHIBA, acpi_root_dir); if (!toshiba_proc_dir) { toshiba_acpi_exit(); return -ENODEV; } else { toshiba_proc_dir->owner = THIS_MODULE; status = add_device(); if (ACPI_FAILURE(status)) { toshiba_acpi_exit(); return -ENODEV; } } toshiba_backlight_device = backlight_device_register("toshiba", &toshiba_acpi.p_dev->dev, NULL, &toshiba_backlight_data); if (IS_ERR(toshiba_backlight_device)) { ret = PTR_ERR(toshiba_backlight_device); printk(KERN_ERR "Could not register toshiba backlight device\n"); toshiba_backlight_device = NULL; toshiba_acpi_exit(); return ret; } toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; if (hotkeys_over_acpi && ACPI_SUCCESS(status)) { printk(MY_INFO "Toshiba hotkeys are sent as ACPI events\n"); if (hotkeys_check_per_sec < 1) hotkeys_check_per_sec = 1; if (hotkeys_check_per_sec > 10) hotkeys_check_per_sec = 10; printk(MY_INFO "ktoshkeyd will check %d time%s per second\n", hotkeys_check_per_sec, hotkeys_check_per_sec==1?"":"s"); if (init_threaded_acpi() >= 0) { init_MUTEX_LOCKED(&thread_sem); kernel_thread(toshiba_acpi_thread, NULL, CLONE_KERNEL); down(&thread_sem); } else { remove_device(); remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); status = AE_ERROR; printk(MY_INFO "ktoshkeyd initialisation failed. Refusing to load module\n"); } } /* Register rfkill switch for Bluetooth */ if (hci_get_bt_present(&bt_present) == HCI_SUCCESS && bt_present) { toshiba_acpi.rfk_dev = rfkill_allocate(&toshiba_acpi.p_dev->dev, RFKILL_TYPE_BLUETOOTH); if (!toshiba_acpi.rfk_dev) { printk(MY_ERR "unable to allocate rfkill device\n"); toshiba_acpi_exit(); return -ENOMEM; } toshiba_acpi.rfk_dev->name = toshiba_acpi.bt_name; toshiba_acpi.rfk_dev->toggle_radio = bt_rfkill_toggle_radio; toshiba_acpi.rfk_dev->user_claim_unsupported = 1; toshiba_acpi.rfk_dev->data = &toshiba_acpi; if (hci_get_bt_on(&bt_on) == HCI_SUCCESS && bt_on) { toshiba_acpi.rfk_dev->state = RFKILL_STATE_UNBLOCKED; } else if (hci_get_radio_state(&radio_on) == HCI_SUCCESS && radio_on) { toshiba_acpi.rfk_dev->state = RFKILL_STATE_SOFT_BLOCKED; } else { toshiba_acpi.rfk_dev->state = RFKILL_STATE_HARD_BLOCKED; } ret = rfkill_register(toshiba_acpi.rfk_dev); if (ret) { printk(MY_ERR "unable to register rfkill device\n"); toshiba_acpi_exit(); return -ENOMEM; } /* Register input device for kill switch */ toshiba_acpi.poll_dev = input_allocate_polled_device(); if (!toshiba_acpi.poll_dev) { printk(MY_ERR "unable to allocate kill-switch input device\n"); toshiba_acpi_exit(); return -ENOMEM; } toshiba_acpi.poll_dev->private = &toshiba_acpi; toshiba_acpi.poll_dev->poll = bt_poll_rfkill; toshiba_acpi.poll_dev->poll_interval = 1000; /* msecs */ toshiba_acpi.poll_dev->input->name = toshiba_acpi.rfk_name; toshiba_acpi.poll_dev->input->id.bustype = BUS_HOST; /* Toshiba USB ID */ toshiba_acpi.poll_dev->input->id.vendor = 0x0930; set_bit(EV_SW, toshiba_acpi.poll_dev->input->evbit); set_bit(SW_RFKILL_ALL, toshiba_acpi.poll_dev->input->swbit); input_report_switch(toshiba_acpi.poll_dev->input, SW_RFKILL_ALL, TRUE); input_sync(toshiba_acpi.poll_dev->input); ret = input_register_polled_device(toshiba_acpi.poll_dev); if (ret) { printk(MY_ERR "unable to register kill-switch input device\n"); toshiba_acpi_exit(); return ret; } } return 0; } module_init(toshiba_acpi_init); module_exit(toshiba_acpi_exit); debian/patches/0000775000000000000000000000000011756647424010637 5ustar debian/patches/05_toshsat1800-irdasetup_types.patch0000664000000000000000000000334011671233504017366 0ustar Author: Matej Vela Description: pciutils 2.2.0 and later no longer exports `byte'; use `u8' instead (backwards-compatible). --- trunk.orig/toshsat1800-irdasetup-0.2/toshsat1800-irdasetup.c +++ trunk/toshsat1800-irdasetup-0.2/toshsat1800-irdasetup.c @@ -70,8 +70,8 @@ struct port_decoding_access_info { int port; - byte reg; - byte or_mask; + u8 reg; + u8 or_mask; }; struct port_decoding_access_info ali1533_ports[]= @@ -118,7 +118,7 @@ struct smc_chip_model { char *name; - byte version_id; + u8 version_id; int (*config_function)(int revision, int cfgbase, int sirbase, int firbase, int dma, int irq); }; @@ -277,7 +277,7 @@ print_ali1533_port_status(struct pci_dev *dev) { struct port_decoding_access_info *p; - byte onebyte; + u8 onebyte; int i; DEBUG("printing port status"); @@ -304,7 +304,7 @@ set_ali1533_port(struct pci_dev *dev, int port, int decode) { struct port_decoding_access_info info; - byte previousval, onebyte, and_mask; + u8 previousval, onebyte, and_mask; int retval; DEBUG_VAL("looking for port", port); @@ -366,7 +366,7 @@ struct pci_filter filter; int ports[2], port_previous_mode, i; char *val; - byte byte; + u8 byte; access = pci_alloc(); if(access==NULL) @@ -454,7 +454,7 @@ static int configure_47N227_smc_ircc(int revision, int cfgbase, int sirbase, int firbase, int dma, int irq) { - byte onebyte; + u8 onebyte; int retval; DEBUG_VAL("trying to init SMC with cfgbase", cfgbase); @@ -560,7 +560,7 @@ static int configure_smc_ircc(int cfgbase, int sirbase, int firbase, int dma, int irq) { - byte version_id, revision_id, onebyte; + u8 version_id, revision_id, onebyte; struct smc_chip_model *chip_model; void *config_function; int retval; debian/patches/07_Makefile_mkdir.patch0000664000000000000000000000066411671233504015061 0ustar Author: Roberto C. Sanchez Description: Create directory, rather than try to execute it --- trunk.orig/Makefile.in +++ trunk/Makefile.in @@ -304,7 +304,7 @@ install: all @mkdir -p $(DESTDIR)$(BINDESTDIR) @mkdir -p $(DESTDIR)$(MANDESTDIR) - $(DESTDIR)/pm/sleep.d/ + @mkdir -p $(DESTDIR)/etc/pm/sleep.d/ for program in $(PROGRAMS); do \ $(BININSTALL) $$program $(DESTDIR)/$(BINDESTDIR)/$$program;\ done debian/patches/08_novatel_3g_suspend.patch0000664000000000000000000000352611671233537015767 0ustar Author: Roberto C. Sanchez Description: Script that was omitted from the release by upstream --- /dev/null +++ trunk/novatel_3g_suspend @@ -0,0 +1,34 @@ +#! /bin/sh + +# This script puts the Novatel 3G modem in Toshiba Portege R500 to USB +# suspend before going to sleep. Otherwise it may be in a weird state +# after wakeup, namely everything looks fine from various AT commands, +# the modem is registered to the cell network and reports a suitable +# signal strength, but attempting to dial out by atdt*99# or, it seems, +# any other number and the modem just responds instantly with NO CARRIER. + +# No amount of fiddling with the radio kill switch, unloading the +# option and usb_serial drivers, disabling and enabling the RF side +# via HCI (toshset -3g) or doing a USB port reset (usb_reset) or USB +# suspending and waking the device seems to help. Rebooting works, +# going to sleep again and waking works sometimes too. + +# USB bus and device, see for example lsusb|grep 3G output: +# Bus 002 Device 002: ID 0930:1302 Toshiba Corp. Wireless +# Broadband (3G HSDPA) SM-Bus Minicard Status Port +BUS=2 +DEVICE=2 + +if [ ! -x /sys/bus/usb/devices/${BUS}-${DEVICE}/power/level ]; then + exit 0 +fi + +case $1 in + suspend|suspend_hybrid|hibernate) + echo suspend > /sys/bus/usb/devices/${BUS}-${DEVICE}/power/level + ;; + resume|thaw) + # No need to do anything here, kernel unsuspends USB devices + : + ;; +esac --- trunk.orig/Makefile.in +++ trunk/Makefile.in @@ -308,7 +308,7 @@ for program in $(PROGRAMS); do \ $(BININSTALL) $$program $(DESTDIR)/$(BINDESTDIR)/$$program;\ done - $(BININSTALL) novatel_3g_suspend $(DESTDIR)/pm/sleep.d/ + $(BININSTALL) ../novatel_3g_suspend $(DESTDIR)/etc/pm/sleep.d/ (cd ..;\ for manpage in $(MANPAGES); do \ $(MANINSTALL) $$manpage $(DESTDIR)/$(MANDESTDIR)/$$manpage;\ debian/patches/01_honor_CXX.patch0000664000000000000000000000076311671233504014017 0ustar Author: Rene Engelhard Description: honor CXX --- trunk.orig/Makefile.in +++ trunk/Makefile.in @@ -154,7 +154,7 @@ PROGRAMS = @PROGRAMS@ MANPAGES = @MANPAGES@ CC = @CC@ -#CXX= g++ +CXX= @CXX@ DEFS = -DUSE_KERNEL_INTERFACE #CFLAGS = -march=i486 -Wall @OS_CFLAGS@ @DEBUGFLAGS@ CFLAGS = -Wall @OS_CFLAGS@ @DEBUGFLAGS@ --- trunk.orig/configure.in +++ trunk/configure.in @@ -37,6 +37,7 @@ AC_PROG_MAKE_SET AC_PROG_CC +AC_PROG_CXX AC_PROG_INSTALL dnl Checks for libraries. debian/patches/ftbfs-gcc-4.7.diff0000600000000000000000000000047311756647374013633 0ustar --- toshset-1.76.orig/cdsString.cc +++ toshset-1.76/cdsString.cc @@ -503,7 +503,7 @@ operator>>(istream& s, // read in up to (not including) white space // { - long flags = s.flags(); + std::ios_base::fmtflags flags = s.flags(); if (flags & ios::skipws) s >> ws; s.unsetf(ios::skipws); x = ""; debian/patches/03_toshsat1800-irdasetup.patch0000664000000000000000000011635311671233504016151 0ustar Author: Description: Adds a utility to support Satellite 1800 IrDA --- /dev/null +++ trunk/toshsat1800-irdasetup-0.2/CHANGELOG @@ -0,0 +1 @@ +2002/04/07 Added ports 0x178 and 0x130 --- /dev/null +++ trunk/toshsat1800-irdasetup-0.2/COPYING @@ -0,0 +1,340 @@ + 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) 19yy + + 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) 19yy 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. --- /dev/null +++ trunk/toshsat1800-irdasetup-0.2/Makefile @@ -0,0 +1,2 @@ +toshsat1800-irdasetup: toshsat1800-irdasetup.c + gcc -g -O2 -o toshsat1800-irdasetup toshsat1800-irdasetup.c -lpci -lz --- /dev/null +++ trunk/toshsat1800-irdasetup-0.2/README @@ -0,0 +1,77 @@ +toshsat1800-irdasetup + +Version 0.2 2002/04/07 15:42 + +Description: + +IrDA configurator for laptops with ALI1533 bridge (LPC47N227 SuperIO), smc-ircc +and not initializing BIOS (tested on Toshiba Satellite 1800-514) to be +used with Linux kernel. +Copyright (C) 2002, Daniele Peri + +http://lancelot.csai.unipa.it/~peri/toshsat1800-irdasetup.tgz + +Problem: + +Toshiba Satellite 1800 laptops are provided with a SMCS LPC47N227 SuperIO chip which is IrDA SIR/FIR capable. The chip is connected through an ALI1533 PCI-ISA bridge. The IrDA subsystem of the SuperIO chip is supported by the smc-ircc Linux kernel module. Unfortunately the BIOS neither configurates the SuperIO chip IrDA subsystem (SIR port, FIR port, dma, irq, IrDA mode, power) nor sets the PCI-ISA bridge to decode any usable port. +Linux kernel is thus prevented to detect the second UART making impossible to use it in SIR mode. For the same reason, the FIR mode smc-ircc is able to detect the SuperIO chip but, once found the IrDA subsystem unconfigured, fails to install. + +Solution: + +toshsat1800-irdasetup sets SIR and FIR ioport addresses, DMA and IRQ of the SuperIO chip IrDA subsystem then powers on the second UART. It also configures the PCI-ISA bridge to decode SIR and FIR ports. All this configuration work should be rather done into the kernel but it was more practical and safe to make a small testing tool of it. It can be probably extended to include configuration kludges for other similar SuperIO and ISA bridge combination. +Testing was carried on a Toshiba Satellite 1800-514 with Linux kernel 2.4.17. +I hope this work could be helpful, it was quite funny to do it however. + +Compilation (Requires pci-utils): + + $ cd toshsat1800-irdasetup/ + $ make + +Usage: + +Run it as root: + $ ./toshsat1800-irdasetup + +then you can install the smc-ircc module: + $ modprobe smc-ircc + +I've noticed that the smc-ircc needs parameters ircc_sir and ircc_fir to be specified. So you'd probably add: + + options smc-ircc ircc_dma=3 ircc_irq=7 ircc_cfg=0x2e ircc_sir=0x2e8 ircc_fir=0x2f8 + +to /etc/modules.conf + +You may also want to add a line like: + + pre-install smc-ircc /usr/local/sbin/toshsat1800-smcinit + +to /etc/modules.conf in order to obtain full automatic IrDA setup. +You'll need to execute: + + $ depmod -a + +after modifying /etc/modules.conf to make changes effective. + +Default values works for Toshiba Satellite 1800 though any configuration value can be changed through options. So far I've discovered how to enable decoding of the following usable ports: 0x2e8, 0x2f8, 0x130, 0x178. +The list of all options is obtaineable through: + + $ toshsat1800-irdasetup --help + + +Appendix: + +Ericsson T39m. Setting up an Ircomm link with this phone requires to explicitly reduce the maximum speed to 115200: + + $ echo 115200 > /proc/sys/net/irda/max_baud_rate + +Disclaimer: +This software is experimental. Use it at your own risk. + +Credits: + +* SMSC for the downloadable datasheets +* Paul Hampson for its Linux IrDA mailing list messages. + +To do: + +* Add more ALI1533 usable ports --- /dev/null +++ trunk/toshsat1800-irdasetup-0.2/toshsat1800-irdasetup.c @@ -0,0 +1,742 @@ +/* + * toshsat1800-irdasetup.c + * + * Version 0.2 2002/04/07 15:42 + * + * toshsat1800-irdasetup + * + * IrDA configurator for laptops with ALI1533 bridge (47n227 SuperIO), + * smc-ircc and not initializing BIOS (tested on Toshiba Satellite 1800-514) + * to be used with Linux kernel. + * Copyright (C) 2002, Daniele Peri + * + * http://lancelot.csai.unipa.it/~peri/toshsat1800-irdasetup.tgz + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Debug Macros + */ + +#undef DEBUG_ON + +#ifdef DEBUG_ON +static int _debug= 0; +#define DEBUG_LEVEL(level) _debug=level +#define DEBUG(label) if(_debug){fprintf(stderr, "%s: %s\n", PROGNAME, label);} +#define DEBUG_VAL(label, val) if(_debug){fprintf(stderr, "%s: %s: 0x%x\n", PROGNAME, label, val);} +#define DEBUG_STRING(label, val) if(_debug){fprintf(stderr, "%s: %s: %s\n", PROGNAME, label, val);} +#endif +#ifndef DEBUG_ON +#define DEBUG_LEVEL(level) +#define DEBUG(label) +#define DEBUG_VAL(label, val) +#define DEBUG_STRING(label, val) +#endif + +#define ERROR(label) fprintf(stderr, "%s: %s: %s\n", PROGNAME, label, strerror(errno)); + +#define PROGNAME "toshsat1800-irdasetup" +#define VERSION "0.2 2002/04/07 15:42" +#define AUTHOR "Daniele Peri" +#define AUTHOR_EMAIL "" + +/* + * ALI 1533 bitmapped decode addresses + */ +struct port_decoding_access_info +{ + int port; + byte reg; + byte or_mask; +}; + +struct port_decoding_access_info ali1533_ports[]= +{ + {0x130, 0xb0, 0x80}, /* this sounds confusing: */ + {0x178, 0xb0, 0x80}, /* both ports are decoded */ + + {0x3f8, 0xb4, 0x80}, + {0x2f8, 0xb4, 0x30}, /* bit 4 enables decoding, bit 5 enables something unknown it can't stand without...*/ + {0x2e8, 0xb4, 0x08}, + /* the followings are all the active bits in the default bitmap of + Satellite1800-514: + + {0x3f8, 0xb4, 0x80}, + {0x???, 0xb6, 0x80}, + {0x???, 0xb6, 0x80}, + {0x???, 0xb7, 0x40}, + {0x???, 0xb7, 0x20}, + {0x???, 0xb7, 0x10}, + {0x???, 0xb7, 0x02}, + {0x???, 0xb8, 0x80}, + {0x???, 0xb8, 0x40}, + {0x???, 0xb8, 0x02}, + {0x???, 0xb9, 0x04}, + {0x???, 0xb9, 0x02}, + + According to Paul Hampson decoded ISA ports are thus: + 2e, 2f, 62, 66, 60, 64, 378-37f, 778-77f, 2f0-2f5, 3f7, 3f8-3ff + + Unfortunately I don't have any other information about the ALI1533. + */ + {0, 0, 0} +}; + +/* SMC-IRCC + * + * + */ + +/* Chip specific config function(s) */ +static int +configure_47N227_smc_ircc(int revision, int cfgbase, int sirbase, int firbase, int dma, int irq); + +struct smc_chip_model +{ + char *name; + byte version_id; + int (*config_function)(int revision, int cfgbase, int sirbase, int firbase, int dma, int irq); +}; + +static struct smc_chip_model smc_chips[]= +{ + {"LPC47N227", 0x5a, configure_47N227_smc_ircc }, + {NULL, 0, NULL} +}; + +/* + * LPC47N227 + */ + +#define LPC47N227_CFGACCESSKEY 0x55 +#define LPC47N227_CFGEXITKEY 0xaa + +/* Register 0x00 */ +#define LPC47N227_FDCPOWERVALIDCONF_REG 0x00 +#define LPC47N227_FDCPOWER_MASK 0x08 +#define LPC47N227_VALID_MASK 0x80 + +/* Register 0x02 */ +#define LPC47N227_UART12POWER_REG 0x02 +#define LPC47N227_UART1POWERDOWN_MASK 0x08 +#define LPC47N227_UART2POWERDOWN_MASK 0x80 + +/* Register 0x07 */ +#define LPC47N227_APMBOOTDRIVE_REG 0x07 +#define LPC47N227_PARPORT2AUTOPWRDOWN_MASK 0x10 /* auto power down on if set */ +#define LPC47N227_UART2AUTOPWRDOWN_MASK 0x20 /* auto power down on if set */ +#define LPC47N227_UART1AUTOPWRDOWN_MASK 0x40 /* auto power down on if set */ + +/* Register 0x0c */ +#define LPC47N227_UARTMODE0C_REG 0x0c +#define LPC47N227_UART2MODE_MASK 0x38 +#define LPC47N227_UART2MODE_VAL_COM 0x00 +#define LPC47N227_UART2MODE_VAL_IRDA 0x08 +#define LPC47N227_UART2MODE_VAL_ASKIR 0x10 + +/* Register 0x0d */ +#define LPC47N227_DEVICEID_REG 0x0d +#define LPC47N227_DEVICEID_DEFVAL 0x5a + +/* Register 0x0e */ +#define LPC47N227_REVISIONID_REG 0x0e + +/* Register 0x25 */ +#define LPC47N227_UART2BASEADDR_REG 0x25 + +/* Register 0x28 */ +#define LPC47N227_UARTIRQSELECT_REG 0x28 +#define LPC47N227_UART2IRQSELECT_MASK 0x0f +#define LPC47N227_UART1IRQSELECT_MASK 0xf0 +#define LPC47N227_UARTIRQSELECT_VAL_NONE 0x00 + +/* Register 0x2b */ +#define LPC47N227_FIRBASEADDR_REG 0x2b + +/* Register 0x2c */ +#define LPC47N227_FIRDMASELECT_REG 0x2c +#define LPC47N227_FIRDMASELECT_MASK 0x0f +#define LPC47N227_FIRDMASELECT_VAL_DMA1 0x01 /* 47n227 has three dma channels */ +#define LPC47N227_FIRDMASELECT_VAL_DMA2 0x02 +#define LPC47N227_FIRDMASELECT_VAL_DMA3 0x03 +#define LPC47N227_FIRDMASELECT_VAL_NONE 0x0f + + +/* + * Defaults values for Toshiba Satellite 1800-514 + */ +#define DEF_CFGBASE 0x2e +#define DEF_SIRBASE 0x2e8 +#define DEF_FIRBASE 0x2f8 +#define DEF_DMA 0x03 +#define DEF_IRQ 0x07 +#define DEF_ISABRIDGE_VENDOR_ID 0x10b9 +#define DEF_ISABRIDGE_DEVICE_ID 0x1533 + +/* + * Actions + */ +#define ACTION_CONFIG_ALI1533_PORTS_DECODING 1 +#define ACTION_INIT_SMC_IRCC 2 +#define ACTION_PRINT_ALI1533_CONFIGURATION 4 +#define DEF_ACTIONS ACTION_CONFIG_ALI1533_PORTS_DECODING | ACTION_INIT_SMC_IRCC + +struct option options[]= { + {"skip-decoding-cfg", no_argument, NULL, 'a'}, + {"skip-smc-ircc-cfg", no_argument, NULL, 'b'}, + {"vendor", required_argument, NULL, 'v'}, + {"device", required_argument, NULL, 'x'}, + {"cfgbase", required_argument, NULL, 'c'}, + {"sirbase", required_argument, NULL, 's'}, + {"firbase", required_argument, NULL, 'f'}, + {"dma", required_argument, NULL, 'm'}, + {"irq", required_argument, NULL, 'i'}, + {"print", no_argument, NULL, 'p'}, + {"help", no_argument, NULL, 'h'}, + #ifdef DEBUG_ON + {"debug", no_argument, NULL, 'd'}, + #endif + {NULL, 0, NULL, 0} +}; + +static char *options_explications[]= { + "\tskip ISA bridge decoding configuration", + "\tskip SMC-IRCC configuration", + "\tlook for the specified ISA bridge PCI vendor id", + "\tlook for the specified ISA bridge PCI device id", + "\tset SMC-IRCC IO cfgbase address", + "\tset SMC-IRCC IO sirbase address", + "\tset SMC-IRCC IO firbase address", + "\t\tset SMC-IRCC DMA channel", + "\t\tset SMC-IRCC IRQ", + "\t\tprint ISA bridge configuration", + "\t\tshow this help", + #ifdef DEBUG_ON + NULL, + #endif + NULL +}; + + +#ifdef DEBUG_ON +static char *short_options= "abpv:x:c:s:f:m:i:dh"; +#endif +#ifndef DEBUG_ON +static char *short_options= "abpv:x:c:s:f:m:i:h"; +#endif + +/* ALI 1533 */ + +static int +find_ali1533_port_access_info(long port, struct port_decoding_access_info *info) +{ + struct port_decoding_access_info *p; + int i; + + p= &ali1533_ports[0]; + i=0; + while(p->port!=0) + { + DEBUG_VAL("port", p->port); + if(p->port==port) + { + memcpy(info, p, sizeof(struct port_decoding_access_info)); + return 1; + } + i++; + p= &ali1533_ports[i]; + } + return 0; +} + +static int +print_ali1533_port_status(struct pci_dev *dev) +{ + struct port_decoding_access_info *p; + byte onebyte; + int i; + + DEBUG("printing port status"); + p= &ali1533_ports[0]; + i=0; + puts("ALi 1533 Decoding status:"); + while(p->port!=0) + { + DEBUG_VAL("port", p->port); + onebyte= pci_read_byte(dev, p->reg); + printf("port 0x%x %s\n", p->port, (onebyte & p->or_mask ? "enabled" : "disabled")); + i++; + p= &ali1533_ports[i]; + } + return 0; +} + +/* Sets ALi1533 port decoding mode and + * returns previous port decoding mode + * (0=disabled, 1=enabled, -1 port unknown) + */ + +static int +set_ali1533_port(struct pci_dev *dev, int port, int decode) +{ + struct port_decoding_access_info info; + byte previousval, onebyte, and_mask; + int retval; + + DEBUG_VAL("looking for port", port); + retval= find_ali1533_port_access_info(port, &info); + if(retval) + { + previousval= pci_read_byte(dev, info.reg); + DEBUG_VAL("current register value", previousval); + and_mask= ~info.or_mask; + DEBUG_VAL("and with mask", and_mask); + onebyte= previousval & and_mask; + if(decode) + { + DEBUG_VAL("or with mask", info.or_mask); + onebyte |= info.or_mask; + } + DEBUG_VAL("writing value", onebyte); + pci_write_byte(dev, info.reg, onebyte); + return (previousval & info.or_mask) ? 1 : 0; + } + else DEBUG_VAL("unknown port", port); + return -1; +} + + +/* PCI */ + +static struct pci_dev* +find_pci_device(struct pci_access *access, struct pci_filter *filter) +{ + struct pci_dev *dev; + + DEBUG("scanning PCI busses"); + pci_scan_bus(access); + + DEBUG("looking for PCI device"); + for(dev=access->devices; dev; dev=dev->next) + { + if(pci_filter_match(filter, dev)) + { + DEBUG("device found"); + DEBUG_VAL("bus", dev->bus); + DEBUG_VAL("dev", dev->dev); + DEBUG_VAL("func", dev->func); + return dev; + } + } + return NULL; +} + +/* Configure ali1533 PCI-ISA bridge to decode + * SMC-IRCC ports + */ +static int +configure_ali1533_smc_ports_decoding(int vendor_id, int device_id, int cfgbase, int firbase, int sirbase, int print) +{ + struct pci_access *access; + struct pci_dev *dev= NULL; + struct pci_filter filter; + int ports[2], port_previous_mode, i; + char *val; + byte byte; + + access = pci_alloc(); + if(access==NULL) + { + DEBUG("impossible to obtain PCI access"); + return 0; + } + DEBUG("initializing filter"); + pci_filter_init(access, &filter); + filter.vendor= vendor_id; + filter.device= device_id; + + pci_init(access); + + dev= find_pci_device(access, &filter); + if(dev) + { + if(print) + { + print_ali1533_port_status(dev); + } + else + { + + syslog( + LOG_NOTICE, + "PCI device 0x%x:0x%x found at %02x:%02x:%02x. Configuring:", + vendor_id, + device_id, + dev->bus, + dev->dev, + dev->func + ); + ports[0]= sirbase; + ports[1]= firbase; + for(i=0; i<2; i++) + { + port_previous_mode= set_ali1533_port(dev, ports[i], 1); + if(port_previous_mode==1) + { + syslog( + LOG_ERR, + "port 0x%x was already enabled", + ports[i] + ); + } + else + { + syslog( + LOG_NOTICE, + "enabled decoding of port 0x%x", + ports[i] + ); + } + } + } + } + if(dev!=NULL) + { + syslog( + LOG_NOTICE, + "PCI device 0x%x:0x%x. Configuration ended", + vendor_id, + device_id + ); + + } + else + { + syslog(LOG_ERR, "PCI device 0x%x:0x%x not found", vendor_id, device_id); + } + pci_cleanup(access); + return dev!=NULL; +} + +/* SMC IRCC + * + * + */ + +/* Configure 47N227 SuperIO IrDA subsystem + * + */ + +static int +configure_47N227_smc_ircc(int revision, int cfgbase, int sirbase, int firbase, int dma, int irq) +{ + byte onebyte; + int retval; + + DEBUG_VAL("trying to init SMC with cfgbase", cfgbase); + retval= ioperm(cfgbase, 2, 1); + if(retval== -1) + { + syslog( + LOG_ERR, + "failed to obtain ioperm for cfgbase %m" + ); + + ERROR("failed to obtain ioperm for cfgbase"); + return 0; + } + + + outb(LPC47N227_CFGACCESSKEY, cfgbase); + /* + outb(LPC47N227_DEVICEID_REG, cfgbase); + if (inb(cfgbase+1) == LPC47N227_DEVICEID_DEFVAL) + { + */ + /*syslog(LOG_NOTICE, "LPC47N227 present. Configuring:");*/ + + /*SIR Base*/ + DEBUG_VAL("setting sirbase to", sirbase); + outb(LPC47N227_UART2BASEADDR_REG, cfgbase); + onebyte= sirbase>>2; + outb(onebyte, cfgbase+1); + + /* FIR Base */ + DEBUG_VAL("setting firbase to", firbase); + outb(LPC47N227_FIRBASEADDR_REG, cfgbase); + onebyte= firbase>>3; + outb(onebyte, cfgbase+1); + + /* DMA */ + DEBUG_VAL("setting dma to", dma); + outb(LPC47N227_FIRDMASELECT_REG, cfgbase); + outb(dma&LPC47N227_FIRDMASELECT_MASK, cfgbase+1); + + /* IRQ */ + DEBUG_VAL("setting irq to", irq); + outb(LPC47N227_UARTIRQSELECT_REG, cfgbase); + onebyte = inb(cfgbase+1); + onebyte &= LPC47N227_UART1IRQSELECT_MASK; + onebyte |= (irq & LPC47N227_UART2IRQSELECT_MASK); + outb(onebyte, cfgbase+1); + + syslog( + LOG_NOTICE, + "set sirbase=0x%x, firbase=0x%x, dma=%d, irq=%d", + sirbase, + firbase, + dma, + irq + ); + + DEBUG("setting other registers"); + + /* Set UART2 mode to IrDA */ + outb(LPC47N227_UARTMODE0C_REG, cfgbase); + onebyte = inb(cfgbase+1); + onebyte &= ~LPC47N227_UART2MODE_MASK | LPC47N227_UART2MODE_VAL_IRDA; + outb(onebyte, cfgbase+1); + + /* Set UART2 AUTO POWER DOWN */ + outb(LPC47N227_APMBOOTDRIVE_REG, cfgbase); + onebyte = inb(cfgbase+1); + outb(onebyte | LPC47N227_UART2AUTOPWRDOWN_MASK, cfgbase+1); + + /* Set UART2 POWER ON */ + outb(LPC47N227_UART12POWER_REG, cfgbase); + onebyte = inb(cfgbase+1); + outb(onebyte | LPC47N227_UART2POWERDOWN_MASK, cfgbase+1); + + syslog( + LOG_NOTICE, + "set UART 2 IR mode to IrDA, auto powerdown on and powered up" + ); + + /* Validate configuration */ + outb(LPC47N227_FDCPOWERVALIDCONF_REG, cfgbase); + onebyte = inb(cfgbase + 1); + outb(onebyte | LPC47N227_VALID_MASK, cfgbase + 1); + + outb(LPC47N227_CFGEXITKEY, cfgbase); + DEBUG("configuration ended"); + return 1; +} + +static struct smc_chip_model * +find_smc_chip_model(struct smc_chip_model *chips, int version_id) +{ + int i; + for(i=0; smc_chips[i].name!=NULL; i++) + { + if(smc_chips[i].version_id=version_id) return &smc_chips[i]; + } + return NULL; +} + +static int +configure_smc_ircc(int cfgbase, int sirbase, int firbase, int dma, int irq) +{ + byte version_id, revision_id, onebyte; + struct smc_chip_model *chip_model; + void *config_function; + int retval; + + DEBUG_VAL("trying to init SMC with cfgbase", cfgbase); + retval= ioperm(cfgbase, 2, 1); + if(retval== -1) + { + syslog( + LOG_ERR, + "failed to obtain ioperm for cfgbase %m" + ); + + ERROR("failed to obtain ioperm for cfgbase"); + return 0; + } + + outb(LPC47N227_CFGACCESSKEY, cfgbase); + outb(LPC47N227_DEVICEID_REG, cfgbase); + version_id= inb(cfgbase+1); + outb(LPC47N227_REVISIONID_REG, cfgbase); + revision_id= inb(cfgbase+1); + outb(LPC47N227_CFGEXITKEY, cfgbase); + + chip_model= find_smc_chip_model(smc_chips, version_id); + if(chip_model!=NULL) + { + syslog(LOG_NOTICE, "%s chip (ver 0x%x, rev 0x%x) found. Configuring:", chip_model->name, version_id, revision_id); + retval= (*(chip_model->config_function))(revision_id, cfgbase, sirbase, firbase, dma, irq); + syslog(LOG_NOTICE, "%s chip (ver 0x%x, rev 0x%x) configuration %ssuccessfully ended", chip_model->name, version_id, revision_id, (retval ? "" : "un")); + return 1; + } + else + { + syslog(LOG_ERR, "Unknown chip version 0x%", version_id); + return 0; + } +} + +static void +print_usage(struct option *options_array, char **options_explications_array) +{ + struct option *option; + char *option_explication=NULL; + int i; + + printf("%s %s %s\nUsage: %s [options]\nOptions:\n", PROGNAME, VERSION, AUTHOR, PROGNAME); + i=0; + option= &options_array[0]; + option_explication= options_explications_array[0]; + while(option->name!=NULL) + { + printf("-%c, --%s%s", option->val, option->name, (option->has_arg ? "=VALUE" : "")); + if(options_explications_array[i] != NULL) printf("%s\n", options_explications_array[i]); + else puts("\n"); + i++; + option=&options[i]; + option_explication= options_explications_array[i]; + } + printf("Report suggestions and bugs to: %s\n", AUTHOR " "AUTHOR_EMAIL); +} + +int +main(int argc, char **argv) +{ + int uid; + int cfgbase= DEF_CFGBASE; + int sirbase= DEF_SIRBASE; + int firbase= DEF_FIRBASE; + int dma= DEF_DMA; + int irq= DEF_IRQ; + int isabridge_vendor_id= DEF_ISABRIDGE_VENDOR_ID; + int isabridge_device_id= DEF_ISABRIDGE_DEVICE_ID; + int actions= DEF_ACTIONS; + int retval, opt; + + if(getuid()!=0) + { + fprintf(stderr, "%s can only be used by root\n", PROGNAME); + exit(1); + } + + while ((opt= getopt_long(argc, argv, short_options, options, NULL)) != -1) + { + switch(opt) + { + case 'a' : + { + actions &= ~ACTION_CONFIG_ALI1533_PORTS_DECODING; + break; + } + case 'b' : + { + actions &= ~ACTION_INIT_SMC_IRCC; + break; + } + case 'p' : + { + actions |= ACTION_PRINT_ALI1533_CONFIGURATION; + break; + } + case 'v' : + { + isabridge_vendor_id=strtoul(optarg, NULL, 0); + break; + } + case 'x' : + { + isabridge_device_id=strtoul(optarg, NULL, 0); + break; + } + case 'c' : + { + cfgbase=strtoul(optarg, NULL, 0); + break; + } + case 's' : + { + sirbase=strtoul(optarg, NULL, 0); + break; + } + case 'f' : + { + firbase=strtoul(optarg, NULL, 0); + break; + } + case 'm' : + { + dma=strtoul(optarg, NULL, 0); + break; + } + case 'i' : + { + irq=strtoul(optarg, NULL, 0); + break; + } + #ifdef DEBUG_ON + case 'd' : + { + DEBUG_LEVEL(1); + break; + } + #endif + case 'h' : + { + print_usage(options, options_explications); + exit(0); + break; + } + + default : + break; + } + } + + if(actions&(ACTION_INIT_SMC_IRCC | ACTION_CONFIG_ALI1533_PORTS_DECODING)) + { + syslog(LOG_INFO, "%s %s %s", PROGNAME, VERSION, AUTHOR); + } + + if(actions&ACTION_INIT_SMC_IRCC) + { + retval= configure_smc_ircc(cfgbase, sirbase, firbase, dma, irq); + } + + if(actions&ACTION_CONFIG_ALI1533_PORTS_DECODING && retval) + { + retval= configure_ali1533_smc_ports_decoding( + isabridge_vendor_id, + isabridge_device_id, + cfgbase, + firbase, + sirbase, + actions&ACTION_PRINT_ALI1533_CONFIGURATION + ); + } + + exit(!retval); +} debian/patches/04_toshset_man_page.patch0000664000000000000000000000330711671233504015470 0ustar Author: Description: Fixes a lintian warning in the man page --- trunk.orig/toshset.1 +++ trunk/toshset.1 @@ -14,9 +14,8 @@ Credit for the difficult task of reverse-engineering the Toshiba hardware interface goes to Jonathan Buzzard. A link for Jonathan's tools is -.hr http://www.buzzard.org.uk/toshiba/ - +.PP All options are listed by running toshset with no arguments. If an argument option is specified as the ``-'' character, stdin is @@ -54,7 +53,7 @@ .TP \fB\-q\fR \fI [glob]\fR query features specified by glob (all features if glob omitted). The -glob string is sandwiched between asterisks, so specifying -q bat will +glob string is sandwiched between asterisks, so specifying \-q bat will query all features whose names contain the ``bat'' substring. If no glob is given, then all features are queried. .PP @@ -69,7 +68,7 @@ set lcd brightness. .TP \fB\-inten\fR \fI\fR -set lcd brightness. Not all models support both -lcd and -inten. +set lcd brightness. Not all models support both \-lcd and \-inten. .TP \fB\-pow\fR \fI\fR set power-up mode @@ -144,7 +143,7 @@ the password. .TP \fB\-spasswd\fR -set the supervisor password. See the docs for -upasswd. +set the supervisor password. See the docs for \-upasswd. .TP \fB\-usblegacy\fR USB legacy mode: enable/disable using an USB mouse as it would be a PS/2 @@ -171,7 +170,7 @@ enable/disable the display's transreflective mode. Features may also be set by specifying the (zero-offset) index of the -option. e.g. toshset -cpu 0 sets the cpu speed to slow. +option. e.g. toshset \-cpu 0 sets the cpu speed to slow. .SH BUGS Many features are locked and can not be changed when the battery save debian/patches/series0000664000000000000000000000032711756647424012056 0ustar 01_honor_CXX.patch 03_toshsat1800-irdasetup.patch 04_toshset_man_page.patch 05_toshsat1800-irdasetup_types.patch 06_fix_FTBFS_with_gcc4.4.patch 07_Makefile_mkdir.patch 08_novatel_3g_suspend.patch ftbfs-gcc-4.7.diff debian/patches/06_fix_FTBFS_with_gcc4.4.patch0000664000000000000000000000035311671233504015757 0ustar Adding a missing include --- trunk.orig/cdsSStream.hh +++ trunk/cdsSStream.hh @@ -3,6 +3,7 @@ #ifndef __cdsSStream_hh__ #define __cdsSStream_hh__ +#include #include #include #include debian/rules0000775000000000000000000000406311737401176010262 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) NOOPT=1 else NOOPT=0 endif include /usr/share/quilt/quilt.make configure: configure-stamp configure-stamp: $(QUILT_STAMPFN) dh_testdir cp -a /usr/share/misc/config.sub . autoconf ./configure --prefix=/usr --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info if [ "$(NOOPT)" = "1" ]; then \ cat Makefile | sed -e s/"-O2"/"-O0"/ > out && \ mv out Makefile; \ fi touch configure-stamp build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) cd toshsat1800-irdasetup-0.2; $(MAKE) touch build-stamp clean: unpatch dh_testdir dh_testroot rm -f build-stamp configure-stamp rm -rf toshsat1800-irdasetup-0.2/ [ ! -f Makefile ] || $(MAKE) distclean dh_clean rm -f configure config.sub config.log confdefs.h install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/toshset # generate a supported-models.txt echo " ID Model " > \ $(CURDIR)/debian/toshset/usr/share/doc/toshset/supported-models.txt echo "-------------------------------------------------------" >> \ $(CURDIR)/debian/toshset/usr/share/doc/toshset/supported-models.txt cat toshibaIDs.cc | grep {0 | sed -e s/{// -e s/,\"// \ -e s/\"},// | sed -e s/"0 \" }"// >> \ $(CURDIR)/debian/toshset/usr/share/doc/toshset/supported-models.txt install -m 755 toshsat1800-irdasetup-0.2/toshsat1800-irdasetup debian/toshset/usr/sbin/ binary-indep: build install binary-arch: build install dh_testdir dh_testroot dh_installdocs README README.video debian/toshiba-acpi cp toshsat1800-irdasetup-0.2/README debian/toshset/usr/share/doc/toshset/README.IrDA dh_installman debian/toshsat1800-irdasetup.1 dh_installchangelogs ChangeLog dh_strip dh_compress -X.c dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian/toshsat1800-irdasetup.10000664000000000000000000000316310514170534013251 0ustar .TH TOSHSAT1800-IRDASETUP "1" "August 2005" "toshsat1800-irdasetup" "User Commands" .SH NAME toshsat1800-irdasetup \- IrDA setup utility for Toshiba Satellite 1800 .SH SYNOPSIS .B toshsat1800-irdasetup [\fIoptions\fR] .SH DESCRIPTION IrDA configurator for laptops with ALI1533 bridge (LPC47N227 SuperIO), smc-ircc and not initializing BIOS (tested on Toshiba Satellite 1800-514) to be used with Linux kernel. .SH OPTIONS .TP \fB\-a\fR, \fB\-\-skip\-decoding\-cfg\fR skip ISA bridge decoding configuration .TP \fB\-b\fR, \fB\-\-skip\-smc\-ircc\-cfg\fR skip SMC\-IRCC configuration .TP \fB\-v\fR, \fB\-\-vendor\fR=\fIVALUE\fR look for the specified ISA bridge PCI vendor id .TP \fB\-x\fR, \fB\-\-device\fR=\fIVALUE\fR look for the specified ISA bridge PCI device id .TP \fB\-c\fR, \fB\-\-cfgbase\fR=\fIVALUE\fR set SMC\-IRCC IO cfgbase address .TP \fB\-s\fR, \fB\-\-sirbase\fR=\fIVALUE\fR set SMC\-IRCC IO sirbase address .TP \fB\-f\fR, \fB\-\-firbase\fR=\fIVALUE\fR set SMC\-IRCC IO firbase address .TP \fB\-m\fR, \fB\-\-dma\fR=\fIVALUE\fR set SMC\-IRCC DMA channel .TP \fB\-i\fR, \fB\-\-irq\fR=\fIVALUE\fR set SMC\-IRCC IRQ .TP \fB\-p\fR, \fB\-\-print\fR print ISA bridge configuration .TP \fB\-h\fR, \fB\-\-help\fR show this help .SH SEE ALSO More detailed information in /usr/share/doc/toshset/README.IrDA or online at http://www.csai.unipa.it/peri/toshsat1800-irdasetup/ .SH AUTHOR toshsat1800-irdasetup was written by Daniele Peri . .PP This manual page was written by Roberto C. Sanchez , for the Debian project (but may be used by others).