Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f05937629b | ||
|
|
72259aaa8f | ||
|
|
48f9459b08 |
12 changed files with 751 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
apmud-1.0.0.tgz
|
||||
42
apmud-1.0.0-fb-ioctls.patch
Normal file
42
apmud-1.0.0-fb-ioctls.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
--- apmud/contrib/m3mirror.c~ 2006-09-11 07:52:55.000000000 +0100
|
||||
+++ apmud/contrib/m3mirror.c 2006-09-11 07:58:27.000000000 +0100
|
||||
@@ -5,16 +5,15 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
+#include <stdint.h>
|
||||
|
||||
#define ATY_MIRROR_LCD_ON 0x00000001
|
||||
#define ATY_MIRROR_CRT_ON 0x00000002
|
||||
|
||||
-#define __u32 unsigned int
|
||||
-
|
||||
/* out param: u32* backlight value: 0 to 15 */
|
||||
-#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, sizeof(__u32*))
|
||||
+#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, uint32_t)
|
||||
/* in param: u32* backlight value: 0 to 15 */
|
||||
-#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, sizeof(__u32*))
|
||||
+#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, uint32_t)
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
--- apmud/contrib/m6mirror.c~ 2006-09-11 07:52:55.000000000 +0100
|
||||
+++ apmud/contrib/m6mirror.c 2006-09-11 07:59:39.000000000 +0100
|
||||
@@ -5,14 +5,13 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
+#include <stdint.h>
|
||||
|
||||
#define ATY_RADEON_LCD_ON 0x00000001
|
||||
#define ATY_RADEON_CRT_ON 0x00000002
|
||||
|
||||
-#define __u32 unsigned int
|
||||
-
|
||||
-#define FBIO_RADEON_GET_MIRROR _IOR('@', 3, sizeof(__u32*))
|
||||
-#define FBIO_RADEON_SET_MIRROR _IOW('@', 4, sizeof(__u32*))
|
||||
+#define FBIO_RADEON_GET_MIRROR _IOR('@', 3, uint32_t)
|
||||
+#define FBIO_RADEON_SET_MIRROR _IOW('@', 4, uint32_t)
|
||||
|
||||
|
||||
static void
|
||||
20
apmud-1.0.0-fcntl.patch
Normal file
20
apmud-1.0.0-fcntl.patch
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--- apmud/pmud.c.orig 2005-02-13 19:06:41.000000000 +0000
|
||||
+++ apmud/pmud.c 2005-02-13 19:07:48.000000000 +0000
|
||||
@@ -367,7 +367,7 @@
|
||||
|
||||
chk(pmu_fd < 0, "Couldn't open " PMU_FILE " or " PMU_DEVFS_FILE);
|
||||
|
||||
- chk((fl = fcntl(pmu_fd, F_GETFL, fl)) < 0, "fcntl(F_GETFL)");
|
||||
+ chk((fl = fcntl(pmu_fd, F_GETFL, &fl)) < 0, "fcntl(F_GETFL)");
|
||||
|
||||
fl |= O_NONBLOCK;
|
||||
chk(fcntl(pmu_fd, F_SETFL, fl) < 0, "fcntl(F_SETFL)");
|
||||
@@ -1204,7 +1204,7 @@
|
||||
chk(fcntl(fe, F_GETFL, &fl) < 0, "fcntl(F_GETFL)");
|
||||
|
||||
fl |= O_NONBLOCK;
|
||||
- chk(fcntl(fe, F_SETFL, &fl) < 0, "fcntl(F_SETFL)");
|
||||
+ chk(fcntl(fe, F_SETFL, fl) < 0, "fcntl(F_SETFL)");
|
||||
|
||||
ss = malloc(sizeof(*ss));
|
||||
if (ss == 0)
|
||||
72
apmud-1.0.0-init.patch
Normal file
72
apmud-1.0.0-init.patch
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
--- apmud/pmud.rc.orig 2005-02-13 19:12:05.000000000 +0000
|
||||
+++ apmud/pmud.rc 2005-02-13 19:20:15.000000000 +0000
|
||||
@@ -17,26 +17,60 @@
|
||||
# Source power daemon options
|
||||
[ -f /etc/sysconfig/power ] && . /etc/sysconfig/power
|
||||
|
||||
-# See how we were called.
|
||||
-case "$1" in
|
||||
- start)
|
||||
- echo -n "Starting pmud daemon: "
|
||||
+RETVAL=0
|
||||
+
|
||||
+start() {
|
||||
+ RETVAL=1
|
||||
+ if grep -i "PowerBook" /proc/cpuinfo >/dev/null; then
|
||||
+ echo -n $"Starting pmud daemon: "
|
||||
+ /usr/bin/trackpad notap &> /dev/null
|
||||
daemon pmud $PMUD_FLAGS
|
||||
+ RETVAL=$?
|
||||
echo
|
||||
- touch /var/lock/subsys/pmud
|
||||
- ;;
|
||||
- stop)
|
||||
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pmud
|
||||
+ fi
|
||||
+ return $RETVAL
|
||||
+}
|
||||
+
|
||||
+stop() {
|
||||
+ RETVAL=1
|
||||
+ if grep -i "PowerBook" /proc/cpuinfo >/dev/null; then
|
||||
echo -n "Stopping pmud daemon: "
|
||||
killproc pmud
|
||||
+ RETVAL=$?
|
||||
echo
|
||||
rm -f /var/lock/subsys/pmud
|
||||
+ fi
|
||||
+ return $RETVAL
|
||||
+}
|
||||
+
|
||||
+# See how we were called.
|
||||
+case "$1" in
|
||||
+ start)
|
||||
+ start
|
||||
+ ;;
|
||||
+ stop)
|
||||
+ stop
|
||||
;;
|
||||
status)
|
||||
status pmud
|
||||
+ RETVAL=$?
|
||||
;;
|
||||
+ restart|reload)
|
||||
+ stop
|
||||
+ start
|
||||
+ RETVAL=$?
|
||||
+ ;;
|
||||
+ condrestart)
|
||||
+ if [ -f /var/lock/subsys/pmud ]; then
|
||||
+ stop
|
||||
+ start
|
||||
+ RETVAL=$?
|
||||
+ fi
|
||||
+ ;;
|
||||
*)
|
||||
- echo "Usage: pmud {start|stop|status}"
|
||||
+ echo "Usage: pmud {start|stop|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
-exit 0
|
||||
+exit $RETVAL
|
||||
11
apmud-1.0.0-open-mode.patch
Normal file
11
apmud-1.0.0-open-mode.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
--- apmud/pmud.c.orig 2007-08-22 14:47:58.000000000 +0100
|
||||
+++ apmud/pmud.c 2007-08-22 14:48:58.000000000 +0100
|
||||
@@ -1494,7 +1494,7 @@ static void do_signal(int signum)
|
||||
|
||||
static int do_sigpower(char level)
|
||||
{
|
||||
- int fd = open(POWERSTATUS_FILE, O_RDWR|O_TRUNC|O_CREAT);
|
||||
+ int fd = open(POWERSTATUS_FILE, O_RDWR|O_TRUNC|O_CREAT, 0644);
|
||||
if(fd < 0)
|
||||
{
|
||||
syslog(LOG_ALERT, "open of %s failed (%m) reverting to sleep",
|
||||
185
apmud.spec
Normal file
185
apmud.spec
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
%define _prefix /usr
|
||||
|
||||
Name: apmud
|
||||
Version: 1.0.0
|
||||
Release: 10%{?dist}
|
||||
|
||||
Summary: Power management daemon for Apple PowerPC laptops
|
||||
Source0: http://linuxppc.jvc.nl/apmud-%{version}.tgz
|
||||
Source1: trackpad.init
|
||||
Source2: trackpad.sysconfig
|
||||
Patch0: pmud-0.10-ydl.patch
|
||||
Patch1: apmud-1.0.0-init.patch
|
||||
Patch2: pmud-0.10-fixes.patch
|
||||
Patch3: apmud-1.0.0-fcntl.patch
|
||||
Patch4: apmud-1.0.0-fb-ioctls.patch
|
||||
Patch5: apmud-1.0.0-open-mode.patch
|
||||
License: GPLv2+
|
||||
Group: Utilities/System
|
||||
BuildRoot: %{_tmppath}/pmud-%{version}-buildroot
|
||||
BuildRequires: libX11-devel
|
||||
Prereq: chkconfig
|
||||
Obsoletes: trackpad, pmud
|
||||
ExclusiveArch: ppc
|
||||
|
||||
%description
|
||||
pmud is a daemon which periodically polls the PMU (power manager) and performs
|
||||
functions such as enabling or disabling devices appropriately when the power
|
||||
source changes. It can also be instructed to signal init(8) that a power-
|
||||
failure has occured. pmud works on Apple PowerBooks and iBooks.
|
||||
|
||||
A tool for configuring the trackpad on Apple PowerBooks and iBooks is
|
||||
also included. See /etc/sysconfig/trackpad.
|
||||
|
||||
Tools for enabling video mirroring for ATI Rage 128 Mobility (m3mirror)
|
||||
and ATI Radeon Mobility (m6mirror) enabled PowerBooks are also included.
|
||||
|
||||
%prep
|
||||
%setup -q -n apmud
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
%build
|
||||
make CFLAGS="$RPM_OPT_FLAGS"
|
||||
make CFLAGS="$RPM_OPT_FLAGS" -C contrib/
|
||||
|
||||
%install
|
||||
rm -fr $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/X11R6/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/power
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8
|
||||
|
||||
make PREFIX=$RPM_BUILD_ROOT install
|
||||
make PREFIX=$RPM_BUILD_ROOT -C contrib/ install
|
||||
|
||||
cd $RPM_BUILD_ROOT/usr/bin; ln -s ../../sbin/snooze apm
|
||||
|
||||
install -m755 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/trackpad
|
||||
install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/trackpad
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add pmud
|
||||
/sbin/chkconfig --add trackpad
|
||||
|
||||
%preun
|
||||
/sbin/chkconfig --del pmud
|
||||
/sbin/chkconfig --del trackpad
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc TODO BUGS README INSTALL CHANGES THANKS
|
||||
/sbin/pmud
|
||||
/sbin/snooze
|
||||
/sbin/wakebay
|
||||
/sbin/fblevel
|
||||
%{_prefix}/sbin/m3mirror
|
||||
%{_prefix}/sbin/m6mirror
|
||||
%{_prefix}/bin/apm
|
||||
%{_prefix}/bin/Batmon
|
||||
%{_prefix}/bin/trackpad
|
||||
%{_prefix}/X11R6/bin/xmouse
|
||||
%config %attr(0755,root,root) /etc/power/pwrctl
|
||||
%config(noreplace) %attr(0755,root,root) /etc/power/pwrctl-local
|
||||
/etc/init.d/pmud
|
||||
/etc/init.d/trackpad
|
||||
%config(noreplace) /etc/sysconfig/power
|
||||
%config(noreplace) /etc/sysconfig/trackpad
|
||||
%{_prefix}/share/man/man8/*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.0-9
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Wed Aug 26 2007 David Woodhouse <dwmw2@infradead.org> 1.0.0-8
|
||||
- Update licence
|
||||
|
||||
* Wed Aug 26 2007 David Woodhouse <dwmw2@infradead.org> 1.0.0-7
|
||||
- Rebuild
|
||||
- Fix open(O_CREAT) without mode
|
||||
|
||||
* Mon Sep 11 2006 David Woodhouse <dwmw2@infradead.org> 1.0.0-6
|
||||
- Fix ioctl definitions in m3mirror and m6mirror
|
||||
|
||||
* Mon Sep 11 2006 David Woodhouse <dwmw2@infradead.org> 1.0.0-5
|
||||
- Rebuild
|
||||
|
||||
* Fri Mar 31 2006 David Woodhouse <dwmw2@infradead.org> 1.0.0-4
|
||||
- BR libX11-devel
|
||||
|
||||
* Sun May 1 2005 David Woodhouse <dwmw2@infradead.org> 1.0.0-3
|
||||
- BR xorg-x11-devel
|
||||
|
||||
* Fri Apr 7 2005 Michael Schwendt <mschwendt[AT]users.sf.net> 1.0.0-2
|
||||
- rebuilt
|
||||
|
||||
* Sun Feb 13 2005 David Woodhouse <dwmw2@infradead.org> 1.0.0-1
|
||||
- Import into Fedora extras
|
||||
- update pmud init script
|
||||
- fix fcntl bugs
|
||||
|
||||
* Wed Aug 11 2004 Owen Stampflee <ostampflee@terrasoftsolutions.com>
|
||||
- do a trackpad notap on init
|
||||
|
||||
* Tue May 8 2004 Owen Stampflee <ostampflee@terrasoftsolutions.com>
|
||||
- linux 2.6 ugly hack patch
|
||||
|
||||
* Fri Aug 29 2003 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- fixes wakeup problem reported by Stefan Bruda (#49)
|
||||
|
||||
* Fri Mar 21 2003 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- stupid pmud
|
||||
|
||||
* Wed Mar 05 2003 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- enable trackpad
|
||||
|
||||
* Wed Jan 05 2003 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- updated trackpad init script
|
||||
|
||||
* Mon Nov 25 2002 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- fixed trackpad init script
|
||||
|
||||
* Sat Oct 12 2002 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- provide m3mirror and m6mirror
|
||||
- trackpad compile warning cleanups
|
||||
|
||||
* Wed Oct 02 2002 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- provide trackpad init script and sysconfig
|
||||
- /etc/rc.d/init.d -> /etc/init.d
|
||||
|
||||
* Tue Jan 15 2002 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- updated to 0.10-1
|
||||
- added trackpad in
|
||||
- build-rooted
|
||||
- disable beep on sleep or wake
|
||||
|
||||
* Sun Feb 04 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- fixed the spec a bit more (updated files list)
|
||||
- remove %pre for making /dev/{adb,pmu}; we now
|
||||
handle this in the dev package as it should be.
|
||||
|
||||
* Sun Feb 04 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
|
||||
- fixed the spec (removed packager, moved man pages where they
|
||||
belong)
|
||||
- patched pmud for kernel 2.4 headers
|
||||
|
||||
* Mon Nov 20 2000 Hollis Blanchard <hollis@terrasoftsolutions.com>
|
||||
- started changelog
|
||||
- allowed for gzipped man pages
|
||||
- fixed /usr/sbin/apm -> /var/tmp/pmud-buildroot/...
|
||||
- removed redundant version/Version and release/Release macros
|
||||
- removed %{release} from "Source: pmud-%{version}.%{release}.tar.gz"; release is for RPM revs (independant of original source)
|
||||
|
|
@ -1 +0,0 @@
|
|||
This package requires 32 bit PPC, which has not been a build target since Fedora 12.
|
||||
11
pmud-0.10-fixes.patch
Normal file
11
pmud-0.10-fixes.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
--- pmud-0.10/pmud.c.o 2003-08-29 13:07:52.000000000 -0600
|
||||
+++ pmud-0.10/pmud.c 2003-08-29 13:08:16.000000000 -0600
|
||||
@@ -510,7 +510,7 @@
|
||||
fbon(1);
|
||||
run_program(POWERLEVEL_SCRIPT,
|
||||
"lid-opened",
|
||||
- ac ? "ac" : "battery"
|
||||
+ powermode ? "ac" : "battery"
|
||||
);
|
||||
}
|
||||
}
|
||||
341
pmud-0.10-ydl.patch
Normal file
341
pmud-0.10-ydl.patch
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
diff -uNr pmud-0.10.o/contrib/backlight.c pmud-0.10/contrib/backlight.c
|
||||
--- pmud-0.10.o/contrib/backlight.c 2001-12-07 04:31:53.000000000 -0700
|
||||
+++ pmud-0.10/contrib/backlight.c 2002-10-12 16:55:51.000000000 -0600
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
-#include <asm/adb_mouse.h>
|
||||
-#include <asm/cuda.h>
|
||||
-#include <asm/adb.h>
|
||||
-#include <asm/pmu.h>
|
||||
+#include <linux/adb_mouse.h>
|
||||
+#include <linux/cuda.h>
|
||||
+#include <linux/adb.h>
|
||||
+#include <linux/pmu.h>
|
||||
|
||||
#undef DEBUG_SCAN
|
||||
#define DEBUG_REPLY
|
||||
diff -uNr pmud-0.10.o/contrib/m3mirror.c pmud-0.10/contrib/m3mirror.c
|
||||
--- pmud-0.10.o/contrib/m3mirror.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ pmud-0.10/contrib/m3mirror.c 2002-10-12 16:55:55.000000000 -0600
|
||||
@@ -0,0 +1,75 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+
|
||||
+#define ATY_MIRROR_LCD_ON 0x00000001
|
||||
+#define ATY_MIRROR_CRT_ON 0x00000002
|
||||
+
|
||||
+#define __u32 unsigned int
|
||||
+
|
||||
+/* out param: u32* backlight value: 0 to 15 */
|
||||
+#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, sizeof(__u32*))
|
||||
+/* in param: u32* backlight value: 0 to 15 */
|
||||
+#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, sizeof(__u32*))
|
||||
+
|
||||
+static void
|
||||
+usage(void)
|
||||
+{
|
||||
+ printf("syntax: m3mirror [crt:0|1] [lcd:0|1]\n");
|
||||
+}
|
||||
+
|
||||
+int main(int ac, char **av)
|
||||
+{
|
||||
+ int fd, rc, i;
|
||||
+ unsigned long value, orig;
|
||||
+
|
||||
+ printf("ATI Rage M3 mirror tool, v0.1\n");
|
||||
+ fd = open("/dev/fb0", 0);
|
||||
+ if (fd < 0) {
|
||||
+ perror("open /dev/fb0");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ rc = ioctl(fd, FBIO_ATY128_GET_MIRROR, &value);
|
||||
+ if (rc != 0) {
|
||||
+ printf("error %d getting mirror value\n", rc);
|
||||
+ goto bail;
|
||||
+ }
|
||||
+ printf("Mirror is currently: lcd: %s, crt: %s\n",
|
||||
+ (value & ATY_MIRROR_LCD_ON) ? "on" : "off",
|
||||
+ (value & ATY_MIRROR_CRT_ON) ? "on" : "off");
|
||||
+ orig = value;
|
||||
+ for(i=1; i<ac; i++) {
|
||||
+ if (!strncmp(av[i], "lcd:", 4)) {
|
||||
+ if (atoi((av[i])+4))
|
||||
+ value |= ATY_MIRROR_LCD_ON;
|
||||
+ else
|
||||
+ value &= ~ATY_MIRROR_LCD_ON;
|
||||
+ } else if (!strncmp(av[i], "crt:", 4)) {
|
||||
+ if (atoi((av[i])+4))
|
||||
+ value |= ATY_MIRROR_CRT_ON;
|
||||
+ else
|
||||
+ value &= ~ATY_MIRROR_CRT_ON;
|
||||
+ } else {
|
||||
+ usage();
|
||||
+ rc = -EINVAL;
|
||||
+ goto bail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (orig != value) {
|
||||
+ rc = ioctl(fd, FBIO_ATY128_SET_MIRROR, &value);
|
||||
+ if (rc != 0) {
|
||||
+ printf("error %d setting mirror value\n", rc);
|
||||
+ exit(rc);
|
||||
+ }
|
||||
+ printf("Mirror is now: lcd: %s, crt: %s\n",
|
||||
+ (value & ATY_MIRROR_LCD_ON) ? "on" : "off",
|
||||
+ (value & ATY_MIRROR_CRT_ON) ? "on" : "off");
|
||||
+ }
|
||||
+bail:
|
||||
+ close(fd);
|
||||
+ exit(rc);
|
||||
+}
|
||||
diff -uNr pmud-0.10.o/contrib/m6mirror.c pmud-0.10/contrib/m6mirror.c
|
||||
--- pmud-0.10.o/contrib/m6mirror.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ pmud-0.10/contrib/m6mirror.c 2002-10-12 16:55:55.000000000 -0600
|
||||
@@ -0,0 +1,75 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+
|
||||
+#define ATY_RADEON_LCD_ON 0x00000001
|
||||
+#define ATY_RADEON_CRT_ON 0x00000002
|
||||
+
|
||||
+#define __u32 unsigned int
|
||||
+
|
||||
+#define FBIO_RADEON_GET_MIRROR _IOR('@', 3, sizeof(__u32*))
|
||||
+#define FBIO_RADEON_SET_MIRROR _IOW('@', 4, sizeof(__u32*))
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+usage(void)
|
||||
+{
|
||||
+ printf("syntax: m6mirror [crt:0|1] [lcd:0|1]\n");
|
||||
+}
|
||||
+
|
||||
+int main(int ac, char **av)
|
||||
+{
|
||||
+ int fd, rc, i;
|
||||
+ unsigned long value, orig;
|
||||
+
|
||||
+ printf("ATI Radeon M6 mirror tool, v0.1\n");
|
||||
+ fd = open("/dev/fb0", 0);
|
||||
+ if (fd < 0) {
|
||||
+ perror("open /dev/fb0");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ rc = ioctl(fd, FBIO_RADEON_GET_MIRROR, &value);
|
||||
+ if (rc != 0) {
|
||||
+ printf("error %d getting mirror value\n", rc);
|
||||
+ goto bail;
|
||||
+ }
|
||||
+ printf("Mirror is currently: lcd: %s, crt: %s\n",
|
||||
+ (value & ATY_RADEON_LCD_ON) ? "on" : "off",
|
||||
+ (value & ATY_RADEON_CRT_ON) ? "on" : "off");
|
||||
+ orig = value;
|
||||
+ for(i=1; i<ac; i++) {
|
||||
+ if (!strncmp(av[i], "lcd:", 4)) {
|
||||
+ if (atoi((av[i])+4))
|
||||
+ value |= ATY_RADEON_LCD_ON;
|
||||
+ else
|
||||
+ value &= ~ATY_RADEON_LCD_ON;
|
||||
+ } else if (!strncmp(av[i], "crt:", 4)) {
|
||||
+ if (atoi((av[i])+4))
|
||||
+ value |= ATY_RADEON_CRT_ON;
|
||||
+ else
|
||||
+ value &= ~ATY_RADEON_CRT_ON;
|
||||
+ } else {
|
||||
+ usage();
|
||||
+ rc = -EINVAL;
|
||||
+ goto bail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (orig != value) {
|
||||
+ rc = ioctl(fd, FBIO_RADEON_SET_MIRROR, &value);
|
||||
+ if (rc != 0) {
|
||||
+ printf("error %d setting mirror value\n", rc);
|
||||
+ exit(rc);
|
||||
+ }
|
||||
+ printf("Mirror is now: lcd: %s, crt: %s\n",
|
||||
+ (value & ATY_RADEON_LCD_ON) ? "on" : "off",
|
||||
+ (value & ATY_RADEON_CRT_ON) ? "on" : "off");
|
||||
+ }
|
||||
+bail:
|
||||
+ close(fd);
|
||||
+ exit(rc);
|
||||
+}
|
||||
+
|
||||
diff -uNr pmud-0.10.o/contrib/Makefile pmud-0.10/contrib/Makefile
|
||||
--- pmud-0.10.o/contrib/Makefile 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ pmud-0.10/contrib/Makefile 2002-10-12 16:55:55.000000000 -0600
|
||||
@@ -0,0 +1,25 @@
|
||||
+CFLAGS = -Wall -O2
|
||||
+PROGS = trackpad m3mirror m6mirror
|
||||
+PREFIX = /
|
||||
+
|
||||
+all: $(PROGS)
|
||||
+
|
||||
+trackpad: trackpad.c
|
||||
+ $(CC) $(CFLAGS) -o trackpad trackpad.c
|
||||
+
|
||||
+fnset: fnset.c
|
||||
+ $(CC) $(CFLAGS) -o fnset fnset.c
|
||||
+
|
||||
+m3mirror: m3mirror.c
|
||||
+ $(CC) $(CFLAGS) -o m3mirror m3mirror.c
|
||||
+
|
||||
+m6mirror: m6mirror.c
|
||||
+ $(CC) $(CFLAGS) -o m6mirror m6mirror.c
|
||||
+
|
||||
+install:
|
||||
+ install -m 755 -c trackpad $(PREFIX)/usr/bin/trackpad
|
||||
+ install -m 755 -c m3mirror $(PREFIX)/usr/sbin/m3mirror
|
||||
+ install -m 755 -c m6mirror $(PREFIX)/usr/sbin/m6mirror
|
||||
+
|
||||
+clean:
|
||||
+ rm -f $(PROGS) *.o
|
||||
diff -uNr pmud-0.10.o/contrib/trackpad.c pmud-0.10/contrib/trackpad.c
|
||||
--- pmud-0.10.o/contrib/trackpad.c 2001-12-07 04:31:54.000000000 -0700
|
||||
+++ pmud-0.10/contrib/trackpad.c 2002-10-12 16:55:51.000000000 -0600
|
||||
@@ -7,6 +7,8 @@
|
||||
*
|
||||
* 3/17/99 - Minor Fix: usage display used to leave /dev/adb open
|
||||
*
|
||||
+ * 10/12/02 - Fixed warnings <dburcaw@terrasoftsolutions.com>
|
||||
+ *
|
||||
* Pieces from mousehack, from numerous contributors...
|
||||
*
|
||||
*/
|
||||
@@ -16,9 +18,9 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
-#include <asm/adb_mouse.h>
|
||||
-#include <asm/cuda.h>
|
||||
-#include <asm/adb.h>
|
||||
+#include <string.h>
|
||||
+#include <linux/cuda.h>
|
||||
+#include <linux/adb.h>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
diff -uNr pmud-0.10.o/Makefile pmud-0.10/Makefile
|
||||
--- pmud-0.10.o/Makefile 2001-12-15 14:57:47.000000000 -0700
|
||||
+++ pmud-0.10/Makefile 2002-10-12 16:55:51.000000000 -0600
|
||||
@@ -22,7 +22,8 @@
|
||||
#
|
||||
|
||||
CFLAGS = -Wall -O2
|
||||
-PROGS= pmud snooze wakebay fblevel xmouse
|
||||
+PROGS = pmud snooze wakebay fblevel xmouse
|
||||
+PREFIX = /
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
@@ -45,16 +46,22 @@
|
||||
$(CC) $(CFLAGS) -c tcp.c
|
||||
|
||||
install:
|
||||
- install -c pmud /sbin
|
||||
- install -c snooze /sbin
|
||||
- install -c wakebay /sbin
|
||||
- install -c fblevel /sbin
|
||||
- install -c xmouse /usr/X11R6/bin
|
||||
- install -c Batmon /usr/bin
|
||||
- install -c -D pwrctl /etc/power/pwrctl
|
||||
- cp pmud.rc /etc/rc.d/init.d/pmud
|
||||
- ln -s /sbin/snooze /usr/bin/apm
|
||||
- chkconfig --add pmud
|
||||
+ install -m 755 -c pmud $(PREFIX)/sbin
|
||||
+ install -m 755 -c snooze $(PREFIX)/sbin
|
||||
+ install -m 755 -c wakebay $(PREFIX)/sbin
|
||||
+ install -m 755 -c fblevel $(PREFIX)/sbin
|
||||
+ install -m 755 -c xmouse $(PREFIX)/usr/X11R6/bin
|
||||
+ install -m 755 -c Batmon $(PREFIX)/usr/bin
|
||||
+ install -m 644 -c -D pwrctl $(PREFIX)/etc/power/pwrctl
|
||||
+ install -m 644 -c -D pwrctl-local $(PREFIX)/etc/power/pwrctl-local
|
||||
+ install -m 755 -c pmud.rc $(PREFIX)/etc/init.d/pmud
|
||||
+ install -m 644 -c power.conf $(PREFIX)/etc/sysconfig/power
|
||||
+ cp pmud.8 $(PREFIX)/usr/share/man/man8
|
||||
+ cp snooze.8 $(PREFIX)/usr/share/man/man8
|
||||
+ cp fblevel.8 $(PREFIX)/usr/share/man/man8
|
||||
+ cp batmon.8 $(PREFIX)/usr/share/man/man8
|
||||
+ cp xmouse.8 $(PREFIX)/usr/share/man/man8
|
||||
+
|
||||
|
||||
clean:
|
||||
rm -f $(PROGS) *.o
|
||||
diff -uNr pmud-0.10.o/pmud.c pmud-0.10/pmud.c
|
||||
--- pmud-0.10.o/pmud.c 2001-12-16 02:50:41.000000000 -0700
|
||||
+++ pmud-0.10/pmud.c 2002-10-12 16:55:51.000000000 -0600
|
||||
@@ -1011,7 +1011,7 @@
|
||||
{
|
||||
apm.battery_status = 2; /* critical */
|
||||
|
||||
- beep(BEEP_TIME, BEEP_WARN);
|
||||
+ //beep(BEEP_TIME, BEEP_WARN);
|
||||
|
||||
if(!(state&FLG_SIGPWR))
|
||||
{
|
||||
@@ -1029,7 +1029,7 @@
|
||||
|
||||
if (++critical_time >= critical_margin)
|
||||
{
|
||||
- beep(BEEP_TIME, BEEP_WARN);
|
||||
+ //beep(BEEP_TIME, BEEP_WARN);
|
||||
|
||||
syslog(LOG_CRIT, "battery critically low: %s\n",
|
||||
flags&FLG_SIGPWR ?
|
||||
@@ -1385,7 +1385,7 @@
|
||||
if(id >= 0)
|
||||
ts = get_trackpad_settings(adb_fd, id);
|
||||
|
||||
- beep(BEEP_TIME, BEEP_OK);
|
||||
+ //beep(BEEP_TIME, BEEP_OK);
|
||||
|
||||
if(flags&FLG_DEBUG)
|
||||
syslog(LOG_DEBUG, "calling sync()");
|
||||
@@ -1400,7 +1400,7 @@
|
||||
else
|
||||
syslog(LOG_INFO, "system awake again");
|
||||
|
||||
- beep(BEEP_TIME, BEEP_OK);
|
||||
+ //beep(BEEP_TIME, BEEP_OK);
|
||||
|
||||
if(id >= 0)
|
||||
set_trackpad_settings(adb_fd, id, ts);
|
||||
@@ -1506,8 +1506,8 @@
|
||||
|
||||
static void bye(int ret, const char *msg)
|
||||
{
|
||||
- if(ret)
|
||||
- beep(BEEP_TIME, BEEP_ERR);
|
||||
+ //if(ret)
|
||||
+ //beep(BEEP_TIME, BEEP_ERR);
|
||||
|
||||
syslog(ret == EXIT_SUCCESS ? LOG_INFO : LOG_ERR,
|
||||
"daemon stopped (%s)",
|
||||
diff -uNr pmud-0.10.o/power.conf pmud-0.10/power.conf
|
||||
--- pmud-0.10.o/power.conf 2001-12-07 04:31:46.000000000 -0700
|
||||
+++ pmud-0.10/power.conf 2002-10-12 16:55:51.000000000 -0600
|
||||
@@ -17,7 +17,11 @@
|
||||
# this does not put the machine to sleep as
|
||||
# another SIGPWR needs to be send to init(8)
|
||||
# when power is restored.
|
||||
+# -u : use AF_UNIX sockets instead of TCP. Batmon does not
|
||||
+# support this option.
|
||||
# -v : print the version string of pmud.
|
||||
+# -K : put machine to sleep when lid closed and no ac power.
|
||||
+# If lid closed and on ac power, then only power off screen.
|
||||
#
|
||||
# see also pmud(8)
|
||||
# -----------------------------------------------------------------------------
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
51f3d8a65e92d26ceee7b2e9e06773d3 apmud-1.0.0.tgz
|
||||
63
trackpad.init
Executable file
63
trackpad.init
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# trackpad This shell script takes care configuring the trackpad
|
||||
#
|
||||
# chkconfig: 345 30 70
|
||||
# description: set trackpad defaults from /etc/sysconfig/trackpad
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
if grep -i "PowerBook" /proc/cpuinfo >/dev/null; then
|
||||
if [ -f /etc/sysconfig/trackpad -a -x /usr/bin/trackpad ]; then
|
||||
. /etc/sysconfig/trackpad
|
||||
if [ -n "$TRACKPAD_OPT" ]; then
|
||||
action "Setting default trackpad options" \
|
||||
/usr/bin/trackpad $TRACKPAD_OPT
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/trackpad
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/trackpad
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status trackpad
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/trackpad ]; then
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
4
trackpad.sysconfig
Normal file
4
trackpad.sysconfig
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# The following trackpad option gets run at startup
|
||||
# by /etc/init.d/trackpad. The available options are:
|
||||
# notap, tap, drag, lock
|
||||
TRACKPAD_OPT=notap
|
||||
Reference in a new issue