This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
apmud/pmud-0.10-ydl.patch

341 lines
9.8 KiB
Diff

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)
# -----------------------------------------------------------------------------